less 1.1.13 → 1.2.9

Sign up to get free protection for your applications and to get access to all the features.
Files changed (121) hide show
  1. data/Rakefile +13 -41
  2. data/VERSION +1 -1
  3. data/bin/lessc +8 -2
  4. data/less.gemspec +13 -92
  5. data/lib/ext.rb +15 -19
  6. data/lib/less.rb +2 -2
  7. data/lib/less/command.rb +14 -15
  8. data/lib/less/engine.rb +3 -2
  9. data/lib/less/engine/grammar/common.tt +1 -1
  10. data/lib/less/engine/grammar/entity.tt +5 -5
  11. data/lib/less/engine/grammar/less.tt +107 -77
  12. data/lib/less/engine/nodes/element.rb +103 -24
  13. data/lib/less/engine/nodes/entity.rb +3 -3
  14. data/lib/less/engine/nodes/function.rb +11 -6
  15. data/lib/less/engine/nodes/literal.rb +8 -4
  16. data/lib/less/engine/nodes/property.rb +98 -38
  17. data/lib/less/engine/nodes/selector.rb +1 -1
  18. data/spec/css/css-3.css +14 -0
  19. data/spec/css/mixins-args.css +31 -0
  20. data/spec/css/variables.css +1 -0
  21. data/spec/css/whitespace.css +1 -0
  22. data/spec/engine_spec.rb +4 -3
  23. data/spec/less/css-3.less +30 -0
  24. data/spec/less/hidden.less +25 -0
  25. data/spec/less/import.less +1 -0
  26. data/spec/less/literal-css.less +11 -0
  27. data/spec/less/mixins-args.less +50 -0
  28. data/spec/less/variables.less +7 -1
  29. data/spec/less/whitespace.less +1 -0
  30. data/spec/spec_helper.rb +2 -2
  31. metadata +25 -94
  32. data/lib/vendor/treetop/.gitignore +0 -7
  33. data/lib/vendor/treetop/LICENSE +0 -19
  34. data/lib/vendor/treetop/README +0 -164
  35. data/lib/vendor/treetop/Rakefile +0 -19
  36. data/lib/vendor/treetop/benchmark/seqpar.gnuplot +0 -15
  37. data/lib/vendor/treetop/benchmark/seqpar.treetop +0 -16
  38. data/lib/vendor/treetop/benchmark/seqpar_benchmark.rb +0 -107
  39. data/lib/vendor/treetop/bin/tt +0 -28
  40. data/lib/vendor/treetop/lib/treetop.rb +0 -8
  41. data/lib/vendor/treetop/lib/treetop/bootstrap_gen_1_metagrammar.rb +0 -45
  42. data/lib/vendor/treetop/lib/treetop/compiler.rb +0 -6
  43. data/lib/vendor/treetop/lib/treetop/compiler/grammar_compiler.rb +0 -42
  44. data/lib/vendor/treetop/lib/treetop/compiler/lexical_address_space.rb +0 -17
  45. data/lib/vendor/treetop/lib/treetop/compiler/metagrammar.rb +0 -3097
  46. data/lib/vendor/treetop/lib/treetop/compiler/metagrammar.treetop +0 -408
  47. data/lib/vendor/treetop/lib/treetop/compiler/node_classes.rb +0 -19
  48. data/lib/vendor/treetop/lib/treetop/compiler/node_classes/anything_symbol.rb +0 -18
  49. data/lib/vendor/treetop/lib/treetop/compiler/node_classes/atomic_expression.rb +0 -14
  50. data/lib/vendor/treetop/lib/treetop/compiler/node_classes/character_class.rb +0 -24
  51. data/lib/vendor/treetop/lib/treetop/compiler/node_classes/choice.rb +0 -31
  52. data/lib/vendor/treetop/lib/treetop/compiler/node_classes/declaration_sequence.rb +0 -24
  53. data/lib/vendor/treetop/lib/treetop/compiler/node_classes/grammar.rb +0 -28
  54. data/lib/vendor/treetop/lib/treetop/compiler/node_classes/inline_module.rb +0 -27
  55. data/lib/vendor/treetop/lib/treetop/compiler/node_classes/nonterminal.rb +0 -13
  56. data/lib/vendor/treetop/lib/treetop/compiler/node_classes/optional.rb +0 -19
  57. data/lib/vendor/treetop/lib/treetop/compiler/node_classes/parenthesized_expression.rb +0 -9
  58. data/lib/vendor/treetop/lib/treetop/compiler/node_classes/parsing_expression.rb +0 -138
  59. data/lib/vendor/treetop/lib/treetop/compiler/node_classes/parsing_rule.rb +0 -55
  60. data/lib/vendor/treetop/lib/treetop/compiler/node_classes/predicate.rb +0 -45
  61. data/lib/vendor/treetop/lib/treetop/compiler/node_classes/repetition.rb +0 -55
  62. data/lib/vendor/treetop/lib/treetop/compiler/node_classes/sequence.rb +0 -68
  63. data/lib/vendor/treetop/lib/treetop/compiler/node_classes/terminal.rb +0 -20
  64. data/lib/vendor/treetop/lib/treetop/compiler/node_classes/transient_prefix.rb +0 -9
  65. data/lib/vendor/treetop/lib/treetop/compiler/node_classes/treetop_file.rb +0 -9
  66. data/lib/vendor/treetop/lib/treetop/compiler/ruby_builder.rb +0 -113
  67. data/lib/vendor/treetop/lib/treetop/ruby_extensions.rb +0 -2
  68. data/lib/vendor/treetop/lib/treetop/ruby_extensions/string.rb +0 -42
  69. data/lib/vendor/treetop/lib/treetop/runtime.rb +0 -5
  70. data/lib/vendor/treetop/lib/treetop/runtime/compiled_parser.rb +0 -105
  71. data/lib/vendor/treetop/lib/treetop/runtime/interval_skip_list.rb +0 -4
  72. data/lib/vendor/treetop/lib/treetop/runtime/interval_skip_list/head_node.rb +0 -15
  73. data/lib/vendor/treetop/lib/treetop/runtime/interval_skip_list/interval_skip_list.rb +0 -200
  74. data/lib/vendor/treetop/lib/treetop/runtime/interval_skip_list/node.rb +0 -164
  75. data/lib/vendor/treetop/lib/treetop/runtime/syntax_node.rb +0 -72
  76. data/lib/vendor/treetop/lib/treetop/runtime/terminal_parse_failure.rb +0 -16
  77. data/lib/vendor/treetop/lib/treetop/runtime/terminal_syntax_node.rb +0 -17
  78. data/lib/vendor/treetop/lib/treetop/version.rb +0 -9
  79. data/lib/vendor/treetop/spec/compiler/and_predicate_spec.rb +0 -36
  80. data/lib/vendor/treetop/spec/compiler/anything_symbol_spec.rb +0 -44
  81. data/lib/vendor/treetop/spec/compiler/character_class_spec.rb +0 -182
  82. data/lib/vendor/treetop/spec/compiler/choice_spec.rb +0 -80
  83. data/lib/vendor/treetop/spec/compiler/circular_compilation_spec.rb +0 -28
  84. data/lib/vendor/treetop/spec/compiler/failure_propagation_functional_spec.rb +0 -21
  85. data/lib/vendor/treetop/spec/compiler/grammar_compiler_spec.rb +0 -84
  86. data/lib/vendor/treetop/spec/compiler/grammar_spec.rb +0 -41
  87. data/lib/vendor/treetop/spec/compiler/nonterminal_symbol_spec.rb +0 -40
  88. data/lib/vendor/treetop/spec/compiler/not_predicate_spec.rb +0 -38
  89. data/lib/vendor/treetop/spec/compiler/one_or_more_spec.rb +0 -35
  90. data/lib/vendor/treetop/spec/compiler/optional_spec.rb +0 -37
  91. data/lib/vendor/treetop/spec/compiler/parenthesized_expression_spec.rb +0 -19
  92. data/lib/vendor/treetop/spec/compiler/parsing_rule_spec.rb +0 -32
  93. data/lib/vendor/treetop/spec/compiler/sequence_spec.rb +0 -115
  94. data/lib/vendor/treetop/spec/compiler/terminal_spec.rb +0 -81
  95. data/lib/vendor/treetop/spec/compiler/terminal_symbol_spec.rb +0 -37
  96. data/lib/vendor/treetop/spec/compiler/test_grammar.treetop +0 -7
  97. data/lib/vendor/treetop/spec/compiler/test_grammar.tt +0 -7
  98. data/lib/vendor/treetop/spec/compiler/test_grammar_do.treetop +0 -7
  99. data/lib/vendor/treetop/spec/compiler/zero_or_more_spec.rb +0 -56
  100. data/lib/vendor/treetop/spec/composition/a.treetop +0 -11
  101. data/lib/vendor/treetop/spec/composition/b.treetop +0 -11
  102. data/lib/vendor/treetop/spec/composition/c.treetop +0 -10
  103. data/lib/vendor/treetop/spec/composition/d.treetop +0 -10
  104. data/lib/vendor/treetop/spec/composition/f.treetop +0 -17
  105. data/lib/vendor/treetop/spec/composition/grammar_composition_spec.rb +0 -40
  106. data/lib/vendor/treetop/spec/composition/subfolder/e_includes_c.treetop +0 -15
  107. data/lib/vendor/treetop/spec/ruby_extensions/string_spec.rb +0 -32
  108. data/lib/vendor/treetop/spec/runtime/compiled_parser_spec.rb +0 -101
  109. data/lib/vendor/treetop/spec/runtime/interval_skip_list/delete_spec.rb +0 -147
  110. data/lib/vendor/treetop/spec/runtime/interval_skip_list/expire_range_spec.rb +0 -349
  111. data/lib/vendor/treetop/spec/runtime/interval_skip_list/insert_and_delete_node.rb +0 -385
  112. data/lib/vendor/treetop/spec/runtime/interval_skip_list/insert_spec.rb +0 -660
  113. data/lib/vendor/treetop/spec/runtime/interval_skip_list/interval_skip_list_spec.graffle +0 -6175
  114. data/lib/vendor/treetop/spec/runtime/interval_skip_list/interval_skip_list_spec.rb +0 -58
  115. data/lib/vendor/treetop/spec/runtime/interval_skip_list/palindromic_fixture.rb +0 -23
  116. data/lib/vendor/treetop/spec/runtime/interval_skip_list/palindromic_fixture_spec.rb +0 -164
  117. data/lib/vendor/treetop/spec/runtime/interval_skip_list/spec_helper.rb +0 -84
  118. data/lib/vendor/treetop/spec/runtime/syntax_node_spec.rb +0 -53
  119. data/lib/vendor/treetop/spec/spec_helper.rb +0 -106
  120. data/lib/vendor/treetop/spec/spec_suite.rb +0 -4
  121. data/lib/vendor/treetop/treetop.gemspec +0 -17
@@ -1,408 +0,0 @@
1
- module Treetop
2
- module Compiler
3
- grammar Metagrammar
4
- rule treetop_file
5
- requires:(space? require_statement)* prefix:space? module_or_grammar:(module_declaration / grammar) suffix:space? {
6
- def compile
7
- requires.text_value + prefix.text_value + module_or_grammar.compile + suffix.text_value
8
- end
9
- }
10
- end
11
-
12
- rule require_statement
13
- prefix:space? "require" [ \t]+ [^\n\r]+ [\n\r]
14
- end
15
-
16
- rule module_declaration
17
- prefix:('module' space [A-Z] alphanumeric_char* space) module_contents:(module_declaration / grammar) suffix:(space 'end') {
18
- def compile
19
- prefix.text_value + module_contents.compile + suffix.text_value
20
- end
21
- }
22
- end
23
-
24
- rule grammar
25
- 'grammar' space grammar_name space ('do' space)? declaration_sequence space? 'end' <Grammar>
26
- end
27
-
28
- rule grammar_name
29
- ([A-Z] alphanumeric_char*)
30
- end
31
-
32
- rule declaration_sequence
33
- head:declaration tail:(space declaration)* <DeclarationSequence> {
34
- def declarations
35
- [head] + tail
36
- end
37
-
38
- def tail
39
- super.elements.map { |elt| elt.declaration }
40
- end
41
- }
42
- /
43
- '' {
44
- def compile(builder)
45
- end
46
- }
47
- end
48
-
49
- rule declaration
50
- parsing_rule / include_declaration
51
- end
52
-
53
- rule include_declaration
54
- 'include' space [A-Z] (alphanumeric_char / '::')* {
55
- def compile(builder)
56
- builder << text_value
57
- end
58
- }
59
- end
60
-
61
- rule parsing_rule
62
- 'rule' space nonterminal space ('do' space)? parsing_expression space 'end' <ParsingRule>
63
- end
64
-
65
- rule parsing_expression
66
- choice / sequence / primary
67
- end
68
-
69
- rule choice
70
- head:alternative tail:(space? '/' space? alternative)+ <Choice> {
71
- def alternatives
72
- [head] + tail
73
- end
74
-
75
- def tail
76
- super.elements.map {|elt| elt.alternative}
77
- end
78
-
79
- def inline_modules
80
- (alternatives.map {|alt| alt.inline_modules }).flatten
81
- end
82
- }
83
- end
84
-
85
- rule sequence
86
- head:labeled_sequence_primary tail:(space labeled_sequence_primary)+ node_class_declarations <Sequence> {
87
- def sequence_elements
88
- [head] + tail
89
- end
90
-
91
- def tail
92
- super.elements.map {|elt| elt.labeled_sequence_primary }
93
- end
94
-
95
- def inline_modules
96
- (sequence_elements.map {|elt| elt.inline_modules}).flatten +
97
- [sequence_element_accessor_module] +
98
- node_class_declarations.inline_modules
99
- end
100
-
101
- def inline_module_name
102
- node_class_declarations.inline_module_name
103
- end
104
- }
105
- end
106
-
107
- rule alternative
108
- sequence / primary
109
- end
110
-
111
- rule primary
112
- prefix atomic {
113
- def compile(address, builder, parent_expression=nil)
114
- prefix.compile(address, builder, self)
115
- end
116
-
117
- def prefixed_expression
118
- atomic
119
- end
120
-
121
- def inline_modules
122
- atomic.inline_modules
123
- end
124
-
125
- def inline_module_name
126
- nil
127
- end
128
- }
129
- /
130
- atomic suffix node_class_declarations {
131
- def compile(address, builder, parent_expression=nil)
132
- suffix.compile(address, builder, self)
133
- end
134
-
135
- def optional_expression
136
- atomic
137
- end
138
-
139
- def node_class_name
140
- node_class_declarations.node_class_name
141
- end
142
-
143
- def inline_modules
144
- atomic.inline_modules + node_class_declarations.inline_modules
145
- end
146
-
147
- def inline_module_name
148
- node_class_declarations.inline_module_name
149
- end
150
- }
151
- /
152
- atomic node_class_declarations {
153
- def compile(address, builder, parent_expression=nil)
154
- atomic.compile(address, builder, self)
155
- end
156
-
157
- def node_class_name
158
- node_class_declarations.node_class_name
159
- end
160
-
161
- def inline_modules
162
- atomic.inline_modules + node_class_declarations.inline_modules
163
- end
164
-
165
- def inline_module_name
166
- node_class_declarations.inline_module_name
167
- end
168
- }
169
- end
170
-
171
- rule labeled_sequence_primary
172
- label sequence_primary {
173
- def compile(lexical_address, builder)
174
- sequence_primary.compile(lexical_address, builder)
175
- end
176
-
177
- def inline_modules
178
- sequence_primary.inline_modules
179
- end
180
-
181
- def label_name
182
- if label.name
183
- label.name
184
- elsif sequence_primary.instance_of?(Nonterminal)
185
- sequence_primary.text_value
186
- else
187
- nil
188
- end
189
- end
190
- }
191
- end
192
-
193
- rule label
194
- (alpha_char alphanumeric_char*) ':' {
195
- def name
196
- elements[0].text_value
197
- end
198
- }
199
- /
200
- '' {
201
- def name
202
- nil
203
- end
204
- }
205
- end
206
-
207
- rule sequence_primary
208
- prefix atomic {
209
- def compile(lexical_address, builder)
210
- prefix.compile(lexical_address, builder, self)
211
- end
212
-
213
- def prefixed_expression
214
- elements[1]
215
- end
216
-
217
- def inline_modules
218
- atomic.inline_modules
219
- end
220
-
221
- def inline_module_name
222
- nil
223
- end
224
- }
225
- /
226
- atomic suffix {
227
- def compile(lexical_address, builder)
228
- suffix.compile(lexical_address, builder, self)
229
- end
230
-
231
- def node_class_name
232
- nil
233
- end
234
-
235
- def inline_modules
236
- atomic.inline_modules
237
- end
238
-
239
- def inline_module_name
240
- nil
241
- end
242
- }
243
- /
244
- atomic
245
- end
246
-
247
- rule suffix
248
- repetition_suffix / optional_suffix
249
- end
250
-
251
- rule optional_suffix
252
- '?' <Optional>
253
- end
254
-
255
- rule node_class_declarations
256
- node_class_expression trailing_inline_module {
257
- def node_class_name
258
- node_class_expression.node_class_name
259
- end
260
-
261
- def inline_modules
262
- trailing_inline_module.inline_modules
263
- end
264
-
265
- def inline_module
266
- trailing_inline_module.inline_module
267
- end
268
-
269
- def inline_module_name
270
- inline_module.module_name if inline_module
271
- end
272
- }
273
- end
274
-
275
- rule repetition_suffix
276
- '+' <OneOrMore> / '*' <ZeroOrMore>
277
- end
278
-
279
- rule prefix
280
- '&' <AndPredicate> / '!' <NotPredicate> / '~' <TransientPrefix>
281
- end
282
-
283
- rule atomic
284
- terminal
285
- /
286
- nonterminal
287
- /
288
- parenthesized_expression
289
- end
290
-
291
- rule parenthesized_expression
292
- '(' space? parsing_expression space? ')' <ParenthesizedExpression> {
293
- def inline_modules
294
- parsing_expression.inline_modules
295
- end
296
- }
297
- end
298
-
299
- rule nonterminal
300
- !keyword_inside_grammar (alpha_char alphanumeric_char*) <Nonterminal>
301
- end
302
-
303
- rule terminal
304
- quoted_string / character_class / anything_symbol
305
- end
306
-
307
- rule quoted_string
308
- (single_quoted_string / double_quoted_string) {
309
- def string
310
- super.text_value
311
- end
312
- }
313
- end
314
-
315
- rule double_quoted_string
316
- '"' string:(!'"' ("\\\\" / '\"' / .))* '"' <Terminal>
317
- end
318
-
319
- rule single_quoted_string
320
- "'" string:(!"'" ("\\\\" / "\\'" / .))* "'" <Terminal>
321
- end
322
-
323
- rule character_class
324
- '[' characters:(!']' ('\\' . /!'\\' .))+ ']' <CharacterClass> {
325
- def characters
326
- super.text_value
327
- end
328
- }
329
- end
330
-
331
- rule anything_symbol
332
- '.' <AnythingSymbol>
333
- end
334
-
335
- rule node_class_expression
336
- space '<' (!'>' .)+ '>' {
337
- def node_class_name
338
- elements[2].text_value
339
- end
340
- }
341
- /
342
- '' {
343
- def node_class_name
344
- nil
345
- end
346
- }
347
- end
348
-
349
- rule trailing_inline_module
350
- space inline_module {
351
- def inline_modules
352
- [inline_module]
353
- end
354
-
355
- def inline_module_name
356
- inline_module.module_name
357
- end
358
- }
359
- /
360
- '' {
361
- def inline_modules
362
- []
363
- end
364
-
365
- def inline_module
366
- nil
367
- end
368
-
369
- def inline_module_name
370
- nil
371
- end
372
- }
373
- end
374
-
375
- rule inline_module
376
- '{' (inline_module / ![{}] .)* '}' <InlineModule>
377
- end
378
-
379
- rule keyword_inside_grammar
380
- ('rule' / 'end') !non_space_char
381
- end
382
-
383
- rule non_space_char
384
- !space .
385
- end
386
-
387
- rule alpha_char
388
- [A-Za-z_]
389
- end
390
-
391
- rule alphanumeric_char
392
- alpha_char / [0-9]
393
- end
394
-
395
- rule space
396
- (white / comment_to_eol)+
397
- end
398
-
399
- rule comment_to_eol
400
- '#' (!"\n" .)*
401
- end
402
-
403
- rule white
404
- [ \t\n\r]
405
- end
406
- end
407
- end
408
- end
@@ -1,19 +0,0 @@
1
- dir = File.dirname(__FILE__)
2
- require File.join(dir, *%w[node_classes parsing_expression])
3
- require File.join(dir, *%w[node_classes atomic_expression])
4
- require File.join(dir, *%w[node_classes inline_module])
5
- require File.join(dir, *%w[node_classes treetop_file])
6
- require File.join(dir, *%w[node_classes grammar])
7
- require File.join(dir, *%w[node_classes declaration_sequence])
8
- require File.join(dir, *%w[node_classes parsing_rule])
9
- require File.join(dir, *%w[node_classes parenthesized_expression])
10
- require File.join(dir, *%w[node_classes nonterminal])
11
- require File.join(dir, *%w[node_classes terminal])
12
- require File.join(dir, *%w[node_classes anything_symbol])
13
- require File.join(dir, *%w[node_classes character_class])
14
- require File.join(dir, *%w[node_classes sequence])
15
- require File.join(dir, *%w[node_classes choice])
16
- require File.join(dir, *%w[node_classes repetition])
17
- require File.join(dir, *%w[node_classes optional])
18
- require File.join(dir, *%w[node_classes predicate])
19
- require File.join(dir, *%w[node_classes transient_prefix])
@@ -1,18 +0,0 @@
1
- module Treetop
2
- module Compiler
3
- class AnythingSymbol < AtomicExpression
4
- def compile(address, builder, parent_expression = nil)
5
- super
6
- builder.if__ "index < input_length" do
7
- assign_result "instantiate_node(#{node_class_name},input, index...(index + 1))"
8
- extend_result_with_inline_module
9
- builder << "@index += 1"
10
- end
11
- builder.else_ do
12
- builder << 'terminal_parse_failure("any character")'
13
- assign_result 'nil'
14
- end
15
- end
16
- end
17
- end
18
- end
@@ -1,14 +0,0 @@
1
- module Treetop
2
- module Compiler
3
- class AtomicExpression < ParsingExpression
4
- def inline_modules
5
- []
6
- end
7
-
8
- def single_quote(string)
9
- # Double any backslashes, then backslash any single-quotes:
10
- "'#{string.gsub(/\\/) { '\\\\' }.gsub(/'/) { "\\'"}}'"
11
- end
12
- end
13
- end
14
- end