treetop 1.5.3 → 1.6.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (42) hide show
  1. checksums.yaml +5 -13
  2. data/Rakefile +9 -3
  3. data/doc/pitfalls_and_advanced_techniques.markdown +1 -1
  4. data/doc/sitegen.rb +1 -1
  5. data/doc/syntactic_recognition.markdown +2 -0
  6. data/doc/tt.1 +1 -1
  7. data/lib/treetop/compiler/metagrammar.rb +81 -13
  8. data/lib/treetop/compiler/metagrammar.treetop +67 -13
  9. data/lib/treetop/compiler/node_classes/anything_symbol.rb +5 -1
  10. data/lib/treetop/compiler/node_classes/character_class.rb +6 -2
  11. data/lib/treetop/compiler/node_classes/choice.rb +9 -5
  12. data/lib/treetop/compiler/node_classes/nonterminal.rb +2 -2
  13. data/lib/treetop/compiler/node_classes/parenthesized_expression.rb +5 -1
  14. data/lib/treetop/compiler/node_classes/parsing_expression.rb +12 -2
  15. data/lib/treetop/compiler/node_classes/predicate.rb +8 -1
  16. data/lib/treetop/compiler/node_classes/predicate_block.rb +7 -0
  17. data/lib/treetop/compiler/node_classes/repetition.rb +31 -11
  18. data/lib/treetop/compiler/node_classes/sequence.rb +5 -1
  19. data/lib/treetop/compiler/node_classes/terminal.rb +12 -2
  20. data/lib/treetop/runtime/compiled_parser.rb +12 -6
  21. data/lib/treetop/runtime/syntax_node.rb +24 -15
  22. data/lib/treetop/runtime/terminal_parse_failure.rb +4 -3
  23. data/lib/treetop/version.rb +2 -2
  24. data/spec/compiler/and_predicate_spec.rb +1 -1
  25. data/spec/compiler/anything_symbol_spec.rb +4 -1
  26. data/spec/compiler/character_class_spec.rb +4 -1
  27. data/spec/compiler/choice_spec.rb +20 -11
  28. data/spec/compiler/failure_propagation_functional_spec.rb +1 -1
  29. data/spec/compiler/grammar_spec.rb +4 -1
  30. data/spec/compiler/not_predicate_spec.rb +20 -6
  31. data/spec/compiler/occurrence_range_spec.rb +25 -28
  32. data/spec/compiler/one_or_more_spec.rb +2 -2
  33. data/spec/compiler/optional_spec.rb +2 -2
  34. data/spec/compiler/parenthesized_expression_spec.rb +15 -1
  35. data/spec/compiler/semantic_predicate_spec.rb +17 -16
  36. data/spec/compiler/sequence_spec.rb +1 -1
  37. data/spec/compiler/terminal_spec.rb +8 -1
  38. data/spec/compiler/terminal_symbol_spec.rb +4 -1
  39. data/spec/compiler/zero_or_more_spec.rb +4 -2
  40. data/spec/runtime/compiled_parser_spec.rb +33 -3
  41. metadata +20 -21
  42. data/examples/lambda_calculus/lambda_calculus +0 -0
checksums.yaml CHANGED
@@ -1,15 +1,7 @@
1
1
  ---
2
- !binary "U0hBMQ==":
3
- metadata.gz: !binary |-
4
- YjM5NTQzZTQ2YjVkZmJhMTIyMDUwM2U5YWY4MTcxNTQzMGYwZGM1Mg==
5
- data.tar.gz: !binary |-
6
- YTE1MTQyNWE0NDdkNTU1MmNiYWFiZWU2NDA3ZjJkYmUzNGU5ZmI3ZA==
2
+ SHA1:
3
+ metadata.gz: 4c3093c759c685e5241eea8e6ca42dd46d2719bc
4
+ data.tar.gz: 35c028a9353519e0865b5c1a82cbae4a307abb45
7
5
  SHA512:
8
- metadata.gz: !binary |-
9
- ODQyMDUyODBkYzE0MzYxNzNkMmE1MjQ0NjY3MmJjN2NjMjJjOTMxYjFkMzYy
10
- NTk1ZmIyMzMxZDczNWIxYTZhNDEyMjMxMzQ5OGIyYmM4MWE1NjY2MTRjOTg0
11
- ZmE5MGJiYzZhZjRjOTAzZjc2YTVlMGQ5Y2U2ZGVlMGE5MjgxZTI=
12
- data.tar.gz: !binary |-
13
- M2MzNmM5ZjI0MDJhMmE3NDk5MTMzNjUyOTE4MDc0ZWZiNjBmZjE1ZTgxYzc4
14
- MzA4NmVhZWQ0ZTliZjg3YWY1Mjc3ZGNiYmMyYTRmYzNjOGJiODM1Mzg1YjIz
15
- NmU4YjYwMGJlNjgyNmM2MGNjYjY2MDU4MDIxNWMwOTA2Y2MxYWY=
6
+ metadata.gz: 698c86025e1979b76b0279d7f28b2897a04832e32fe40d5e4b7708fb573141cb9a1b0f8e159c3db2c74afb44932ae8deea4331838e60d32b5f58ba054d7bfcef
7
+ data.tar.gz: 921b6d4b7a5debb9fa9ed662f359f31ae511d5f4c83426ab07cff120d8b634660684a9fe43f6a0c13fd7362f95c5a0e59f50763edd073c73728ba8f5060fb343
data/Rakefile CHANGED
@@ -54,9 +54,15 @@ end
54
54
 
55
55
  desc 'Upload website files'
56
56
  task :website_upload do
57
- rubyforge_config_file = "#{ENV['HOME']}/.rubyforge/user-config.yml"
58
- rubyforge_config = YAML.load_file(rubyforge_config_file)
59
- `rsync -aCv doc/site/ #{rubyforge_config['username']}@rubyforge.org:/var/www/gforge-projects/treetop/`
57
+ # The website is now done using gh-pages
58
+ system <<-END
59
+ git checkout gh-pages
60
+ cp website/*.html .
61
+ git add *.html
62
+ git commit -m"Website update `date`"
63
+ git push
64
+ git checkout master
65
+ END
60
66
  end
61
67
 
62
68
  desc 'Generate and upload website files'
@@ -30,7 +30,7 @@ Say I want to parse a diabolical wiki syntax in which the following interpretati
30
30
  end
31
31
 
32
32
  rule em
33
- '**' (strong / !'*' . / '\*')+ '**'
33
+ '*' (strong / !'*' . / '\*')+ '*'
34
34
  end
35
35
 
36
36
  Emphasized text is allowed within strong text by virtue of `em` being the first alternative. Since `em` will only successfully parse if a matching `*` is found, it is permitted, but other than that, no `*` characters are allowed unless they are escaped.
data/doc/sitegen.rb CHANGED
@@ -41,7 +41,7 @@ class Layout < Erector::Widget
41
41
  end
42
42
 
43
43
  def site_dir
44
- File.join(File.dirname(__FILE__), "site")
44
+ File.join(File.dirname(__FILE__), "../website")
45
45
  end
46
46
  end
47
47
 
@@ -39,6 +39,8 @@ Treetop will emit a module called `GrammarName` and a parser class called `Gramm
39
39
  #Parsing Expressions
40
40
  Each rule associates a name with a _parsing expression_. Parsing expressions are a generalization of vanilla regular expressions. Their key feature is the ability to reference other expressions in the grammar by name.
41
41
 
42
+ Treetop parsers will try to match the first rule defined in the grammar, unless you pass an optional parameter to set a different top rule.
43
+
42
44
  ##Terminal Symbols
43
45
  ###Strings
44
46
  Strings are surrounded in double or single quotes and must be matched exactly.
data/doc/tt.1 CHANGED
@@ -80,4 +80,4 @@ tt \-o alterate_name.rb foo
80
80
 
81
81
  The treetop website:
82
82
 
83
- .B http://treetop.rubyforge.org
83
+ .B http://cjheath.github.io/treetop/
@@ -21,7 +21,7 @@ module Treetop
21
21
  elements[0]
22
22
  end
23
23
 
24
- def prefix
24
+ def spacing
25
25
  elements[1]
26
26
  end
27
27
 
@@ -36,7 +36,7 @@ module Treetop
36
36
 
37
37
  module TreetopFile2
38
38
  def compile
39
- requires.text_value + prefix.text_value + module_or_grammar.compile + suffix.text_value
39
+ requires.text_value + spacing.text_value + module_or_grammar.compile + suffix.text_value
40
40
  end
41
41
  end
42
42
 
@@ -118,7 +118,7 @@ module Treetop
118
118
  end
119
119
 
120
120
  module RequireStatement0
121
- def prefix
121
+ def spacing
122
122
  elements[0]
123
123
  end
124
124
 
@@ -159,6 +159,7 @@ module Treetop
159
159
  r5 = true
160
160
  @index += 1
161
161
  else
162
+ terminal_parse_failure('[ \\t]')
162
163
  r5 = nil
163
164
  end
164
165
  if r5
@@ -181,6 +182,7 @@ module Treetop
181
182
  r7 = true
182
183
  @index += 1
183
184
  else
185
+ terminal_parse_failure('[^\\n\\r]')
184
186
  r7 = nil
185
187
  end
186
188
  if r7
@@ -201,6 +203,7 @@ module Treetop
201
203
  r8 = true
202
204
  @index += 1
203
205
  else
206
+ terminal_parse_failure('[\\n\\r]')
204
207
  r8 = nil
205
208
  end
206
209
  s0 << r8
@@ -281,7 +284,7 @@ module Treetop
281
284
  end
282
285
 
283
286
  module ModuleDeclaration4
284
- def prefix
287
+ def module_prefix
285
288
  elements[0]
286
289
  end
287
290
 
@@ -296,11 +299,11 @@ module Treetop
296
299
 
297
300
  module ModuleDeclaration5
298
301
  def compile
299
- prefix.text_value + module_contents.compile + suffix.text_value
302
+ module_prefix.text_value + module_contents.compile + suffix.text_value
300
303
  end
301
304
 
302
305
  def parser_name
303
- prefix.name.text_value+'::'+module_contents.parser_name
306
+ module_prefix.name.text_value+'::'+module_contents.parser_name
304
307
  end
305
308
  end
306
309
 
@@ -334,6 +337,7 @@ module Treetop
334
337
  r5 = true
335
338
  @index += 1
336
339
  else
340
+ terminal_parse_failure('[A-Z]')
337
341
  r5 = nil
338
342
  end
339
343
  s4 << r5
@@ -366,6 +370,7 @@ module Treetop
366
370
  r11 = true
367
371
  @index += 1
368
372
  else
373
+ terminal_parse_failure('[A-Z]')
369
374
  r11 = nil
370
375
  end
371
376
  s9 << r11
@@ -617,6 +622,7 @@ module Treetop
617
622
  r1 = true
618
623
  @index += 1
619
624
  else
625
+ terminal_parse_failure('[A-Z]')
620
626
  r1 = nil
621
627
  end
622
628
  s0 << r1
@@ -829,6 +835,7 @@ module Treetop
829
835
  r3 = true
830
836
  @index += 1
831
837
  else
838
+ terminal_parse_failure('[A-Z]')
832
839
  r3 = nil
833
840
  end
834
841
  s0 << r3
@@ -1064,6 +1071,10 @@ module Treetop
1064
1071
  super.elements.map {|elt| elt.alternative}
1065
1072
  end
1066
1073
 
1074
+ def parent_modules
1075
+ []
1076
+ end
1077
+
1067
1078
  def inline_modules
1068
1079
  (alternatives.map {|alt| alt.inline_modules }).flatten
1069
1080
  end
@@ -1171,10 +1182,14 @@ module Treetop
1171
1182
  sequence_body.tail
1172
1183
  end
1173
1184
 
1185
+ def parent_modules
1186
+ node_class_declarations.inline_modules
1187
+ end
1188
+
1174
1189
  def inline_modules
1175
1190
  (sequence_elements.map {|elt| elt.inline_modules}).flatten +
1176
1191
  [sequence_element_accessor_module] +
1177
- node_class_declarations.inline_modules
1192
+ parent_modules
1178
1193
  end
1179
1194
 
1180
1195
  def inline_module_name
@@ -1411,6 +1426,10 @@ module Treetop
1411
1426
  atomic
1412
1427
  end
1413
1428
 
1429
+ def parent_modules
1430
+ []
1431
+ end
1432
+
1414
1433
  def inline_modules
1415
1434
  atomic.inline_modules
1416
1435
  end
@@ -1425,7 +1444,7 @@ module Treetop
1425
1444
  elements[0]
1426
1445
  end
1427
1446
 
1428
- def predicate_block
1447
+ def atomic
1429
1448
  elements[2]
1430
1449
  end
1431
1450
  end
@@ -1435,8 +1454,11 @@ module Treetop
1435
1454
  prefix.compile(address, builder, self)
1436
1455
  end
1437
1456
  def prefixed_expression
1438
- predicate_block
1457
+ atomic
1439
1458
  end
1459
+ def parent_modules
1460
+ []
1461
+ end
1440
1462
  def inline_modules
1441
1463
  []
1442
1464
  end
@@ -1458,6 +1480,7 @@ module Treetop
1458
1480
 
1459
1481
  module Primary5
1460
1482
  def compile(address, builder, parent_expression=nil)
1483
+ # debugger if node_class_declarations.inline_modules.size > 0 && atomic.inline_modules.size > 0
1461
1484
  suffix.compile(address, builder, self)
1462
1485
  end
1463
1486
 
@@ -1469,8 +1492,12 @@ module Treetop
1469
1492
  node_class_declarations.node_class_name
1470
1493
  end
1471
1494
 
1495
+ def parent_modules
1496
+ node_class_declarations.inline_modules
1497
+ end
1498
+
1472
1499
  def inline_modules
1473
- atomic.inline_modules + node_class_declarations.inline_modules
1500
+ atomic.inline_modules + parent_modules
1474
1501
  end
1475
1502
 
1476
1503
  def inline_module_name
@@ -1490,6 +1517,7 @@ module Treetop
1490
1517
 
1491
1518
  module Primary7
1492
1519
  def compile(address, builder, parent_expression=nil)
1520
+ # debugger if node_class_declarations.inline_modules.size > 0 && atomic.inline_modules.size > 0
1493
1521
  atomic.compile(address, builder, self)
1494
1522
  end
1495
1523
 
@@ -1497,8 +1525,12 @@ module Treetop
1497
1525
  node_class_declarations.node_class_name
1498
1526
  end
1499
1527
 
1528
+ def parent_modules
1529
+ node_class_declarations.inline_modules
1530
+ end
1531
+
1500
1532
  def inline_modules
1501
- atomic.inline_modules + node_class_declarations.inline_modules
1533
+ atomic.inline_modules + parent_modules
1502
1534
  end
1503
1535
 
1504
1536
  def inline_module_name
@@ -1666,6 +1698,10 @@ module Treetop
1666
1698
  sequence_primary.compile(lexical_address, builder)
1667
1699
  end
1668
1700
 
1701
+ def parent_modules
1702
+ []
1703
+ end
1704
+
1669
1705
  def inline_modules
1670
1706
  sequence_primary.inline_modules
1671
1707
  end
@@ -1722,6 +1758,10 @@ module Treetop
1722
1758
  sequence_primary.compile(lexical_address, builder)
1723
1759
  end
1724
1760
 
1761
+ def parent_modules
1762
+ []
1763
+ end
1764
+
1725
1765
  def inline_modules
1726
1766
  sequence_primary.inline_modules
1727
1767
  end
@@ -1925,6 +1965,10 @@ module Treetop
1925
1965
  elements[1]
1926
1966
  end
1927
1967
 
1968
+ def parent_modules
1969
+ []
1970
+ end
1971
+
1928
1972
  def inline_modules
1929
1973
  atomic.inline_modules
1930
1974
  end
@@ -1939,7 +1983,7 @@ module Treetop
1939
1983
  elements[0]
1940
1984
  end
1941
1985
 
1942
- def predicate_block
1986
+ def atomic
1943
1987
  elements[2]
1944
1988
  end
1945
1989
  end
@@ -1949,8 +1993,11 @@ module Treetop
1949
1993
  prefix.compile(address, builder, self)
1950
1994
  end
1951
1995
  def prefixed_expression
1952
- predicate_block
1996
+ atomic
1953
1997
  end
1998
+ def parent_modules
1999
+ []
2000
+ end
1954
2001
  def inline_modules
1955
2002
  []
1956
2003
  end
@@ -1975,6 +2022,10 @@ module Treetop
1975
2022
  nil
1976
2023
  end
1977
2024
 
2025
+ def parent_modules
2026
+ []
2027
+ end
2028
+
1978
2029
  def inline_modules
1979
2030
  atomic.inline_modules
1980
2031
  end
@@ -2150,6 +2201,7 @@ module Treetop
2150
2201
  node_class_expression.node_class_name
2151
2202
  end
2152
2203
 
2204
+ # !!!! cjh !!!!!
2153
2205
  def inline_modules
2154
2206
  trailing_inline_module.inline_modules
2155
2207
  end
@@ -2281,6 +2333,7 @@ module Treetop
2281
2333
  r4 = true
2282
2334
  @index += 1
2283
2335
  else
2336
+ terminal_parse_failure('[0-9]')
2284
2337
  r4 = nil
2285
2338
  end
2286
2339
  if r4
@@ -2307,6 +2360,7 @@ module Treetop
2307
2360
  r7 = true
2308
2361
  @index += 1
2309
2362
  else
2363
+ terminal_parse_failure('[0-9]')
2310
2364
  r7 = nil
2311
2365
  end
2312
2366
  if r7
@@ -2435,6 +2489,9 @@ module Treetop
2435
2489
  end
2436
2490
 
2437
2491
  module ParenthesizedExpression1
2492
+ def parent_modules
2493
+ []
2494
+ end
2438
2495
  def inline_modules
2439
2496
  parsing_expression.inline_modules
2440
2497
  end
@@ -2665,6 +2722,7 @@ module Treetop
2665
2722
  r5 = true
2666
2723
  @index += 1
2667
2724
  else
2725
+ terminal_parse_failure('[ir]')
2668
2726
  r5 = nil
2669
2727
  end
2670
2728
  if r5
@@ -3536,6 +3594,9 @@ module Treetop
3536
3594
  end
3537
3595
 
3538
3596
  module TrailingInlineModule1
3597
+ def parent_modules
3598
+ []
3599
+ end
3539
3600
  def inline_modules
3540
3601
  [inline_module]
3541
3602
  end
@@ -3546,6 +3607,9 @@ module Treetop
3546
3607
  end
3547
3608
 
3548
3609
  module TrailingInlineModule2
3610
+ def parent_modules
3611
+ []
3612
+ end
3549
3613
  def inline_modules
3550
3614
  []
3551
3615
  end
@@ -3696,6 +3760,7 @@ module Treetop
3696
3760
  r7 = true
3697
3761
  @index += 1
3698
3762
  else
3763
+ terminal_parse_failure('[{}]')
3699
3764
  r7 = nil
3700
3765
  end
3701
3766
  if r7
@@ -3891,6 +3956,7 @@ module Treetop
3891
3956
  r0 = instantiate_node(SyntaxNode,input, index...(index + 1))
3892
3957
  @index += 1
3893
3958
  else
3959
+ terminal_parse_failure('[A-Za-z_]')
3894
3960
  r0 = nil
3895
3961
  end
3896
3962
 
@@ -3920,6 +3986,7 @@ module Treetop
3920
3986
  r2 = true
3921
3987
  @index += 1
3922
3988
  else
3989
+ terminal_parse_failure('[0-9]')
3923
3990
  r2 = nil
3924
3991
  end
3925
3992
  if r2
@@ -4081,6 +4148,7 @@ module Treetop
4081
4148
  r0 = instantiate_node(SyntaxNode,input, index...(index + 1))
4082
4149
  @index += 1
4083
4150
  else
4151
+ terminal_parse_failure('[ \\t\\n\\r]')
4084
4152
  r0 = nil
4085
4153
  end
4086
4154
 
@@ -2,15 +2,15 @@ module Treetop
2
2
  module Compiler
3
3
  grammar Metagrammar
4
4
  rule treetop_file
5
- requires:(space? require_statement)* prefix:space? module_or_grammar suffix:space? {
5
+ requires:(space? require_statement)* spacing:space? module_or_grammar suffix:space? {
6
6
  def compile
7
- requires.text_value + prefix.text_value + module_or_grammar.compile + suffix.text_value
7
+ requires.text_value + spacing.text_value + module_or_grammar.compile + suffix.text_value
8
8
  end
9
9
  }
10
10
  end
11
11
 
12
12
  rule require_statement
13
- prefix:space? "require" [ \t]+ [^\n\r]+ [\n\r]
13
+ spacing:space? "require" [ \t]+ [^\n\r]+ [\n\r]
14
14
  end
15
15
 
16
16
  rule module_or_grammar
@@ -18,13 +18,13 @@ module Treetop
18
18
  end
19
19
 
20
20
  rule module_declaration
21
- prefix:('module' space name:([A-Z] alphanumeric_char* ('::' [A-Z] alphanumeric_char*)*) space) module_contents:(module_declaration / grammar) suffix:(space 'end') {
21
+ module_prefix:('module' space name:([A-Z] alphanumeric_char* ('::' [A-Z] alphanumeric_char*)*) space) module_contents:(module_declaration / grammar) suffix:(space 'end') {
22
22
  def compile
23
- prefix.text_value + module_contents.compile + suffix.text_value
23
+ module_prefix.text_value + module_contents.compile + suffix.text_value
24
24
  end
25
25
 
26
26
  def parser_name
27
- prefix.name.text_value+'::'+module_contents.parser_name
27
+ module_prefix.name.text_value+'::'+module_contents.parser_name
28
28
  end
29
29
  }
30
30
  end
@@ -84,6 +84,10 @@ module Treetop
84
84
  super.elements.map {|elt| elt.alternative}
85
85
  end
86
86
 
87
+ def parent_modules
88
+ []
89
+ end
90
+
87
91
  def inline_modules
88
92
  (alternatives.map {|alt| alt.inline_modules }).flatten
89
93
  end
@@ -100,10 +104,14 @@ module Treetop
100
104
  sequence_body.tail
101
105
  end
102
106
 
107
+ def parent_modules
108
+ node_class_declarations.inline_modules
109
+ end
110
+
103
111
  def inline_modules
104
112
  (sequence_elements.map {|elt| elt.inline_modules}).flatten +
105
113
  [sequence_element_accessor_module] +
106
- node_class_declarations.inline_modules
114
+ parent_modules
107
115
  end
108
116
 
109
117
  def inline_module_name
@@ -150,6 +158,10 @@ module Treetop
150
158
  atomic
151
159
  end
152
160
 
161
+ def parent_modules
162
+ []
163
+ end
164
+
153
165
  def inline_modules
154
166
  atomic.inline_modules
155
167
  end
@@ -159,13 +171,16 @@ module Treetop
159
171
  end
160
172
  }
161
173
  /
162
- prefix space? predicate_block {
174
+ prefix space? atomic:predicate_block {
163
175
  def compile(address, builder, parent_expression=nil)
164
176
  prefix.compile(address, builder, self)
165
177
  end
166
178
  def prefixed_expression
167
- predicate_block
179
+ atomic
168
180
  end
181
+ def parent_modules
182
+ []
183
+ end
169
184
  def inline_modules
170
185
  []
171
186
  end
@@ -173,6 +188,7 @@ module Treetop
173
188
  /
174
189
  atomic suffix node_class_declarations {
175
190
  def compile(address, builder, parent_expression=nil)
191
+ raise "Extraneous module ignored after suffix: #{input[interval].inspect}" if node_class_declarations.inline_modules.size > 0 && atomic.inline_modules.size > 0
176
192
  suffix.compile(address, builder, self)
177
193
  end
178
194
 
@@ -184,8 +200,12 @@ module Treetop
184
200
  node_class_declarations.node_class_name
185
201
  end
186
202
 
203
+ def parent_modules
204
+ node_class_declarations.inline_modules
205
+ end
206
+
187
207
  def inline_modules
188
- atomic.inline_modules + node_class_declarations.inline_modules
208
+ atomic.inline_modules + parent_modules
189
209
  end
190
210
 
191
211
  def inline_module_name
@@ -195,6 +215,7 @@ module Treetop
195
215
  /
196
216
  atomic node_class_declarations {
197
217
  def compile(address, builder, parent_expression=nil)
218
+ raise "Extraneous module ignored with nested atomic: #{input[interval].inspect}" if node_class_declarations.inline_modules.size > 0 && atomic.inline_modules.size > 0
198
219
  atomic.compile(address, builder, self)
199
220
  end
200
221
 
@@ -202,8 +223,12 @@ module Treetop
202
223
  node_class_declarations.node_class_name
203
224
  end
204
225
 
226
+ def parent_modules
227
+ node_class_declarations.inline_modules
228
+ end
229
+
205
230
  def inline_modules
206
- atomic.inline_modules + node_class_declarations.inline_modules
231
+ atomic.inline_modules + parent_modules
207
232
  end
208
233
 
209
234
  def inline_module_name
@@ -222,6 +247,10 @@ module Treetop
222
247
  sequence_primary.compile(lexical_address, builder)
223
248
  end
224
249
 
250
+ def parent_modules
251
+ []
252
+ end
253
+
225
254
  def inline_modules
226
255
  sequence_primary.inline_modules
227
256
  end
@@ -238,6 +267,10 @@ module Treetop
238
267
  sequence_primary.compile(lexical_address, builder)
239
268
  end
240
269
 
270
+ def parent_modules
271
+ []
272
+ end
273
+
241
274
  def inline_modules
242
275
  sequence_primary.inline_modules
243
276
  end
@@ -282,6 +315,10 @@ module Treetop
282
315
  elements[1]
283
316
  end
284
317
 
318
+ def parent_modules
319
+ []
320
+ end
321
+
285
322
  def inline_modules
286
323
  atomic.inline_modules
287
324
  end
@@ -291,13 +328,16 @@ module Treetop
291
328
  end
292
329
  }
293
330
  /
294
- prefix space? predicate_block {
331
+ prefix space? atomic:predicate_block {
295
332
  def compile(address, builder, parent_expression=nil)
296
333
  prefix.compile(address, builder, self)
297
334
  end
298
335
  def prefixed_expression
299
- predicate_block
336
+ atomic
300
337
  end
338
+ def parent_modules
339
+ []
340
+ end
301
341
  def inline_modules
302
342
  []
303
343
  end
@@ -312,6 +352,10 @@ module Treetop
312
352
  nil
313
353
  end
314
354
 
355
+ def parent_modules
356
+ []
357
+ end
358
+
315
359
  def inline_modules
316
360
  atomic.inline_modules
317
361
  end
@@ -338,6 +382,7 @@ module Treetop
338
382
  node_class_expression.node_class_name
339
383
  end
340
384
 
385
+ # !!!! cjh !!!!!
341
386
  def inline_modules
342
387
  trailing_inline_module.inline_modules
343
388
  end
@@ -374,6 +419,9 @@ module Treetop
374
419
 
375
420
  rule parenthesized_expression
376
421
  '(' space? parsing_expression space? ')' <ParenthesizedExpression> {
422
+ def parent_modules
423
+ []
424
+ end
377
425
  def inline_modules
378
426
  parsing_expression.inline_modules
379
427
  end
@@ -439,6 +487,9 @@ module Treetop
439
487
 
440
488
  rule trailing_inline_module
441
489
  space inline_module {
490
+ def parent_modules
491
+ []
492
+ end
442
493
  def inline_modules
443
494
  [inline_module]
444
495
  end
@@ -449,6 +500,9 @@ module Treetop
449
500
  }
450
501
  /
451
502
  '' {
503
+ def parent_modules
504
+ []
505
+ end
452
506
  def inline_modules
453
507
  []
454
508
  end