less 0.8.13 → 1.0.4

Sign up to get free protection for your applications and to get access to all the features.
Files changed (156) hide show
  1. data/README.md +10 -1
  2. data/Rakefile +21 -3
  3. data/VERSION +1 -1
  4. data/bin/lessc +0 -8
  5. data/less.gemspec +138 -15
  6. data/lib/less.rb +67 -11
  7. data/lib/less/command.rb +24 -25
  8. data/lib/less/engine.rb +36 -140
  9. data/lib/less/engine/builder.rb +8 -0
  10. data/lib/less/engine/less.tt +374 -0
  11. data/lib/less/engine/nodes.rb +8 -0
  12. data/lib/less/engine/nodes/element.rb +150 -0
  13. data/lib/less/engine/nodes/entity.rb +73 -0
  14. data/lib/less/engine/nodes/function.rb +82 -0
  15. data/lib/less/engine/nodes/literal.rb +135 -0
  16. data/lib/less/engine/nodes/property.rb +112 -0
  17. data/lib/less/engine/nodes/selector.rb +39 -0
  18. data/lib/less/engine/parser.rb +3860 -0
  19. data/lib/vendor/treetop/.gitignore +7 -0
  20. data/lib/vendor/treetop/LICENSE +19 -0
  21. data/lib/vendor/treetop/README +164 -0
  22. data/lib/vendor/treetop/Rakefile +19 -0
  23. data/lib/vendor/treetop/benchmark/seqpar.gnuplot +15 -0
  24. data/lib/vendor/treetop/benchmark/seqpar.treetop +16 -0
  25. data/lib/vendor/treetop/benchmark/seqpar_benchmark.rb +107 -0
  26. data/lib/vendor/treetop/bin/tt +28 -0
  27. data/lib/vendor/treetop/lib/treetop.rb +8 -0
  28. data/lib/vendor/treetop/lib/treetop/bootstrap_gen_1_metagrammar.rb +45 -0
  29. data/lib/vendor/treetop/lib/treetop/compiler.rb +6 -0
  30. data/lib/vendor/treetop/lib/treetop/compiler/grammar_compiler.rb +42 -0
  31. data/lib/vendor/treetop/lib/treetop/compiler/lexical_address_space.rb +17 -0
  32. data/lib/vendor/treetop/lib/treetop/compiler/metagrammar.rb +3097 -0
  33. data/lib/vendor/treetop/lib/treetop/compiler/metagrammar.treetop +408 -0
  34. data/lib/vendor/treetop/lib/treetop/compiler/node_classes.rb +19 -0
  35. data/lib/vendor/treetop/lib/treetop/compiler/node_classes/anything_symbol.rb +18 -0
  36. data/lib/vendor/treetop/lib/treetop/compiler/node_classes/atomic_expression.rb +14 -0
  37. data/lib/vendor/treetop/lib/treetop/compiler/node_classes/character_class.rb +23 -0
  38. data/lib/vendor/treetop/lib/treetop/compiler/node_classes/choice.rb +31 -0
  39. data/lib/vendor/treetop/lib/treetop/compiler/node_classes/declaration_sequence.rb +24 -0
  40. data/lib/vendor/treetop/lib/treetop/compiler/node_classes/grammar.rb +28 -0
  41. data/lib/vendor/treetop/lib/treetop/compiler/node_classes/inline_module.rb +27 -0
  42. data/lib/vendor/treetop/lib/treetop/compiler/node_classes/nonterminal.rb +13 -0
  43. data/lib/vendor/treetop/lib/treetop/compiler/node_classes/optional.rb +19 -0
  44. data/lib/vendor/treetop/lib/treetop/compiler/node_classes/parenthesized_expression.rb +9 -0
  45. data/lib/vendor/treetop/lib/treetop/compiler/node_classes/parsing_expression.rb +146 -0
  46. data/lib/vendor/treetop/lib/treetop/compiler/node_classes/parsing_rule.rb +55 -0
  47. data/lib/vendor/treetop/lib/treetop/compiler/node_classes/predicate.rb +45 -0
  48. data/lib/vendor/treetop/lib/treetop/compiler/node_classes/repetition.rb +55 -0
  49. data/lib/vendor/treetop/lib/treetop/compiler/node_classes/sequence.rb +68 -0
  50. data/lib/vendor/treetop/lib/treetop/compiler/node_classes/terminal.rb +20 -0
  51. data/lib/vendor/treetop/lib/treetop/compiler/node_classes/transient_prefix.rb +9 -0
  52. data/lib/vendor/treetop/lib/treetop/compiler/node_classes/treetop_file.rb +9 -0
  53. data/lib/vendor/treetop/lib/treetop/compiler/ruby_builder.rb +113 -0
  54. data/lib/vendor/treetop/lib/treetop/ruby_extensions.rb +2 -0
  55. data/lib/vendor/treetop/lib/treetop/ruby_extensions/string.rb +42 -0
  56. data/lib/vendor/treetop/lib/treetop/runtime.rb +5 -0
  57. data/lib/vendor/treetop/lib/treetop/runtime/compiled_parser.rb +109 -0
  58. data/lib/vendor/treetop/lib/treetop/runtime/interval_skip_list.rb +4 -0
  59. data/lib/vendor/treetop/lib/treetop/runtime/interval_skip_list/head_node.rb +15 -0
  60. data/lib/vendor/treetop/lib/treetop/runtime/interval_skip_list/interval_skip_list.rb +200 -0
  61. data/lib/vendor/treetop/lib/treetop/runtime/interval_skip_list/node.rb +164 -0
  62. data/lib/vendor/treetop/lib/treetop/runtime/syntax_node.rb +90 -0
  63. data/lib/vendor/treetop/lib/treetop/runtime/terminal_parse_failure.rb +16 -0
  64. data/lib/vendor/treetop/lib/treetop/runtime/terminal_syntax_node.rb +17 -0
  65. data/lib/vendor/treetop/lib/treetop/version.rb +9 -0
  66. data/lib/vendor/treetop/spec/compiler/and_predicate_spec.rb +36 -0
  67. data/lib/vendor/treetop/spec/compiler/anything_symbol_spec.rb +44 -0
  68. data/lib/vendor/treetop/spec/compiler/character_class_spec.rb +247 -0
  69. data/lib/vendor/treetop/spec/compiler/choice_spec.rb +80 -0
  70. data/lib/vendor/treetop/spec/compiler/circular_compilation_spec.rb +28 -0
  71. data/lib/vendor/treetop/spec/compiler/failure_propagation_functional_spec.rb +21 -0
  72. data/lib/vendor/treetop/spec/compiler/grammar_compiler_spec.rb +84 -0
  73. data/lib/vendor/treetop/spec/compiler/grammar_spec.rb +41 -0
  74. data/lib/vendor/treetop/spec/compiler/nonterminal_symbol_spec.rb +40 -0
  75. data/lib/vendor/treetop/spec/compiler/not_predicate_spec.rb +38 -0
  76. data/lib/vendor/treetop/spec/compiler/one_or_more_spec.rb +35 -0
  77. data/lib/vendor/treetop/spec/compiler/optional_spec.rb +37 -0
  78. data/lib/vendor/treetop/spec/compiler/parenthesized_expression_spec.rb +19 -0
  79. data/lib/vendor/treetop/spec/compiler/parsing_rule_spec.rb +32 -0
  80. data/lib/vendor/treetop/spec/compiler/sequence_spec.rb +115 -0
  81. data/lib/vendor/treetop/spec/compiler/terminal_spec.rb +81 -0
  82. data/lib/vendor/treetop/spec/compiler/terminal_symbol_spec.rb +37 -0
  83. data/lib/vendor/treetop/spec/compiler/test_grammar.treetop +7 -0
  84. data/lib/vendor/treetop/spec/compiler/test_grammar.tt +7 -0
  85. data/lib/vendor/treetop/spec/compiler/test_grammar_do.treetop +7 -0
  86. data/lib/vendor/treetop/spec/compiler/zero_or_more_spec.rb +56 -0
  87. data/lib/vendor/treetop/spec/composition/a.treetop +11 -0
  88. data/lib/vendor/treetop/spec/composition/b.treetop +11 -0
  89. data/lib/vendor/treetop/spec/composition/c.treetop +10 -0
  90. data/lib/vendor/treetop/spec/composition/d.treetop +10 -0
  91. data/lib/vendor/treetop/spec/composition/f.treetop +17 -0
  92. data/lib/vendor/treetop/spec/composition/grammar_composition_spec.rb +40 -0
  93. data/lib/vendor/treetop/spec/composition/subfolder/e_includes_c.treetop +15 -0
  94. data/lib/vendor/treetop/spec/ruby_extensions/string_spec.rb +32 -0
  95. data/lib/vendor/treetop/spec/runtime/compiled_parser_spec.rb +101 -0
  96. data/lib/vendor/treetop/spec/runtime/interval_skip_list/delete_spec.rb +147 -0
  97. data/lib/vendor/treetop/spec/runtime/interval_skip_list/expire_range_spec.rb +349 -0
  98. data/lib/vendor/treetop/spec/runtime/interval_skip_list/insert_and_delete_node.rb +385 -0
  99. data/lib/vendor/treetop/spec/runtime/interval_skip_list/insert_spec.rb +660 -0
  100. data/lib/vendor/treetop/spec/runtime/interval_skip_list/interval_skip_list_spec.graffle +6175 -0
  101. data/lib/vendor/treetop/spec/runtime/interval_skip_list/interval_skip_list_spec.rb +58 -0
  102. data/lib/vendor/treetop/spec/runtime/interval_skip_list/palindromic_fixture.rb +23 -0
  103. data/lib/vendor/treetop/spec/runtime/interval_skip_list/palindromic_fixture_spec.rb +164 -0
  104. data/lib/vendor/treetop/spec/runtime/interval_skip_list/spec_helper.rb +84 -0
  105. data/lib/vendor/treetop/spec/runtime/syntax_node_spec.rb +68 -0
  106. data/lib/vendor/treetop/spec/spec_helper.rb +106 -0
  107. data/lib/vendor/treetop/spec/spec_suite.rb +4 -0
  108. data/lib/vendor/treetop/treetop.gemspec +17 -0
  109. data/spec/command_spec.rb +2 -6
  110. data/spec/css/accessors-1.0.css +18 -0
  111. data/spec/css/big-1.0.css +3768 -0
  112. data/spec/css/comments-1.0.css +9 -0
  113. data/spec/css/css-1.0.css +40 -0
  114. data/spec/css/functions-1.0.css +6 -0
  115. data/spec/css/import-1.0.css +11 -0
  116. data/spec/css/mixins-1.0.css +28 -0
  117. data/spec/css/operations-1.0.css +28 -0
  118. data/spec/css/rulesets-1.0.css +17 -0
  119. data/spec/css/scope-1.0.css +14 -0
  120. data/spec/css/strings-1.0.css +12 -0
  121. data/spec/css/variables-1.0.css +6 -0
  122. data/spec/css/whitespace-1.0.css +9 -0
  123. data/spec/engine_spec.rb +66 -18
  124. data/spec/less/accessors-1.0.less +20 -0
  125. data/spec/less/big-1.0.less +4810 -0
  126. data/spec/less/colors-1.0.less +0 -0
  127. data/spec/less/comments-1.0.less +46 -0
  128. data/spec/less/css-1.0.less +84 -0
  129. data/spec/less/exceptions/mixed-units-error.less +3 -0
  130. data/spec/less/exceptions/name-error-1.0.less +3 -0
  131. data/spec/less/exceptions/syntax-error-1.0.less +3 -0
  132. data/spec/less/functions-1.0.less +6 -0
  133. data/spec/less/import-1.0.less +7 -0
  134. data/spec/less/import/import-test-a.less +2 -0
  135. data/spec/less/import/import-test-b.less +8 -0
  136. data/spec/less/import/import-test-c.less +5 -0
  137. data/spec/less/mixins-1.0.less +43 -0
  138. data/spec/less/operations-1.0.less +39 -0
  139. data/spec/less/rulesets-1.0.less +30 -0
  140. data/spec/less/scope-1.0.less +33 -0
  141. data/spec/less/strings-1.0.less +14 -0
  142. data/spec/less/variables-1.0.less +18 -0
  143. data/spec/less/whitespace-1.0.less +21 -0
  144. data/spec/spec.css +79 -24
  145. data/spec/spec.less +2 -3
  146. data/spec/spec_helper.rb +4 -1
  147. metadata +136 -13
  148. data/lib/less/tree.rb +0 -82
  149. data/spec/css/less-0.8.10.css +0 -30
  150. data/spec/css/less-0.8.11.css +0 -31
  151. data/spec/css/less-0.8.12.css +0 -28
  152. data/spec/css/less-0.8.5.css +0 -24
  153. data/spec/css/less-0.8.6.css +0 -24
  154. data/spec/css/less-0.8.7.css +0 -24
  155. data/spec/css/less-0.8.8.css +0 -25
  156. data/spec/tree_spec.rb +0 -5
@@ -0,0 +1,408 @@
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
@@ -0,0 +1,19 @@
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])
@@ -0,0 +1,18 @@
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
@@ -0,0 +1,14 @@
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