public
Fork of nathansobo/treetop
Description: A Ruby-based parsing DSL based on parsing expression grammars.
Homepage: http://treetop.rubyforge.org
Clone URL: git://github.com/juretta/treetop.git
Regenerated metagrammar.
Nathan Sobo (author)
Sun Dec 09 19:44:27 -0800 2007
commit  0f88ab35ad130a8395cd57411b3afaf7b6e84358
tree    27b1d415191d0dc48c123622da9bf74a1c43ef36
parent  3373c9048817e9df006a9bdc2c501423fe0c11dd
...
135
136
137
138
 
 
 
 
 
 
139
140
141
...
295
296
297
298
 
 
 
 
 
 
299
300
301
...
476
477
478
479
 
 
 
 
 
 
480
481
482
...
1812
1813
1814
 
 
 
 
 
 
 
 
 
 
1815
1816
1817
...
1882
1883
1884
 
1885
1886
1887
...
2114
2115
2116
2117
 
 
 
 
 
 
2118
2119
2120
...
2262
2263
2264
2265
 
 
 
 
 
 
2266
2267
2268
...
2282
2283
2284
2285
 
 
 
 
 
 
2286
2287
2288
...
2306
2307
2308
2309
 
 
 
 
 
 
2310
2311
2312
...
135
136
137
 
138
139
140
141
142
143
144
145
146
...
300
301
302
 
303
304
305
306
307
308
309
310
311
...
486
487
488
 
489
490
491
492
493
494
495
496
497
...
1827
1828
1829
1830
1831
1832
1833
1834
1835
1836
1837
1838
1839
1840
1841
1842
...
1907
1908
1909
1910
1911
1912
1913
...
2140
2141
2142
 
2143
2144
2145
2146
2147
2148
2149
2150
2151
...
2293
2294
2295
 
2296
2297
2298
2299
2300
2301
2302
2303
2304
...
2318
2319
2320
 
2321
2322
2323
2324
2325
2326
2327
2328
2329
...
2347
2348
2349
 
2350
2351
2352
2353
2354
2355
2356
2357
2358
0
@@ -135,7 +135,12 @@ module Treetop
0
           r3 = _nt_space
0
           s1 << r3
0
           if r3.success?
0
- r4 = parse_char_class(/[A-Z]/, 'A-Z', SyntaxNode)
0
+ if input.index(/[A-Z]/, index) == index
0
+ r4 = (SyntaxNode).new(input, index...(index + 1))
0
+ @index += 1
0
+ else
0
+ r4 = nil
0
+ end
0
             s1 << r4
0
             if r4.success?
0
               s5, i5 = [], index
0
@@ -295,7 +300,12 @@ module Treetop
0
         end
0
         
0
         i0, s0 = index, []
0
- r1 = parse_char_class(/[A-Z]/, 'A-Z', SyntaxNode)
0
+ if input.index(/[A-Z]/, index) == index
0
+ r1 = (SyntaxNode).new(input, index...(index + 1))
0
+ @index += 1
0
+ else
0
+ r1 = nil
0
+ end
0
         s0 << r1
0
         if r1.success?
0
           s2, i2 = [], index
0
@@ -476,7 +486,12 @@ module Treetop
0
           r2 = _nt_space
0
           s0 << r2
0
           if r2.success?
0
- r3 = parse_char_class(/[A-Z]/, 'A-Z', SyntaxNode)
0
+ if input.index(/[A-Z]/, index) == index
0
+ r3 = (SyntaxNode).new(input, index...(index + 1))
0
+ @index += 1
0
+ else
0
+ r3 = nil
0
+ end
0
             s0 << r3
0
             if r3.success?
0
               s4, i4 = [], index
0
@@ -1812,6 +1827,16 @@ module Treetop
0
       end
0
       
0
       module CharacterClass1
0
+ def characters
0
+ elements[1]
0
+ end
0
+
0
+ end
0
+
0
+ module CharacterClass2
0
+ def characters
0
+ super.text_value
0
+ end
0
       end
0
       
0
       def _nt_character_class
0
@@ -1882,6 +1907,7 @@ module Treetop
0
         if s0.last.success?
0
           r0 = (CharacterClass).new(input, i0...index, s0)
0
           r0.extend(CharacterClass1)
0
+ r0.extend(CharacterClass2)
0
         else
0
           self.index = i0
0
           r0 = nil
0
@@ -2114,7 +2140,12 @@ module Treetop
0
             else
0
               i5, s5 = index, []
0
               i6 = index
0
- r7 = parse_char_class(/[{}]/, '{}', SyntaxNode)
0
+ if input.index(/[{}]/, index) == index
0
+ r7 = (SyntaxNode).new(input, index...(index + 1))
0
+ @index += 1
0
+ else
0
+ r7 = nil
0
+ end
0
               if r7.success?
0
                 r6 = nil
0
               else
0
@@ -2262,7 +2293,12 @@ module Treetop
0
           return cached
0
         end
0
         
0
- r0 = parse_char_class(/[A-Za-z_]/, 'A-Za-z_', SyntaxNode)
0
+ if input.index(/[A-Za-z_]/, index) == index
0
+ r0 = (SyntaxNode).new(input, index...(index + 1))
0
+ @index += 1
0
+ else
0
+ r0 = nil
0
+ end
0
         
0
         node_cache[:alpha_char][start_index] = r0
0
         
0
@@ -2282,7 +2318,12 @@ module Treetop
0
         if r1.success?
0
           r0 = r1
0
         else
0
- r2 = parse_char_class(/[0-9]/, '0-9', SyntaxNode)
0
+ if input.index(/[0-9]/, index) == index
0
+ r2 = (SyntaxNode).new(input, index...(index + 1))
0
+ @index += 1
0
+ else
0
+ r2 = nil
0
+ end
0
           if r2.success?
0
             r0 = r2
0
           else
0
@@ -2306,7 +2347,12 @@ module Treetop
0
         
0
         s0, i0 = [], index
0
         loop do
0
- r1 = parse_char_class(/[ \t\n\r]/, ' \t\n\r', SyntaxNode)
0
+ if input.index(/[ \t\n\r]/, index) == index
0
+ r1 = (SyntaxNode).new(input, index...(index + 1))
0
+ @index += 1
0
+ else
0
+ r1 = nil
0
+ end
0
           if r1.success?
0
             s0 << r1
0
           else

Comments

    No one has commented yet.