treetop 1.6.3 → 1.6.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +2 -0
- data/lib/treetop/compiler/metagrammar.rb +150 -72
- data/lib/treetop/compiler/metagrammar.treetop +57 -3
- data/lib/treetop/compiler/node_classes/anything_symbol.rb +1 -1
- data/lib/treetop/compiler/node_classes/character_class.rb +1 -1
- data/lib/treetop/compiler/node_classes/choice.rb +5 -5
- data/lib/treetop/compiler/node_classes/nonterminal.rb +2 -2
- data/lib/treetop/compiler/node_classes/parsing_expression.rb +8 -2
- data/lib/treetop/compiler/node_classes/predicate.rb +1 -1
- data/lib/treetop/compiler/node_classes/repetition.rb +7 -7
- data/lib/treetop/compiler/node_classes/sequence.rb +1 -1
- data/lib/treetop/compiler/node_classes/terminal.rb +7 -1
- data/lib/treetop/runtime/syntax_node.rb +20 -13
- data/lib/treetop/version.rb +1 -1
- data/spec/compiler/choice_spec.rb +19 -10
- data/spec/compiler/grammar_compiler_spec.rb +1 -1
- data/spec/compiler/parenthesized_expression_spec.rb +12 -0
- data/spec/compiler/terminal_spec.rb +3 -3
- data/spec/compiler/tt_compiler_spec.rb +3 -3
- data/spec/compiler/zero_or_more_spec.rb +2 -0
- data/treetop.gemspec +3 -7
- metadata +2 -6
- data/examples/inner_outer.rb +0 -51
- data/examples/inner_outer.tt +0 -14
- data/examples/numerals.rb +0 -210
- data/examples/numerals.tt +0 -21
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 878553cd15b565fe0870a25ed59524505e0975ad
|
4
|
+
data.tar.gz: 675a16b030e58bca7d0e9be6b535fb589ae00112
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: baf09fe0f27df12b8281c9d6f6fd4c7b443013cc77ea8aa1de3f2c5ebc8d97f644fa3a56b1e2671be0d3427789188c368efb9f915c1887bcd9d2376e50dcea6e
|
7
|
+
data.tar.gz: 3eed17051de65ee68f0e73f009f7cd391acbffb515bfe07f4b3634b0cd79003a89dba40d4d18602dbc4fe265aca5c77aaac861db6ee788776259fefa9664a8fc
|
data/README.md
CHANGED
@@ -4,6 +4,8 @@ Support
|
|
4
4
|
Support for Treetop is provided through the mailing list you can join or browse here:
|
5
5
|
http://groups.google.com/group/treetop-dev
|
6
6
|
|
7
|
+
The gem is released from https://github.com/cjheath/treetop so you should check there as well.
|
8
|
+
|
7
9
|
Tutorial
|
8
10
|
========
|
9
11
|
Languages can be split into two components, their *syntax* and their *semantics*. It's your understanding of English syntax that tells you the stream of words "Sleep furiously green ideas colorless" is not a valid sentence. Semantics is deeper. Even if we rearrange the above sentence to be "Colorless green ideas sleep furiously", which is syntactically correct, it remains nonsensical on a semantic level. With Treetop, you'll be dealing with languages that are much simpler than English, but these basic concepts apply. Your programs will need to address both the syntax and the semantics of the languages they interpret.
|
@@ -148,7 +148,7 @@ module Treetop
|
|
148
148
|
r3 = instantiate_node(SyntaxNode,input, index...(index + match_len))
|
149
149
|
@index += match_len
|
150
150
|
else
|
151
|
-
terminal_parse_failure("require")
|
151
|
+
terminal_parse_failure('"require"')
|
152
152
|
r3 = nil
|
153
153
|
end
|
154
154
|
s0 << r3
|
@@ -324,7 +324,7 @@ module Treetop
|
|
324
324
|
r2 = instantiate_node(SyntaxNode,input, index...(index + match_len))
|
325
325
|
@index += match_len
|
326
326
|
else
|
327
|
-
terminal_parse_failure('module')
|
327
|
+
terminal_parse_failure('\'module\'')
|
328
328
|
r2 = nil
|
329
329
|
end
|
330
330
|
s1 << r2
|
@@ -361,7 +361,7 @@ module Treetop
|
|
361
361
|
r10 = instantiate_node(SyntaxNode,input, index...(index + match_len))
|
362
362
|
@index += match_len
|
363
363
|
else
|
364
|
-
terminal_parse_failure('
|
364
|
+
terminal_parse_failure('\'::\'')
|
365
365
|
r10 = nil
|
366
366
|
end
|
367
367
|
s9 << r10
|
@@ -453,7 +453,7 @@ module Treetop
|
|
453
453
|
r20 = instantiate_node(SyntaxNode,input, index...(index + match_len))
|
454
454
|
@index += match_len
|
455
455
|
else
|
456
|
-
terminal_parse_failure('end')
|
456
|
+
terminal_parse_failure('\'end\'')
|
457
457
|
r20 = nil
|
458
458
|
end
|
459
459
|
s18 << r20
|
@@ -523,7 +523,7 @@ module Treetop
|
|
523
523
|
r1 = instantiate_node(SyntaxNode,input, index...(index + match_len))
|
524
524
|
@index += match_len
|
525
525
|
else
|
526
|
-
terminal_parse_failure('grammar')
|
526
|
+
terminal_parse_failure('\'grammar\'')
|
527
527
|
r1 = nil
|
528
528
|
end
|
529
529
|
s0 << r1
|
@@ -542,7 +542,7 @@ module Treetop
|
|
542
542
|
r7 = instantiate_node(SyntaxNode,input, index...(index + match_len))
|
543
543
|
@index += match_len
|
544
544
|
else
|
545
|
-
terminal_parse_failure('do')
|
545
|
+
terminal_parse_failure('\'do\'')
|
546
546
|
r7 = nil
|
547
547
|
end
|
548
548
|
s6 << r7
|
@@ -579,7 +579,7 @@ module Treetop
|
|
579
579
|
r12 = instantiate_node(SyntaxNode,input, index...(index + match_len))
|
580
580
|
@index += match_len
|
581
581
|
else
|
582
|
-
terminal_parse_failure('end')
|
582
|
+
terminal_parse_failure('\'end\'')
|
583
583
|
r12 = nil
|
584
584
|
end
|
585
585
|
s0 << r12
|
@@ -745,7 +745,7 @@ module Treetop
|
|
745
745
|
r7.extend(DeclarationSequence3)
|
746
746
|
@index += match_len
|
747
747
|
else
|
748
|
-
terminal_parse_failure('')
|
748
|
+
terminal_parse_failure('\'\'')
|
749
749
|
r7 = nil
|
750
750
|
end
|
751
751
|
if r7
|
@@ -823,7 +823,7 @@ module Treetop
|
|
823
823
|
r1 = instantiate_node(SyntaxNode,input, index...(index + match_len))
|
824
824
|
@index += match_len
|
825
825
|
else
|
826
|
-
terminal_parse_failure('include')
|
826
|
+
terminal_parse_failure('\'include\'')
|
827
827
|
r1 = nil
|
828
828
|
end
|
829
829
|
s0 << r1
|
@@ -852,7 +852,7 @@ module Treetop
|
|
852
852
|
r7 = instantiate_node(SyntaxNode,input, index...(index + match_len))
|
853
853
|
@index += match_len
|
854
854
|
else
|
855
|
-
terminal_parse_failure('
|
855
|
+
terminal_parse_failure('\'::\'')
|
856
856
|
r7 = nil
|
857
857
|
end
|
858
858
|
if r7
|
@@ -933,7 +933,7 @@ module Treetop
|
|
933
933
|
r1 = instantiate_node(SyntaxNode,input, index...(index + match_len))
|
934
934
|
@index += match_len
|
935
935
|
else
|
936
|
-
terminal_parse_failure('rule')
|
936
|
+
terminal_parse_failure('\'rule\'')
|
937
937
|
r1 = nil
|
938
938
|
end
|
939
939
|
s0 << r1
|
@@ -952,7 +952,7 @@ module Treetop
|
|
952
952
|
r7 = instantiate_node(SyntaxNode,input, index...(index + match_len))
|
953
953
|
@index += match_len
|
954
954
|
else
|
955
|
-
terminal_parse_failure('do')
|
955
|
+
terminal_parse_failure('\'do\'')
|
956
956
|
r7 = nil
|
957
957
|
end
|
958
958
|
s6 << r7
|
@@ -984,7 +984,7 @@ module Treetop
|
|
984
984
|
r11 = instantiate_node(SyntaxNode,input, index...(index + match_len))
|
985
985
|
@index += match_len
|
986
986
|
else
|
987
|
-
terminal_parse_failure('end')
|
987
|
+
terminal_parse_failure('\'end\'')
|
988
988
|
r11 = nil
|
989
989
|
end
|
990
990
|
s0 << r11
|
@@ -1071,6 +1071,10 @@ module Treetop
|
|
1071
1071
|
super.elements.map {|elt| elt.alternative}
|
1072
1072
|
end
|
1073
1073
|
|
1074
|
+
def parent_modules
|
1075
|
+
[]
|
1076
|
+
end
|
1077
|
+
|
1074
1078
|
def inline_modules
|
1075
1079
|
(alternatives.map {|alt| alt.inline_modules }).flatten
|
1076
1080
|
end
|
@@ -1106,7 +1110,7 @@ module Treetop
|
|
1106
1110
|
r6 = true
|
1107
1111
|
@index += match_len
|
1108
1112
|
else
|
1109
|
-
terminal_parse_failure('
|
1113
|
+
terminal_parse_failure('\'/\'')
|
1110
1114
|
r6 = nil
|
1111
1115
|
end
|
1112
1116
|
s3 << r6
|
@@ -1178,10 +1182,14 @@ module Treetop
|
|
1178
1182
|
sequence_body.tail
|
1179
1183
|
end
|
1180
1184
|
|
1185
|
+
def parent_modules
|
1186
|
+
node_class_declarations.inline_modules
|
1187
|
+
end
|
1188
|
+
|
1181
1189
|
def inline_modules
|
1182
1190
|
(sequence_elements.map {|elt| elt.inline_modules}).flatten +
|
1183
1191
|
[sequence_element_accessor_module] +
|
1184
|
-
|
1192
|
+
parent_modules
|
1185
1193
|
end
|
1186
1194
|
|
1187
1195
|
def inline_module_name
|
@@ -1418,6 +1426,10 @@ module Treetop
|
|
1418
1426
|
atomic
|
1419
1427
|
end
|
1420
1428
|
|
1429
|
+
def parent_modules
|
1430
|
+
[]
|
1431
|
+
end
|
1432
|
+
|
1421
1433
|
def inline_modules
|
1422
1434
|
atomic.inline_modules
|
1423
1435
|
end
|
@@ -1444,6 +1456,9 @@ module Treetop
|
|
1444
1456
|
def prefixed_expression
|
1445
1457
|
atomic
|
1446
1458
|
end
|
1459
|
+
def parent_modules
|
1460
|
+
[]
|
1461
|
+
end
|
1447
1462
|
def inline_modules
|
1448
1463
|
[]
|
1449
1464
|
end
|
@@ -1465,6 +1480,7 @@ module Treetop
|
|
1465
1480
|
|
1466
1481
|
module Primary5
|
1467
1482
|
def compile(address, builder, parent_expression=nil)
|
1483
|
+
STDERR.puts "Extraneous module ignored after suffix: #{input[interval].inspect}" if node_class_declarations.inline_modules.size > 0 && atomic.inline_modules.size > 0
|
1468
1484
|
suffix.compile(address, builder, self)
|
1469
1485
|
end
|
1470
1486
|
|
@@ -1476,8 +1492,12 @@ module Treetop
|
|
1476
1492
|
node_class_declarations.node_class_name
|
1477
1493
|
end
|
1478
1494
|
|
1495
|
+
def parent_modules
|
1496
|
+
node_class_declarations.inline_modules
|
1497
|
+
end
|
1498
|
+
|
1479
1499
|
def inline_modules
|
1480
|
-
atomic.inline_modules +
|
1500
|
+
atomic.inline_modules + parent_modules
|
1481
1501
|
end
|
1482
1502
|
|
1483
1503
|
def inline_module_name
|
@@ -1497,6 +1517,7 @@ module Treetop
|
|
1497
1517
|
|
1498
1518
|
module Primary7
|
1499
1519
|
def compile(address, builder, parent_expression=nil)
|
1520
|
+
STDERR.puts "Extraneous module ignored with nested atomic: #{input[interval].inspect}" if node_class_declarations.inline_modules.size > 0 && atomic.inline_modules.size > 0
|
1500
1521
|
atomic.compile(address, builder, self)
|
1501
1522
|
end
|
1502
1523
|
|
@@ -1504,8 +1525,12 @@ module Treetop
|
|
1504
1525
|
node_class_declarations.node_class_name
|
1505
1526
|
end
|
1506
1527
|
|
1528
|
+
def parent_modules
|
1529
|
+
node_class_declarations.inline_modules
|
1530
|
+
end
|
1531
|
+
|
1507
1532
|
def inline_modules
|
1508
|
-
atomic.inline_modules +
|
1533
|
+
atomic.inline_modules + parent_modules
|
1509
1534
|
end
|
1510
1535
|
|
1511
1536
|
def inline_module_name
|
@@ -1673,6 +1698,10 @@ module Treetop
|
|
1673
1698
|
sequence_primary.compile(lexical_address, builder)
|
1674
1699
|
end
|
1675
1700
|
|
1701
|
+
def parent_modules
|
1702
|
+
[]
|
1703
|
+
end
|
1704
|
+
|
1676
1705
|
def inline_modules
|
1677
1706
|
sequence_primary.inline_modules
|
1678
1707
|
end
|
@@ -1729,6 +1758,10 @@ module Treetop
|
|
1729
1758
|
sequence_primary.compile(lexical_address, builder)
|
1730
1759
|
end
|
1731
1760
|
|
1761
|
+
def parent_modules
|
1762
|
+
[]
|
1763
|
+
end
|
1764
|
+
|
1732
1765
|
def inline_modules
|
1733
1766
|
sequence_primary.inline_modules
|
1734
1767
|
end
|
@@ -1863,7 +1896,7 @@ module Treetop
|
|
1863
1896
|
r5 = true
|
1864
1897
|
@index += match_len
|
1865
1898
|
else
|
1866
|
-
terminal_parse_failure('
|
1899
|
+
terminal_parse_failure('\':\'')
|
1867
1900
|
r5 = nil
|
1868
1901
|
end
|
1869
1902
|
s0 << r5
|
@@ -1904,7 +1937,7 @@ module Treetop
|
|
1904
1937
|
r0.extend(NullLabel0)
|
1905
1938
|
@index += match_len
|
1906
1939
|
else
|
1907
|
-
terminal_parse_failure('')
|
1940
|
+
terminal_parse_failure('\'\'')
|
1908
1941
|
r0 = nil
|
1909
1942
|
end
|
1910
1943
|
|
@@ -1932,6 +1965,10 @@ module Treetop
|
|
1932
1965
|
elements[1]
|
1933
1966
|
end
|
1934
1967
|
|
1968
|
+
def parent_modules
|
1969
|
+
[]
|
1970
|
+
end
|
1971
|
+
|
1935
1972
|
def inline_modules
|
1936
1973
|
atomic.inline_modules
|
1937
1974
|
end
|
@@ -1958,6 +1995,9 @@ module Treetop
|
|
1958
1995
|
def prefixed_expression
|
1959
1996
|
atomic
|
1960
1997
|
end
|
1998
|
+
def parent_modules
|
1999
|
+
[]
|
2000
|
+
end
|
1961
2001
|
def inline_modules
|
1962
2002
|
[]
|
1963
2003
|
end
|
@@ -1982,6 +2022,10 @@ module Treetop
|
|
1982
2022
|
nil
|
1983
2023
|
end
|
1984
2024
|
|
2025
|
+
def parent_modules
|
2026
|
+
[]
|
2027
|
+
end
|
2028
|
+
|
1985
2029
|
def inline_modules
|
1986
2030
|
atomic.inline_modules
|
1987
2031
|
end
|
@@ -2133,7 +2177,7 @@ module Treetop
|
|
2133
2177
|
r0 = instantiate_node(Optional,input, index...(index + match_len))
|
2134
2178
|
@index += match_len
|
2135
2179
|
else
|
2136
|
-
terminal_parse_failure('
|
2180
|
+
terminal_parse_failure('\'?\'')
|
2137
2181
|
r0 = nil
|
2138
2182
|
end
|
2139
2183
|
|
@@ -2157,6 +2201,7 @@ module Treetop
|
|
2157
2201
|
node_class_expression.node_class_name
|
2158
2202
|
end
|
2159
2203
|
|
2204
|
+
# !!!! cjh !!!!!
|
2160
2205
|
def inline_modules
|
2161
2206
|
trailing_inline_module.inline_modules
|
2162
2207
|
end
|
@@ -2218,7 +2263,7 @@ module Treetop
|
|
2218
2263
|
r1 = instantiate_node(OneOrMore,input, index...(index + match_len))
|
2219
2264
|
@index += match_len
|
2220
2265
|
else
|
2221
|
-
terminal_parse_failure('
|
2266
|
+
terminal_parse_failure('\'+\'')
|
2222
2267
|
r1 = nil
|
2223
2268
|
end
|
2224
2269
|
if r1
|
@@ -2229,7 +2274,7 @@ module Treetop
|
|
2229
2274
|
r2 = instantiate_node(ZeroOrMore,input, index...(index + match_len))
|
2230
2275
|
@index += match_len
|
2231
2276
|
else
|
2232
|
-
terminal_parse_failure('
|
2277
|
+
terminal_parse_failure('\'*\'')
|
2233
2278
|
r2 = nil
|
2234
2279
|
end
|
2235
2280
|
if r2
|
@@ -2304,7 +2349,7 @@ module Treetop
|
|
2304
2349
|
r5 = instantiate_node(SyntaxNode,input, index...(index + match_len))
|
2305
2350
|
@index += match_len
|
2306
2351
|
else
|
2307
|
-
terminal_parse_failure('
|
2352
|
+
terminal_parse_failure('\'..\'')
|
2308
2353
|
r5 = nil
|
2309
2354
|
end
|
2310
2355
|
s0 << r5
|
@@ -2358,7 +2403,7 @@ module Treetop
|
|
2358
2403
|
r1 = instantiate_node(AndPredicate,input, index...(index + match_len))
|
2359
2404
|
@index += match_len
|
2360
2405
|
else
|
2361
|
-
terminal_parse_failure('
|
2406
|
+
terminal_parse_failure('\'&\'')
|
2362
2407
|
r1 = nil
|
2363
2408
|
end
|
2364
2409
|
if r1
|
@@ -2369,7 +2414,7 @@ module Treetop
|
|
2369
2414
|
r2 = instantiate_node(NotPredicate,input, index...(index + match_len))
|
2370
2415
|
@index += match_len
|
2371
2416
|
else
|
2372
|
-
terminal_parse_failure('
|
2417
|
+
terminal_parse_failure('\'!\'')
|
2373
2418
|
r2 = nil
|
2374
2419
|
end
|
2375
2420
|
if r2
|
@@ -2380,7 +2425,7 @@ module Treetop
|
|
2380
2425
|
r3 = instantiate_node(TransientPrefix,input, index...(index + match_len))
|
2381
2426
|
@index += match_len
|
2382
2427
|
else
|
2383
|
-
terminal_parse_failure('
|
2428
|
+
terminal_parse_failure('\'~\'')
|
2384
2429
|
r3 = nil
|
2385
2430
|
end
|
2386
2431
|
if r3
|
@@ -2444,6 +2489,9 @@ module Treetop
|
|
2444
2489
|
end
|
2445
2490
|
|
2446
2491
|
module ParenthesizedExpression1
|
2492
|
+
def parent_modules
|
2493
|
+
[]
|
2494
|
+
end
|
2447
2495
|
def inline_modules
|
2448
2496
|
parsing_expression.inline_modules
|
2449
2497
|
end
|
@@ -2465,7 +2513,7 @@ module Treetop
|
|
2465
2513
|
r1 = true
|
2466
2514
|
@index += match_len
|
2467
2515
|
else
|
2468
|
-
terminal_parse_failure('(')
|
2516
|
+
terminal_parse_failure('\'(\'')
|
2469
2517
|
r1 = nil
|
2470
2518
|
end
|
2471
2519
|
s0 << r1
|
@@ -2493,7 +2541,7 @@ module Treetop
|
|
2493
2541
|
r7 = true
|
2494
2542
|
@index += match_len
|
2495
2543
|
else
|
2496
|
-
terminal_parse_failure(')')
|
2544
|
+
terminal_parse_failure('\')\'')
|
2497
2545
|
r7 = nil
|
2498
2546
|
end
|
2499
2547
|
s0 << r7
|
@@ -2540,6 +2588,7 @@ module Treetop
|
|
2540
2588
|
i1 = index
|
2541
2589
|
r2 = _nt_keyword_inside_grammar
|
2542
2590
|
if r2
|
2591
|
+
@index = i1
|
2543
2592
|
r1 = nil
|
2544
2593
|
else
|
2545
2594
|
@index = i1
|
@@ -2726,7 +2775,7 @@ module Treetop
|
|
2726
2775
|
r1 = true
|
2727
2776
|
@index += match_len
|
2728
2777
|
else
|
2729
|
-
terminal_parse_failure('"')
|
2778
|
+
terminal_parse_failure('\'"\'')
|
2730
2779
|
r1 = nil
|
2731
2780
|
end
|
2732
2781
|
s0 << r1
|
@@ -2739,12 +2788,15 @@ module Treetop
|
|
2739
2788
|
r5 = true
|
2740
2789
|
@index += match_len
|
2741
2790
|
else
|
2742
|
-
terminal_parse_failure('"')
|
2791
|
+
terminal_parse_failure('\'"\'')
|
2743
2792
|
r5 = nil
|
2744
2793
|
end
|
2745
2794
|
if r5
|
2795
|
+
@index = i4
|
2746
2796
|
r4 = nil
|
2797
|
+
terminal_parse_failure('\'"\'', true)
|
2747
2798
|
else
|
2799
|
+
@terminal_failures.pop
|
2748
2800
|
@index = i4
|
2749
2801
|
r4 = instantiate_node(SyntaxNode,input, index...index)
|
2750
2802
|
end
|
@@ -2755,7 +2807,7 @@ module Treetop
|
|
2755
2807
|
r7 = instantiate_node(SyntaxNode,input, index...(index + match_len))
|
2756
2808
|
@index += match_len
|
2757
2809
|
else
|
2758
|
-
terminal_parse_failure("
|
2810
|
+
terminal_parse_failure('"\\\\\\\\"')
|
2759
2811
|
r7 = nil
|
2760
2812
|
end
|
2761
2813
|
if r7
|
@@ -2766,7 +2818,7 @@ module Treetop
|
|
2766
2818
|
r8 = instantiate_node(SyntaxNode,input, index...(index + match_len))
|
2767
2819
|
@index += match_len
|
2768
2820
|
else
|
2769
|
-
terminal_parse_failure('\"')
|
2821
|
+
terminal_parse_failure('\'\\"\'')
|
2770
2822
|
r8 = nil
|
2771
2823
|
end
|
2772
2824
|
if r8
|
@@ -2811,7 +2863,7 @@ module Treetop
|
|
2811
2863
|
r10 = true
|
2812
2864
|
@index += match_len
|
2813
2865
|
else
|
2814
|
-
terminal_parse_failure('"')
|
2866
|
+
terminal_parse_failure('\'"\'')
|
2815
2867
|
r10 = nil
|
2816
2868
|
end
|
2817
2869
|
s0 << r10
|
@@ -2856,7 +2908,7 @@ module Treetop
|
|
2856
2908
|
r1 = true
|
2857
2909
|
@index += match_len
|
2858
2910
|
else
|
2859
|
-
terminal_parse_failure("'")
|
2911
|
+
terminal_parse_failure('"\'"')
|
2860
2912
|
r1 = nil
|
2861
2913
|
end
|
2862
2914
|
s0 << r1
|
@@ -2869,12 +2921,15 @@ module Treetop
|
|
2869
2921
|
r5 = true
|
2870
2922
|
@index += match_len
|
2871
2923
|
else
|
2872
|
-
terminal_parse_failure("'")
|
2924
|
+
terminal_parse_failure('"\'"')
|
2873
2925
|
r5 = nil
|
2874
2926
|
end
|
2875
2927
|
if r5
|
2928
|
+
@index = i4
|
2876
2929
|
r4 = nil
|
2930
|
+
terminal_parse_failure('"\'"', true)
|
2877
2931
|
else
|
2932
|
+
@terminal_failures.pop
|
2878
2933
|
@index = i4
|
2879
2934
|
r4 = instantiate_node(SyntaxNode,input, index...index)
|
2880
2935
|
end
|
@@ -2885,7 +2940,7 @@ module Treetop
|
|
2885
2940
|
r7 = instantiate_node(SyntaxNode,input, index...(index + match_len))
|
2886
2941
|
@index += match_len
|
2887
2942
|
else
|
2888
|
-
terminal_parse_failure("
|
2943
|
+
terminal_parse_failure('"\\\\\\\\"')
|
2889
2944
|
r7 = nil
|
2890
2945
|
end
|
2891
2946
|
if r7
|
@@ -2896,7 +2951,7 @@ module Treetop
|
|
2896
2951
|
r8 = instantiate_node(SyntaxNode,input, index...(index + match_len))
|
2897
2952
|
@index += match_len
|
2898
2953
|
else
|
2899
|
-
terminal_parse_failure("
|
2954
|
+
terminal_parse_failure('"\\\\\'"')
|
2900
2955
|
r8 = nil
|
2901
2956
|
end
|
2902
2957
|
if r8
|
@@ -2941,7 +2996,7 @@ module Treetop
|
|
2941
2996
|
r10 = true
|
2942
2997
|
@index += match_len
|
2943
2998
|
else
|
2944
|
-
terminal_parse_failure("'")
|
2999
|
+
terminal_parse_failure('"\'"')
|
2945
3000
|
r10 = nil
|
2946
3001
|
end
|
2947
3002
|
s0 << r10
|
@@ -2998,7 +3053,7 @@ module Treetop
|
|
2998
3053
|
r1 = true
|
2999
3054
|
@index += match_len
|
3000
3055
|
else
|
3001
|
-
terminal_parse_failure('[')
|
3056
|
+
terminal_parse_failure('\'[\'')
|
3002
3057
|
r1 = nil
|
3003
3058
|
end
|
3004
3059
|
s0 << r1
|
@@ -3011,12 +3066,15 @@ module Treetop
|
|
3011
3066
|
r5 = true
|
3012
3067
|
@index += match_len
|
3013
3068
|
else
|
3014
|
-
terminal_parse_failure(']')
|
3069
|
+
terminal_parse_failure('\']\'')
|
3015
3070
|
r5 = nil
|
3016
3071
|
end
|
3017
3072
|
if r5
|
3073
|
+
@index = i4
|
3018
3074
|
r4 = nil
|
3075
|
+
terminal_parse_failure('\']\'', true)
|
3019
3076
|
else
|
3077
|
+
@terminal_failures.pop
|
3020
3078
|
@index = i4
|
3021
3079
|
r4 = instantiate_node(SyntaxNode,input, index...index)
|
3022
3080
|
end
|
@@ -3028,7 +3086,7 @@ module Treetop
|
|
3028
3086
|
r8 = true
|
3029
3087
|
@index += match_len
|
3030
3088
|
else
|
3031
|
-
terminal_parse_failure('
|
3089
|
+
terminal_parse_failure('\'\\\\\'')
|
3032
3090
|
r8 = nil
|
3033
3091
|
end
|
3034
3092
|
s7 << r8
|
@@ -3064,12 +3122,15 @@ module Treetop
|
|
3064
3122
|
r13 = true
|
3065
3123
|
@index += match_len
|
3066
3124
|
else
|
3067
|
-
terminal_parse_failure('
|
3125
|
+
terminal_parse_failure('\'\\\\\'')
|
3068
3126
|
r13 = nil
|
3069
3127
|
end
|
3070
3128
|
if r13
|
3129
|
+
@index = i12
|
3071
3130
|
r12 = nil
|
3131
|
+
terminal_parse_failure('\'\\\\\'', true)
|
3072
3132
|
else
|
3133
|
+
@terminal_failures.pop
|
3073
3134
|
@index = i12
|
3074
3135
|
r12 = instantiate_node(SyntaxNode,input, index...index)
|
3075
3136
|
end
|
@@ -3127,7 +3188,7 @@ module Treetop
|
|
3127
3188
|
r15 = true
|
3128
3189
|
@index += match_len
|
3129
3190
|
else
|
3130
|
-
terminal_parse_failure(']')
|
3191
|
+
terminal_parse_failure('\']\'')
|
3131
3192
|
r15 = nil
|
3132
3193
|
end
|
3133
3194
|
s0 << r15
|
@@ -3166,7 +3227,7 @@ module Treetop
|
|
3166
3227
|
r1 = instantiate_node(SyntaxNode,input, index...(index + match_len))
|
3167
3228
|
@index += match_len
|
3168
3229
|
else
|
3169
|
-
terminal_parse_failure('[
|
3230
|
+
terminal_parse_failure('\'[:\'')
|
3170
3231
|
r1 = nil
|
3171
3232
|
end
|
3172
3233
|
s0 << r1
|
@@ -3175,7 +3236,7 @@ module Treetop
|
|
3175
3236
|
r3 = true
|
3176
3237
|
@index += match_len
|
3177
3238
|
else
|
3178
|
-
terminal_parse_failure('
|
3239
|
+
terminal_parse_failure('\'^\'')
|
3179
3240
|
r3 = nil
|
3180
3241
|
end
|
3181
3242
|
if r3
|
@@ -3190,7 +3251,7 @@ module Treetop
|
|
3190
3251
|
r5 = instantiate_node(SyntaxNode,input, index...(index + match_len))
|
3191
3252
|
@index += match_len
|
3192
3253
|
else
|
3193
|
-
terminal_parse_failure('alnum')
|
3254
|
+
terminal_parse_failure('\'alnum\'')
|
3194
3255
|
r5 = nil
|
3195
3256
|
end
|
3196
3257
|
if r5
|
@@ -3201,7 +3262,7 @@ module Treetop
|
|
3201
3262
|
r6 = instantiate_node(SyntaxNode,input, index...(index + match_len))
|
3202
3263
|
@index += match_len
|
3203
3264
|
else
|
3204
|
-
terminal_parse_failure('alpha')
|
3265
|
+
terminal_parse_failure('\'alpha\'')
|
3205
3266
|
r6 = nil
|
3206
3267
|
end
|
3207
3268
|
if r6
|
@@ -3212,7 +3273,7 @@ module Treetop
|
|
3212
3273
|
r7 = instantiate_node(SyntaxNode,input, index...(index + match_len))
|
3213
3274
|
@index += match_len
|
3214
3275
|
else
|
3215
|
-
terminal_parse_failure('blank')
|
3276
|
+
terminal_parse_failure('\'blank\'')
|
3216
3277
|
r7 = nil
|
3217
3278
|
end
|
3218
3279
|
if r7
|
@@ -3223,7 +3284,7 @@ module Treetop
|
|
3223
3284
|
r8 = instantiate_node(SyntaxNode,input, index...(index + match_len))
|
3224
3285
|
@index += match_len
|
3225
3286
|
else
|
3226
|
-
terminal_parse_failure('cntrl')
|
3287
|
+
terminal_parse_failure('\'cntrl\'')
|
3227
3288
|
r8 = nil
|
3228
3289
|
end
|
3229
3290
|
if r8
|
@@ -3234,7 +3295,7 @@ module Treetop
|
|
3234
3295
|
r9 = instantiate_node(SyntaxNode,input, index...(index + match_len))
|
3235
3296
|
@index += match_len
|
3236
3297
|
else
|
3237
|
-
terminal_parse_failure('digit')
|
3298
|
+
terminal_parse_failure('\'digit\'')
|
3238
3299
|
r9 = nil
|
3239
3300
|
end
|
3240
3301
|
if r9
|
@@ -3245,7 +3306,7 @@ module Treetop
|
|
3245
3306
|
r10 = instantiate_node(SyntaxNode,input, index...(index + match_len))
|
3246
3307
|
@index += match_len
|
3247
3308
|
else
|
3248
|
-
terminal_parse_failure('graph')
|
3309
|
+
terminal_parse_failure('\'graph\'')
|
3249
3310
|
r10 = nil
|
3250
3311
|
end
|
3251
3312
|
if r10
|
@@ -3256,7 +3317,7 @@ module Treetop
|
|
3256
3317
|
r11 = instantiate_node(SyntaxNode,input, index...(index + match_len))
|
3257
3318
|
@index += match_len
|
3258
3319
|
else
|
3259
|
-
terminal_parse_failure('lower')
|
3320
|
+
terminal_parse_failure('\'lower\'')
|
3260
3321
|
r11 = nil
|
3261
3322
|
end
|
3262
3323
|
if r11
|
@@ -3267,7 +3328,7 @@ module Treetop
|
|
3267
3328
|
r12 = instantiate_node(SyntaxNode,input, index...(index + match_len))
|
3268
3329
|
@index += match_len
|
3269
3330
|
else
|
3270
|
-
terminal_parse_failure('print')
|
3331
|
+
terminal_parse_failure('\'print\'')
|
3271
3332
|
r12 = nil
|
3272
3333
|
end
|
3273
3334
|
if r12
|
@@ -3278,7 +3339,7 @@ module Treetop
|
|
3278
3339
|
r13 = instantiate_node(SyntaxNode,input, index...(index + match_len))
|
3279
3340
|
@index += match_len
|
3280
3341
|
else
|
3281
|
-
terminal_parse_failure('punct')
|
3342
|
+
terminal_parse_failure('\'punct\'')
|
3282
3343
|
r13 = nil
|
3283
3344
|
end
|
3284
3345
|
if r13
|
@@ -3289,7 +3350,7 @@ module Treetop
|
|
3289
3350
|
r14 = instantiate_node(SyntaxNode,input, index...(index + match_len))
|
3290
3351
|
@index += match_len
|
3291
3352
|
else
|
3292
|
-
terminal_parse_failure('space')
|
3353
|
+
terminal_parse_failure('\'space\'')
|
3293
3354
|
r14 = nil
|
3294
3355
|
end
|
3295
3356
|
if r14
|
@@ -3300,7 +3361,7 @@ module Treetop
|
|
3300
3361
|
r15 = instantiate_node(SyntaxNode,input, index...(index + match_len))
|
3301
3362
|
@index += match_len
|
3302
3363
|
else
|
3303
|
-
terminal_parse_failure('upper')
|
3364
|
+
terminal_parse_failure('\'upper\'')
|
3304
3365
|
r15 = nil
|
3305
3366
|
end
|
3306
3367
|
if r15
|
@@ -3311,7 +3372,7 @@ module Treetop
|
|
3311
3372
|
r16 = instantiate_node(SyntaxNode,input, index...(index + match_len))
|
3312
3373
|
@index += match_len
|
3313
3374
|
else
|
3314
|
-
terminal_parse_failure('xdigit')
|
3375
|
+
terminal_parse_failure('\'xdigit\'')
|
3315
3376
|
r16 = nil
|
3316
3377
|
end
|
3317
3378
|
if r16
|
@@ -3322,7 +3383,7 @@ module Treetop
|
|
3322
3383
|
r17 = instantiate_node(SyntaxNode,input, index...(index + match_len))
|
3323
3384
|
@index += match_len
|
3324
3385
|
else
|
3325
|
-
terminal_parse_failure('word')
|
3386
|
+
terminal_parse_failure('\'word\'')
|
3326
3387
|
r17 = nil
|
3327
3388
|
end
|
3328
3389
|
if r17
|
@@ -3350,7 +3411,7 @@ module Treetop
|
|
3350
3411
|
r18 = instantiate_node(SyntaxNode,input, index...(index + match_len))
|
3351
3412
|
@index += match_len
|
3352
3413
|
else
|
3353
|
-
terminal_parse_failure(':]')
|
3414
|
+
terminal_parse_failure('\':]\'')
|
3354
3415
|
r18 = nil
|
3355
3416
|
end
|
3356
3417
|
s0 << r18
|
@@ -3385,7 +3446,7 @@ module Treetop
|
|
3385
3446
|
r0 = instantiate_node(AnythingSymbol,input, index...(index + match_len))
|
3386
3447
|
@index += match_len
|
3387
3448
|
else
|
3388
|
-
terminal_parse_failure('
|
3449
|
+
terminal_parse_failure('\'.\'')
|
3389
3450
|
r0 = nil
|
3390
3451
|
end
|
3391
3452
|
|
@@ -3436,7 +3497,7 @@ module Treetop
|
|
3436
3497
|
r3 = true
|
3437
3498
|
@index += match_len
|
3438
3499
|
else
|
3439
|
-
terminal_parse_failure('
|
3500
|
+
terminal_parse_failure('\'<\'')
|
3440
3501
|
r3 = nil
|
3441
3502
|
end
|
3442
3503
|
s1 << r3
|
@@ -3449,12 +3510,15 @@ module Treetop
|
|
3449
3510
|
r7 = true
|
3450
3511
|
@index += match_len
|
3451
3512
|
else
|
3452
|
-
terminal_parse_failure('
|
3513
|
+
terminal_parse_failure('\'>\'')
|
3453
3514
|
r7 = nil
|
3454
3515
|
end
|
3455
3516
|
if r7
|
3517
|
+
@index = i6
|
3456
3518
|
r6 = nil
|
3519
|
+
terminal_parse_failure('\'>\'', true)
|
3457
3520
|
else
|
3521
|
+
@terminal_failures.pop
|
3458
3522
|
@index = i6
|
3459
3523
|
r6 = instantiate_node(SyntaxNode,input, index...index)
|
3460
3524
|
end
|
@@ -3494,7 +3558,7 @@ module Treetop
|
|
3494
3558
|
r9 = true
|
3495
3559
|
@index += match_len
|
3496
3560
|
else
|
3497
|
-
terminal_parse_failure('
|
3561
|
+
terminal_parse_failure('\'>\'')
|
3498
3562
|
r9 = nil
|
3499
3563
|
end
|
3500
3564
|
s1 << r9
|
@@ -3518,7 +3582,7 @@ module Treetop
|
|
3518
3582
|
r10.extend(NodeClassExpression3)
|
3519
3583
|
@index += match_len
|
3520
3584
|
else
|
3521
|
-
terminal_parse_failure('')
|
3585
|
+
terminal_parse_failure('\'\'')
|
3522
3586
|
r10 = nil
|
3523
3587
|
end
|
3524
3588
|
if r10
|
@@ -3546,6 +3610,9 @@ module Treetop
|
|
3546
3610
|
end
|
3547
3611
|
|
3548
3612
|
module TrailingInlineModule1
|
3613
|
+
def parent_modules
|
3614
|
+
[]
|
3615
|
+
end
|
3549
3616
|
def inline_modules
|
3550
3617
|
[inline_module]
|
3551
3618
|
end
|
@@ -3556,6 +3623,9 @@ module Treetop
|
|
3556
3623
|
end
|
3557
3624
|
|
3558
3625
|
module TrailingInlineModule2
|
3626
|
+
def parent_modules
|
3627
|
+
[]
|
3628
|
+
end
|
3559
3629
|
def inline_modules
|
3560
3630
|
[]
|
3561
3631
|
end
|
@@ -3605,7 +3675,7 @@ module Treetop
|
|
3605
3675
|
r4.extend(TrailingInlineModule2)
|
3606
3676
|
@index += match_len
|
3607
3677
|
else
|
3608
|
-
terminal_parse_failure('')
|
3678
|
+
terminal_parse_failure('\'\'')
|
3609
3679
|
r4 = nil
|
3610
3680
|
end
|
3611
3681
|
if r4
|
@@ -3644,7 +3714,7 @@ module Treetop
|
|
3644
3714
|
r1 = true
|
3645
3715
|
@index += match_len
|
3646
3716
|
else
|
3647
|
-
terminal_parse_failure('')
|
3717
|
+
terminal_parse_failure('\'\'')
|
3648
3718
|
r1 = nil
|
3649
3719
|
end
|
3650
3720
|
s0 << r1
|
@@ -3687,7 +3757,7 @@ module Treetop
|
|
3687
3757
|
r1 = true
|
3688
3758
|
@index += match_len
|
3689
3759
|
else
|
3690
|
-
terminal_parse_failure('{')
|
3760
|
+
terminal_parse_failure('\'{\'')
|
3691
3761
|
r1 = nil
|
3692
3762
|
end
|
3693
3763
|
s0 << r1
|
@@ -3710,8 +3780,11 @@ module Treetop
|
|
3710
3780
|
r7 = nil
|
3711
3781
|
end
|
3712
3782
|
if r7
|
3783
|
+
@index = i6
|
3713
3784
|
r6 = nil
|
3785
|
+
terminal_parse_failure('[{}]', true)
|
3714
3786
|
else
|
3787
|
+
@terminal_failures.pop
|
3715
3788
|
@index = i6
|
3716
3789
|
r6 = instantiate_node(SyntaxNode,input, index...index)
|
3717
3790
|
end
|
@@ -3754,7 +3827,7 @@ module Treetop
|
|
3754
3827
|
r9 = true
|
3755
3828
|
@index += match_len
|
3756
3829
|
else
|
3757
|
-
terminal_parse_failure('}')
|
3830
|
+
terminal_parse_failure('\'}\'')
|
3758
3831
|
r9 = nil
|
3759
3832
|
end
|
3760
3833
|
s0 << r9
|
@@ -3793,7 +3866,7 @@ module Treetop
|
|
3793
3866
|
r2 = instantiate_node(SyntaxNode,input, index...(index + match_len))
|
3794
3867
|
@index += match_len
|
3795
3868
|
else
|
3796
|
-
terminal_parse_failure('rule')
|
3869
|
+
terminal_parse_failure('\'rule\'')
|
3797
3870
|
r2 = nil
|
3798
3871
|
end
|
3799
3872
|
if r2
|
@@ -3804,7 +3877,7 @@ module Treetop
|
|
3804
3877
|
r3 = instantiate_node(SyntaxNode,input, index...(index + match_len))
|
3805
3878
|
@index += match_len
|
3806
3879
|
else
|
3807
|
-
terminal_parse_failure('end')
|
3880
|
+
terminal_parse_failure('\'end\'')
|
3808
3881
|
r3 = nil
|
3809
3882
|
end
|
3810
3883
|
if r3
|
@@ -3820,6 +3893,7 @@ module Treetop
|
|
3820
3893
|
i4 = index
|
3821
3894
|
r5 = _nt_non_space_char
|
3822
3895
|
if r5
|
3896
|
+
@index = i4
|
3823
3897
|
r4 = nil
|
3824
3898
|
else
|
3825
3899
|
@index = i4
|
@@ -3858,6 +3932,7 @@ module Treetop
|
|
3858
3932
|
i1 = index
|
3859
3933
|
r2 = _nt_space
|
3860
3934
|
if r2
|
3935
|
+
@index = i1
|
3861
3936
|
r1 = nil
|
3862
3937
|
else
|
3863
3938
|
@index = i1
|
@@ -4017,7 +4092,7 @@ module Treetop
|
|
4017
4092
|
r1 = true
|
4018
4093
|
@index += match_len
|
4019
4094
|
else
|
4020
|
-
terminal_parse_failure('
|
4095
|
+
terminal_parse_failure('\'#\'')
|
4021
4096
|
r1 = nil
|
4022
4097
|
end
|
4023
4098
|
s0 << r1
|
@@ -4030,12 +4105,15 @@ module Treetop
|
|
4030
4105
|
r5 = true
|
4031
4106
|
@index += match_len
|
4032
4107
|
else
|
4033
|
-
terminal_parse_failure("
|
4108
|
+
terminal_parse_failure('"\\n"')
|
4034
4109
|
r5 = nil
|
4035
4110
|
end
|
4036
4111
|
if r5
|
4112
|
+
@index = i4
|
4037
4113
|
r4 = nil
|
4114
|
+
terminal_parse_failure('"\\n"', true)
|
4038
4115
|
else
|
4116
|
+
@terminal_failures.pop
|
4039
4117
|
@index = i4
|
4040
4118
|
r4 = instantiate_node(SyntaxNode,input, index...index)
|
4041
4119
|
end
|