treetop 1.5.3 → 1.6.12

Sign up to get free protection for your applications and to get access to all the features.
Files changed (95) hide show
  1. checksums.yaml +5 -13
  2. data/Gemfile +12 -0
  3. data/History.txt +18 -0
  4. data/README.md +4 -0
  5. data/Rakefile +20 -40
  6. data/Treetop.tmbundle/Preferences/Comments.tmPreferences +28 -0
  7. data/Treetop.tmbundle/Snippets/grammar ___ end.tmSnippet +20 -0
  8. data/Treetop.tmbundle/Snippets/rule ___ end.tmSnippet +18 -0
  9. data/Treetop.tmbundle/Support/nibs/SyntaxTreeViewer.nib/designable.nib +1524 -0
  10. data/Treetop.tmbundle/Support/nibs/SyntaxTreeViewer.nib/keyedobjects.nib +0 -0
  11. data/Treetop.tmbundle/Support/syntax_tree_viewer.rb +117 -0
  12. data/Treetop.tmbundle/Syntaxes/Treetop Grammar.tmLanguage +358 -0
  13. data/Treetop.tmbundle/info.plist +10 -0
  14. data/doc/pitfalls_and_advanced_techniques.markdown +7 -1
  15. data/doc/syntactic_recognition.markdown +7 -2
  16. data/doc/tt.1 +1 -1
  17. data/examples/indented_blocks/indented_blocks.tt +73 -0
  18. data/examples/indented_blocks/indented_blocks_test.rb +24 -0
  19. data/lib/treetop/compiler/grammar_compiler.rb +6 -3
  20. data/lib/treetop/compiler/metagrammar.rb +301 -159
  21. data/lib/treetop/compiler/metagrammar.treetop +96 -13
  22. data/lib/treetop/compiler/node_classes/anything_symbol.rb +10 -2
  23. data/lib/treetop/compiler/node_classes/atomic_expression.rb +2 -2
  24. data/lib/treetop/compiler/node_classes/character_class.rb +10 -2
  25. data/lib/treetop/compiler/node_classes/choice.rb +11 -7
  26. data/lib/treetop/compiler/node_classes/nonterminal.rb +6 -2
  27. data/lib/treetop/compiler/node_classes/parenthesized_expression.rb +5 -1
  28. data/lib/treetop/compiler/node_classes/parsing_expression.rb +10 -1
  29. data/lib/treetop/compiler/node_classes/parsing_rule.rb +1 -1
  30. data/lib/treetop/compiler/node_classes/predicate.rb +8 -1
  31. data/lib/treetop/compiler/node_classes/predicate_block.rb +7 -0
  32. data/lib/treetop/compiler/node_classes/repetition.rb +28 -8
  33. data/lib/treetop/compiler/node_classes/sequence.rb +5 -1
  34. data/lib/treetop/compiler/node_classes/terminal.rb +36 -22
  35. data/lib/treetop/compiler/ruby_builder.rb +2 -2
  36. data/lib/treetop/ruby_extensions/string.rb +0 -6
  37. data/lib/treetop/runtime/compiled_parser.rb +33 -14
  38. data/lib/treetop/runtime/syntax_node.rb +24 -15
  39. data/lib/treetop/runtime/terminal_parse_failure.rb +4 -3
  40. data/lib/treetop/runtime/terminal_syntax_node.rb +4 -4
  41. data/lib/treetop/version.rb +2 -2
  42. data/treetop.gemspec +25 -165
  43. metadata +43 -98
  44. data/doc/site.rb +0 -112
  45. data/doc/sitegen.rb +0 -65
  46. data/examples/lambda_calculus/lambda_calculus +0 -0
  47. data/spec/compiler/and_predicate_spec.rb +0 -36
  48. data/spec/compiler/anything_symbol_spec.rb +0 -44
  49. data/spec/compiler/character_class_spec.rb +0 -301
  50. data/spec/compiler/choice_spec.rb +0 -80
  51. data/spec/compiler/circular_compilation_spec.rb +0 -30
  52. data/spec/compiler/failure_propagation_functional_spec.rb +0 -21
  53. data/spec/compiler/grammar_compiler_spec.rb +0 -113
  54. data/spec/compiler/grammar_spec.rb +0 -41
  55. data/spec/compiler/multibyte_chars_spec.rb +0 -38
  56. data/spec/compiler/namespace_spec.rb +0 -42
  57. data/spec/compiler/nonterminal_symbol_spec.rb +0 -40
  58. data/spec/compiler/not_predicate_spec.rb +0 -38
  59. data/spec/compiler/occurrence_range_spec.rb +0 -189
  60. data/spec/compiler/one_or_more_spec.rb +0 -35
  61. data/spec/compiler/optional_spec.rb +0 -37
  62. data/spec/compiler/parenthesized_expression_spec.rb +0 -19
  63. data/spec/compiler/parsing_rule_spec.rb +0 -61
  64. data/spec/compiler/repeated_subrule_spec.rb +0 -29
  65. data/spec/compiler/semantic_predicate_spec.rb +0 -175
  66. data/spec/compiler/sequence_spec.rb +0 -129
  67. data/spec/compiler/terminal_spec.rb +0 -170
  68. data/spec/compiler/terminal_symbol_spec.rb +0 -37
  69. data/spec/compiler/test_grammar.treetop +0 -7
  70. data/spec/compiler/test_grammar.tt +0 -7
  71. data/spec/compiler/test_grammar_do.treetop +0 -7
  72. data/spec/compiler/test_grammar_magic_coding.treetop +0 -8
  73. data/spec/compiler/test_grammar_magic_encoding.treetop +0 -8
  74. data/spec/compiler/tt_compiler_spec.rb +0 -224
  75. data/spec/compiler/zero_or_more_spec.rb +0 -56
  76. data/spec/composition/a.treetop +0 -11
  77. data/spec/composition/b.treetop +0 -11
  78. data/spec/composition/c.treetop +0 -10
  79. data/spec/composition/d.treetop +0 -10
  80. data/spec/composition/f.treetop +0 -17
  81. data/spec/composition/grammar_composition_spec.rb +0 -40
  82. data/spec/composition/subfolder/e_includes_c.treetop +0 -15
  83. data/spec/ruby_extensions/string_spec.rb +0 -32
  84. data/spec/runtime/compiled_parser_spec.rb +0 -123
  85. data/spec/runtime/interval_skip_list/delete_spec.rb +0 -147
  86. data/spec/runtime/interval_skip_list/expire_range_spec.rb +0 -349
  87. data/spec/runtime/interval_skip_list/insert_and_delete_node_spec.rb +0 -385
  88. data/spec/runtime/interval_skip_list/insert_spec.rb +0 -660
  89. data/spec/runtime/interval_skip_list/interval_skip_list_spec.graffle +0 -6175
  90. data/spec/runtime/interval_skip_list/interval_skip_list_spec.rb +0 -58
  91. data/spec/runtime/interval_skip_list/palindromic_fixture.rb +0 -35
  92. data/spec/runtime/interval_skip_list/palindromic_fixture_spec.rb +0 -163
  93. data/spec/runtime/interval_skip_list/spec_helper.rb +0 -91
  94. data/spec/runtime/syntax_node_spec.rb +0 -77
  95. data/spec/spec_helper.rb +0 -115
@@ -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
 
@@ -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
@@ -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
 
@@ -317,100 +320,122 @@ module Treetop
317
320
 
318
321
  i0, s0 = index, []
319
322
  i1, s1 = index, []
323
+ i2 = index
320
324
  if (match_len = has_terminal?('module', false, index))
321
- r2 = instantiate_node(SyntaxNode,input, index...(index + match_len))
325
+ r3 = instantiate_node(SyntaxNode,input, index...(index + match_len))
322
326
  @index += match_len
323
327
  else
324
- terminal_parse_failure('module')
325
- r2 = nil
328
+ terminal_parse_failure('\'module\'')
329
+ r3 = nil
330
+ end
331
+ if r3
332
+ r3 = SyntaxNode.new(input, (index-1)...index) if r3 == true
333
+ r2 = r3
334
+ else
335
+ if (match_len = has_terminal?('class', false, index))
336
+ r4 = instantiate_node(SyntaxNode,input, index...(index + match_len))
337
+ @index += match_len
338
+ else
339
+ terminal_parse_failure('\'class\'')
340
+ r4 = nil
341
+ end
342
+ if r4
343
+ r4 = SyntaxNode.new(input, (index-1)...index) if r4 == true
344
+ r2 = r4
345
+ else
346
+ @index = i2
347
+ r2 = nil
348
+ end
326
349
  end
327
350
  s1 << r2
328
351
  if r2
329
- r3 = _nt_space
330
- s1 << r3
331
- if r3
332
- i4, s4 = index, []
352
+ r5 = _nt_space
353
+ s1 << r5
354
+ if r5
355
+ i6, s6 = index, []
333
356
  if has_terminal?(@regexps[gr = '\A[A-Z]'] ||= Regexp.new(gr), :regexp, index)
334
- r5 = true
357
+ r7 = true
335
358
  @index += 1
336
359
  else
337
- r5 = nil
360
+ terminal_parse_failure('[A-Z]')
361
+ r7 = nil
338
362
  end
339
- s4 << r5
340
- if r5
341
- s6, i6 = [], index
363
+ s6 << r7
364
+ if r7
365
+ s8, i8 = [], index
342
366
  loop do
343
- r7 = _nt_alphanumeric_char
344
- if r7
345
- s6 << r7
367
+ r9 = _nt_alphanumeric_char
368
+ if r9
369
+ s8 << r9
346
370
  else
347
371
  break
348
372
  end
349
373
  end
350
- r6 = instantiate_node(SyntaxNode,input, i6...index, s6)
351
- s4 << r6
352
- if r6
353
- s8, i8 = [], index
374
+ r8 = instantiate_node(SyntaxNode,input, i8...index, s8)
375
+ s6 << r8
376
+ if r8
377
+ s10, i10 = [], index
354
378
  loop do
355
- i9, s9 = index, []
379
+ i11, s11 = index, []
356
380
  if (match_len = has_terminal?('::', false, index))
357
- r10 = instantiate_node(SyntaxNode,input, index...(index + match_len))
381
+ r12 = instantiate_node(SyntaxNode,input, index...(index + match_len))
358
382
  @index += match_len
359
383
  else
360
- terminal_parse_failure('::')
361
- r10 = nil
384
+ terminal_parse_failure('\'::\'')
385
+ r12 = nil
362
386
  end
363
- s9 << r10
364
- if r10
387
+ s11 << r12
388
+ if r12
365
389
  if has_terminal?(@regexps[gr = '\A[A-Z]'] ||= Regexp.new(gr), :regexp, index)
366
- r11 = true
390
+ r13 = true
367
391
  @index += 1
368
392
  else
369
- r11 = nil
393
+ terminal_parse_failure('[A-Z]')
394
+ r13 = nil
370
395
  end
371
- s9 << r11
372
- if r11
373
- s12, i12 = [], index
396
+ s11 << r13
397
+ if r13
398
+ s14, i14 = [], index
374
399
  loop do
375
- r13 = _nt_alphanumeric_char
376
- if r13
377
- s12 << r13
400
+ r15 = _nt_alphanumeric_char
401
+ if r15
402
+ s14 << r15
378
403
  else
379
404
  break
380
405
  end
381
406
  end
382
- r12 = instantiate_node(SyntaxNode,input, i12...index, s12)
383
- s9 << r12
407
+ r14 = instantiate_node(SyntaxNode,input, i14...index, s14)
408
+ s11 << r14
384
409
  end
385
410
  end
386
- if s9.last
387
- r9 = instantiate_node(SyntaxNode,input, i9...index, s9)
388
- r9.extend(ModuleDeclaration0)
411
+ if s11.last
412
+ r11 = instantiate_node(SyntaxNode,input, i11...index, s11)
413
+ r11.extend(ModuleDeclaration0)
389
414
  else
390
- @index = i9
391
- r9 = nil
415
+ @index = i11
416
+ r11 = nil
392
417
  end
393
- if r9
394
- s8 << r9
418
+ if r11
419
+ s10 << r11
395
420
  else
396
421
  break
397
422
  end
398
423
  end
399
- r8 = instantiate_node(SyntaxNode,input, i8...index, s8)
400
- s4 << r8
424
+ r10 = instantiate_node(SyntaxNode,input, i10...index, s10)
425
+ s6 << r10
401
426
  end
402
427
  end
403
- if s4.last
404
- r4 = instantiate_node(SyntaxNode,input, i4...index, s4)
405
- r4.extend(ModuleDeclaration1)
428
+ if s6.last
429
+ r6 = instantiate_node(SyntaxNode,input, i6...index, s6)
430
+ r6.extend(ModuleDeclaration1)
406
431
  else
407
- @index = i4
408
- r4 = nil
432
+ @index = i6
433
+ r6 = nil
409
434
  end
410
- s1 << r4
411
- if r4
412
- r14 = _nt_space
413
- s1 << r14
435
+ s1 << r6
436
+ if r6
437
+ r16 = _nt_space
438
+ s1 << r16
414
439
  end
415
440
  end
416
441
  end
@@ -423,44 +448,44 @@ module Treetop
423
448
  end
424
449
  s0 << r1
425
450
  if r1
426
- i15 = index
427
- r16 = _nt_module_declaration
428
- if r16
429
- r16 = SyntaxNode.new(input, (index-1)...index) if r16 == true
430
- r15 = r16
451
+ i17 = index
452
+ r18 = _nt_module_declaration
453
+ if r18
454
+ r18 = SyntaxNode.new(input, (index-1)...index) if r18 == true
455
+ r17 = r18
431
456
  else
432
- r17 = _nt_grammar
433
- if r17
434
- r17 = SyntaxNode.new(input, (index-1)...index) if r17 == true
435
- r15 = r17
457
+ r19 = _nt_grammar
458
+ if r19
459
+ r19 = SyntaxNode.new(input, (index-1)...index) if r19 == true
460
+ r17 = r19
436
461
  else
437
- @index = i15
438
- r15 = nil
462
+ @index = i17
463
+ r17 = nil
439
464
  end
440
465
  end
441
- s0 << r15
442
- if r15
443
- i18, s18 = index, []
444
- r19 = _nt_space
445
- s18 << r19
446
- if r19
466
+ s0 << r17
467
+ if r17
468
+ i20, s20 = index, []
469
+ r21 = _nt_space
470
+ s20 << r21
471
+ if r21
447
472
  if (match_len = has_terminal?('end', false, index))
448
- r20 = instantiate_node(SyntaxNode,input, index...(index + match_len))
473
+ r22 = instantiate_node(SyntaxNode,input, index...(index + match_len))
449
474
  @index += match_len
450
475
  else
451
- terminal_parse_failure('end')
452
- r20 = nil
476
+ terminal_parse_failure('\'end\'')
477
+ r22 = nil
453
478
  end
454
- s18 << r20
479
+ s20 << r22
455
480
  end
456
- if s18.last
457
- r18 = instantiate_node(SyntaxNode,input, i18...index, s18)
458
- r18.extend(ModuleDeclaration3)
481
+ if s20.last
482
+ r20 = instantiate_node(SyntaxNode,input, i20...index, s20)
483
+ r20.extend(ModuleDeclaration3)
459
484
  else
460
- @index = i18
461
- r18 = nil
485
+ @index = i20
486
+ r20 = nil
462
487
  end
463
- s0 << r18
488
+ s0 << r20
464
489
  end
465
490
  end
466
491
  if s0.last
@@ -518,7 +543,7 @@ module Treetop
518
543
  r1 = instantiate_node(SyntaxNode,input, index...(index + match_len))
519
544
  @index += match_len
520
545
  else
521
- terminal_parse_failure('grammar')
546
+ terminal_parse_failure('\'grammar\'')
522
547
  r1 = nil
523
548
  end
524
549
  s0 << r1
@@ -537,7 +562,7 @@ module Treetop
537
562
  r7 = instantiate_node(SyntaxNode,input, index...(index + match_len))
538
563
  @index += match_len
539
564
  else
540
- terminal_parse_failure('do')
565
+ terminal_parse_failure('\'do\'')
541
566
  r7 = nil
542
567
  end
543
568
  s6 << r7
@@ -574,7 +599,7 @@ module Treetop
574
599
  r12 = instantiate_node(SyntaxNode,input, index...(index + match_len))
575
600
  @index += match_len
576
601
  else
577
- terminal_parse_failure('end')
602
+ terminal_parse_failure('\'end\'')
578
603
  r12 = nil
579
604
  end
580
605
  s0 << r12
@@ -617,6 +642,7 @@ module Treetop
617
642
  r1 = true
618
643
  @index += 1
619
644
  else
645
+ terminal_parse_failure('[A-Z]')
620
646
  r1 = nil
621
647
  end
622
648
  s0 << r1
@@ -739,7 +765,7 @@ module Treetop
739
765
  r7.extend(DeclarationSequence3)
740
766
  @index += match_len
741
767
  else
742
- terminal_parse_failure('')
768
+ terminal_parse_failure('\'\'')
743
769
  r7 = nil
744
770
  end
745
771
  if r7
@@ -817,7 +843,7 @@ module Treetop
817
843
  r1 = instantiate_node(SyntaxNode,input, index...(index + match_len))
818
844
  @index += match_len
819
845
  else
820
- terminal_parse_failure('include')
846
+ terminal_parse_failure('\'include\'')
821
847
  r1 = nil
822
848
  end
823
849
  s0 << r1
@@ -829,6 +855,7 @@ module Treetop
829
855
  r3 = true
830
856
  @index += 1
831
857
  else
858
+ terminal_parse_failure('[A-Z]')
832
859
  r3 = nil
833
860
  end
834
861
  s0 << r3
@@ -845,7 +872,7 @@ module Treetop
845
872
  r7 = instantiate_node(SyntaxNode,input, index...(index + match_len))
846
873
  @index += match_len
847
874
  else
848
- terminal_parse_failure('::')
875
+ terminal_parse_failure('\'::\'')
849
876
  r7 = nil
850
877
  end
851
878
  if r7
@@ -926,7 +953,7 @@ module Treetop
926
953
  r1 = instantiate_node(SyntaxNode,input, index...(index + match_len))
927
954
  @index += match_len
928
955
  else
929
- terminal_parse_failure('rule')
956
+ terminal_parse_failure('\'rule\'')
930
957
  r1 = nil
931
958
  end
932
959
  s0 << r1
@@ -945,7 +972,7 @@ module Treetop
945
972
  r7 = instantiate_node(SyntaxNode,input, index...(index + match_len))
946
973
  @index += match_len
947
974
  else
948
- terminal_parse_failure('do')
975
+ terminal_parse_failure('\'do\'')
949
976
  r7 = nil
950
977
  end
951
978
  s6 << r7
@@ -977,7 +1004,7 @@ module Treetop
977
1004
  r11 = instantiate_node(SyntaxNode,input, index...(index + match_len))
978
1005
  @index += match_len
979
1006
  else
980
- terminal_parse_failure('end')
1007
+ terminal_parse_failure('\'end\'')
981
1008
  r11 = nil
982
1009
  end
983
1010
  s0 << r11
@@ -1064,9 +1091,17 @@ module Treetop
1064
1091
  super.elements.map {|elt| elt.alternative}
1065
1092
  end
1066
1093
 
1094
+ def parent_modules
1095
+ []
1096
+ end
1097
+
1067
1098
  def inline_modules
1068
1099
  (alternatives.map {|alt| alt.inline_modules }).flatten
1069
1100
  end
1101
+
1102
+ def inline_module
1103
+ nil
1104
+ end
1070
1105
  end
1071
1106
 
1072
1107
  def _nt_choice
@@ -1099,7 +1134,7 @@ module Treetop
1099
1134
  r6 = true
1100
1135
  @index += match_len
1101
1136
  else
1102
- terminal_parse_failure('/')
1137
+ terminal_parse_failure('\'/\'')
1103
1138
  r6 = nil
1104
1139
  end
1105
1140
  s3 << r6
@@ -1171,12 +1206,20 @@ module Treetop
1171
1206
  sequence_body.tail
1172
1207
  end
1173
1208
 
1209
+ def parent_modules
1210
+ node_class_declarations.inline_modules
1211
+ end
1212
+
1174
1213
  def inline_modules
1175
1214
  (sequence_elements.map {|elt| elt.inline_modules}).flatten +
1176
1215
  [sequence_element_accessor_module] +
1177
- node_class_declarations.inline_modules
1216
+ parent_modules
1178
1217
  end
1179
1218
 
1219
+ def inline_module
1220
+ node_class_declarations.inline_module
1221
+ end
1222
+
1180
1223
  def inline_module_name
1181
1224
  node_class_declarations.inline_module_name
1182
1225
  end
@@ -1354,6 +1397,7 @@ module Treetop
1354
1397
 
1355
1398
  r0 = _nt_labeled_sequence_primary
1356
1399
  r0.extend(LabeledExpressionSequenceBody0)
1400
+ r0.extend(LabeledExpressionSequenceBody0)
1357
1401
 
1358
1402
  node_cache[:labeled_expression_sequence_body][start_index] = r0
1359
1403
 
@@ -1411,10 +1455,18 @@ module Treetop
1411
1455
  atomic
1412
1456
  end
1413
1457
 
1458
+ def parent_modules
1459
+ []
1460
+ end
1461
+
1414
1462
  def inline_modules
1415
1463
  atomic.inline_modules
1416
1464
  end
1417
1465
 
1466
+ def inline_module
1467
+ atomic.inline_module
1468
+ end
1469
+
1418
1470
  def inline_module_name
1419
1471
  nil
1420
1472
  end
@@ -1425,7 +1477,7 @@ module Treetop
1425
1477
  elements[0]
1426
1478
  end
1427
1479
 
1428
- def predicate_block
1480
+ def atomic
1429
1481
  elements[2]
1430
1482
  end
1431
1483
  end
@@ -1435,11 +1487,17 @@ module Treetop
1435
1487
  prefix.compile(address, builder, self)
1436
1488
  end
1437
1489
  def prefixed_expression
1438
- predicate_block
1490
+ atomic
1439
1491
  end
1492
+ def parent_modules
1493
+ []
1494
+ end
1440
1495
  def inline_modules
1441
1496
  []
1442
1497
  end
1498
+ def inline_module
1499
+ nil
1500
+ end
1443
1501
  end
1444
1502
 
1445
1503
  module Primary4
@@ -1458,6 +1516,9 @@ module Treetop
1458
1516
 
1459
1517
  module Primary5
1460
1518
  def compile(address, builder, parent_expression=nil)
1519
+ if node_class_declarations.inline_module && atomic.inline_module
1520
+ STDERR.puts "Extraneous module ignored after suffix: #{input[interval].inspect}"
1521
+ end
1461
1522
  suffix.compile(address, builder, self)
1462
1523
  end
1463
1524
 
@@ -1469,10 +1530,18 @@ module Treetop
1469
1530
  node_class_declarations.node_class_name
1470
1531
  end
1471
1532
 
1533
+ def parent_modules
1534
+ node_class_declarations.inline_modules
1535
+ end
1536
+
1472
1537
  def inline_modules
1473
- atomic.inline_modules + node_class_declarations.inline_modules
1538
+ atomic.inline_modules + parent_modules
1474
1539
  end
1475
1540
 
1541
+ def inline_module
1542
+ node_class_declarations.inline_module
1543
+ end
1544
+
1476
1545
  def inline_module_name
1477
1546
  node_class_declarations.inline_module_name
1478
1547
  end
@@ -1490,6 +1559,9 @@ module Treetop
1490
1559
 
1491
1560
  module Primary7
1492
1561
  def compile(address, builder, parent_expression=nil)
1562
+ if node_class_declarations.inline_module && atomic.inline_module
1563
+ STDERR.puts "Extraneous module ignored with nested atomic: #{input[interval].inspect}"
1564
+ end
1493
1565
  atomic.compile(address, builder, self)
1494
1566
  end
1495
1567
 
@@ -1497,10 +1569,18 @@ module Treetop
1497
1569
  node_class_declarations.node_class_name
1498
1570
  end
1499
1571
 
1572
+ def parent_modules
1573
+ node_class_declarations.inline_modules
1574
+ end
1575
+
1500
1576
  def inline_modules
1501
- atomic.inline_modules + node_class_declarations.inline_modules
1577
+ atomic.inline_modules + parent_modules
1502
1578
  end
1503
1579
 
1580
+ def inline_module
1581
+ node_class_declarations.inline_module
1582
+ end
1583
+
1504
1584
  def inline_module_name
1505
1585
  node_class_declarations.inline_module_name
1506
1586
  end
@@ -1666,6 +1746,10 @@ module Treetop
1666
1746
  sequence_primary.compile(lexical_address, builder)
1667
1747
  end
1668
1748
 
1749
+ def parent_modules
1750
+ []
1751
+ end
1752
+
1669
1753
  def inline_modules
1670
1754
  sequence_primary.inline_modules
1671
1755
  end
@@ -1722,6 +1806,10 @@ module Treetop
1722
1806
  sequence_primary.compile(lexical_address, builder)
1723
1807
  end
1724
1808
 
1809
+ def parent_modules
1810
+ []
1811
+ end
1812
+
1725
1813
  def inline_modules
1726
1814
  sequence_primary.inline_modules
1727
1815
  end
@@ -1856,7 +1944,7 @@ module Treetop
1856
1944
  r5 = true
1857
1945
  @index += match_len
1858
1946
  else
1859
- terminal_parse_failure(':')
1947
+ terminal_parse_failure('\':\'')
1860
1948
  r5 = nil
1861
1949
  end
1862
1950
  s0 << r5
@@ -1897,7 +1985,7 @@ module Treetop
1897
1985
  r0.extend(NullLabel0)
1898
1986
  @index += match_len
1899
1987
  else
1900
- terminal_parse_failure('')
1988
+ terminal_parse_failure('\'\'')
1901
1989
  r0 = nil
1902
1990
  end
1903
1991
 
@@ -1925,6 +2013,10 @@ module Treetop
1925
2013
  elements[1]
1926
2014
  end
1927
2015
 
2016
+ def parent_modules
2017
+ []
2018
+ end
2019
+
1928
2020
  def inline_modules
1929
2021
  atomic.inline_modules
1930
2022
  end
@@ -1939,7 +2031,7 @@ module Treetop
1939
2031
  elements[0]
1940
2032
  end
1941
2033
 
1942
- def predicate_block
2034
+ def atomic
1943
2035
  elements[2]
1944
2036
  end
1945
2037
  end
@@ -1949,8 +2041,11 @@ module Treetop
1949
2041
  prefix.compile(address, builder, self)
1950
2042
  end
1951
2043
  def prefixed_expression
1952
- predicate_block
2044
+ atomic
1953
2045
  end
2046
+ def parent_modules
2047
+ []
2048
+ end
1954
2049
  def inline_modules
1955
2050
  []
1956
2051
  end
@@ -1975,6 +2070,10 @@ module Treetop
1975
2070
  nil
1976
2071
  end
1977
2072
 
2073
+ def parent_modules
2074
+ []
2075
+ end
2076
+
1978
2077
  def inline_modules
1979
2078
  atomic.inline_modules
1980
2079
  end
@@ -2126,7 +2225,7 @@ module Treetop
2126
2225
  r0 = instantiate_node(Optional,input, index...(index + match_len))
2127
2226
  @index += match_len
2128
2227
  else
2129
- terminal_parse_failure('?')
2228
+ terminal_parse_failure('\'?\'')
2130
2229
  r0 = nil
2131
2230
  end
2132
2231
 
@@ -2211,7 +2310,7 @@ module Treetop
2211
2310
  r1 = instantiate_node(OneOrMore,input, index...(index + match_len))
2212
2311
  @index += match_len
2213
2312
  else
2214
- terminal_parse_failure('+')
2313
+ terminal_parse_failure('\'+\'')
2215
2314
  r1 = nil
2216
2315
  end
2217
2316
  if r1
@@ -2222,7 +2321,7 @@ module Treetop
2222
2321
  r2 = instantiate_node(ZeroOrMore,input, index...(index + match_len))
2223
2322
  @index += match_len
2224
2323
  else
2225
- terminal_parse_failure('*')
2324
+ terminal_parse_failure('\'*\'')
2226
2325
  r2 = nil
2227
2326
  end
2228
2327
  if r2
@@ -2281,6 +2380,7 @@ module Treetop
2281
2380
  r4 = true
2282
2381
  @index += 1
2283
2382
  else
2383
+ terminal_parse_failure('[0-9]')
2284
2384
  r4 = nil
2285
2385
  end
2286
2386
  if r4
@@ -2296,7 +2396,7 @@ module Treetop
2296
2396
  r5 = instantiate_node(SyntaxNode,input, index...(index + match_len))
2297
2397
  @index += match_len
2298
2398
  else
2299
- terminal_parse_failure('..')
2399
+ terminal_parse_failure('\'..\'')
2300
2400
  r5 = nil
2301
2401
  end
2302
2402
  s0 << r5
@@ -2307,6 +2407,7 @@ module Treetop
2307
2407
  r7 = true
2308
2408
  @index += 1
2309
2409
  else
2410
+ terminal_parse_failure('[0-9]')
2310
2411
  r7 = nil
2311
2412
  end
2312
2413
  if r7
@@ -2349,7 +2450,7 @@ module Treetop
2349
2450
  r1 = instantiate_node(AndPredicate,input, index...(index + match_len))
2350
2451
  @index += match_len
2351
2452
  else
2352
- terminal_parse_failure('&')
2453
+ terminal_parse_failure('\'&\'')
2353
2454
  r1 = nil
2354
2455
  end
2355
2456
  if r1
@@ -2360,7 +2461,7 @@ module Treetop
2360
2461
  r2 = instantiate_node(NotPredicate,input, index...(index + match_len))
2361
2462
  @index += match_len
2362
2463
  else
2363
- terminal_parse_failure('!')
2464
+ terminal_parse_failure('\'!\'')
2364
2465
  r2 = nil
2365
2466
  end
2366
2467
  if r2
@@ -2371,7 +2472,7 @@ module Treetop
2371
2472
  r3 = instantiate_node(TransientPrefix,input, index...(index + match_len))
2372
2473
  @index += match_len
2373
2474
  else
2374
- terminal_parse_failure('~')
2475
+ terminal_parse_failure('\'~\'')
2375
2476
  r3 = nil
2376
2477
  end
2377
2478
  if r3
@@ -2435,9 +2536,15 @@ module Treetop
2435
2536
  end
2436
2537
 
2437
2538
  module ParenthesizedExpression1
2539
+ def parent_modules
2540
+ []
2541
+ end
2438
2542
  def inline_modules
2439
2543
  parsing_expression.inline_modules
2440
2544
  end
2545
+ def inline_module
2546
+ parsing_expression.inline_module
2547
+ end
2441
2548
  end
2442
2549
 
2443
2550
  def _nt_parenthesized_expression
@@ -2456,7 +2563,7 @@ module Treetop
2456
2563
  r1 = true
2457
2564
  @index += match_len
2458
2565
  else
2459
- terminal_parse_failure('(')
2566
+ terminal_parse_failure('\'(\'')
2460
2567
  r1 = nil
2461
2568
  end
2462
2569
  s0 << r1
@@ -2484,7 +2591,7 @@ module Treetop
2484
2591
  r7 = true
2485
2592
  @index += match_len
2486
2593
  else
2487
- terminal_parse_failure(')')
2594
+ terminal_parse_failure('\')\'')
2488
2595
  r7 = nil
2489
2596
  end
2490
2597
  s0 << r7
@@ -2531,6 +2638,7 @@ module Treetop
2531
2638
  i1 = index
2532
2639
  r2 = _nt_keyword_inside_grammar
2533
2640
  if r2
2641
+ @index = i1
2534
2642
  r1 = nil
2535
2643
  else
2536
2644
  @index = i1
@@ -2665,6 +2773,7 @@ module Treetop
2665
2773
  r5 = true
2666
2774
  @index += 1
2667
2775
  else
2776
+ terminal_parse_failure('[ir]')
2668
2777
  r5 = nil
2669
2778
  end
2670
2779
  if r5
@@ -2716,7 +2825,7 @@ module Treetop
2716
2825
  r1 = true
2717
2826
  @index += match_len
2718
2827
  else
2719
- terminal_parse_failure('"')
2828
+ terminal_parse_failure('\'"\'')
2720
2829
  r1 = nil
2721
2830
  end
2722
2831
  s0 << r1
@@ -2729,12 +2838,15 @@ module Treetop
2729
2838
  r5 = true
2730
2839
  @index += match_len
2731
2840
  else
2732
- terminal_parse_failure('"')
2841
+ terminal_parse_failure('\'"\'')
2733
2842
  r5 = nil
2734
2843
  end
2735
2844
  if r5
2845
+ @index = i4
2736
2846
  r4 = nil
2847
+ terminal_parse_failure('\'"\'', true)
2737
2848
  else
2849
+ @terminal_failures.pop
2738
2850
  @index = i4
2739
2851
  r4 = instantiate_node(SyntaxNode,input, index...index)
2740
2852
  end
@@ -2745,7 +2857,7 @@ module Treetop
2745
2857
  r7 = instantiate_node(SyntaxNode,input, index...(index + match_len))
2746
2858
  @index += match_len
2747
2859
  else
2748
- terminal_parse_failure("\\\\")
2860
+ terminal_parse_failure('"\\\\\\\\"')
2749
2861
  r7 = nil
2750
2862
  end
2751
2863
  if r7
@@ -2756,7 +2868,7 @@ module Treetop
2756
2868
  r8 = instantiate_node(SyntaxNode,input, index...(index + match_len))
2757
2869
  @index += match_len
2758
2870
  else
2759
- terminal_parse_failure('\"')
2871
+ terminal_parse_failure('\'\\"\'')
2760
2872
  r8 = nil
2761
2873
  end
2762
2874
  if r8
@@ -2801,7 +2913,7 @@ module Treetop
2801
2913
  r10 = true
2802
2914
  @index += match_len
2803
2915
  else
2804
- terminal_parse_failure('"')
2916
+ terminal_parse_failure('\'"\'')
2805
2917
  r10 = nil
2806
2918
  end
2807
2919
  s0 << r10
@@ -2846,7 +2958,7 @@ module Treetop
2846
2958
  r1 = true
2847
2959
  @index += match_len
2848
2960
  else
2849
- terminal_parse_failure("'")
2961
+ terminal_parse_failure('"\'"')
2850
2962
  r1 = nil
2851
2963
  end
2852
2964
  s0 << r1
@@ -2859,12 +2971,15 @@ module Treetop
2859
2971
  r5 = true
2860
2972
  @index += match_len
2861
2973
  else
2862
- terminal_parse_failure("'")
2974
+ terminal_parse_failure('"\'"')
2863
2975
  r5 = nil
2864
2976
  end
2865
2977
  if r5
2978
+ @index = i4
2866
2979
  r4 = nil
2980
+ terminal_parse_failure('"\'"', true)
2867
2981
  else
2982
+ @terminal_failures.pop
2868
2983
  @index = i4
2869
2984
  r4 = instantiate_node(SyntaxNode,input, index...index)
2870
2985
  end
@@ -2875,7 +2990,7 @@ module Treetop
2875
2990
  r7 = instantiate_node(SyntaxNode,input, index...(index + match_len))
2876
2991
  @index += match_len
2877
2992
  else
2878
- terminal_parse_failure("\\\\")
2993
+ terminal_parse_failure('"\\\\\\\\"')
2879
2994
  r7 = nil
2880
2995
  end
2881
2996
  if r7
@@ -2886,7 +3001,7 @@ module Treetop
2886
3001
  r8 = instantiate_node(SyntaxNode,input, index...(index + match_len))
2887
3002
  @index += match_len
2888
3003
  else
2889
- terminal_parse_failure("\\'")
3004
+ terminal_parse_failure('"\\\\\'"')
2890
3005
  r8 = nil
2891
3006
  end
2892
3007
  if r8
@@ -2931,7 +3046,7 @@ module Treetop
2931
3046
  r10 = true
2932
3047
  @index += match_len
2933
3048
  else
2934
- terminal_parse_failure("'")
3049
+ terminal_parse_failure('"\'"')
2935
3050
  r10 = nil
2936
3051
  end
2937
3052
  s0 << r10
@@ -2988,7 +3103,7 @@ module Treetop
2988
3103
  r1 = true
2989
3104
  @index += match_len
2990
3105
  else
2991
- terminal_parse_failure('[')
3106
+ terminal_parse_failure('\'[\'')
2992
3107
  r1 = nil
2993
3108
  end
2994
3109
  s0 << r1
@@ -3001,12 +3116,15 @@ module Treetop
3001
3116
  r5 = true
3002
3117
  @index += match_len
3003
3118
  else
3004
- terminal_parse_failure(']')
3119
+ terminal_parse_failure('\']\'')
3005
3120
  r5 = nil
3006
3121
  end
3007
3122
  if r5
3123
+ @index = i4
3008
3124
  r4 = nil
3125
+ terminal_parse_failure('\']\'', true)
3009
3126
  else
3127
+ @terminal_failures.pop
3010
3128
  @index = i4
3011
3129
  r4 = instantiate_node(SyntaxNode,input, index...index)
3012
3130
  end
@@ -3018,7 +3136,7 @@ module Treetop
3018
3136
  r8 = true
3019
3137
  @index += match_len
3020
3138
  else
3021
- terminal_parse_failure('\\')
3139
+ terminal_parse_failure('\'\\\\\'')
3022
3140
  r8 = nil
3023
3141
  end
3024
3142
  s7 << r8
@@ -3054,12 +3172,15 @@ module Treetop
3054
3172
  r13 = true
3055
3173
  @index += match_len
3056
3174
  else
3057
- terminal_parse_failure('\\')
3175
+ terminal_parse_failure('\'\\\\\'')
3058
3176
  r13 = nil
3059
3177
  end
3060
3178
  if r13
3179
+ @index = i12
3061
3180
  r12 = nil
3181
+ terminal_parse_failure('\'\\\\\'', true)
3062
3182
  else
3183
+ @terminal_failures.pop
3063
3184
  @index = i12
3064
3185
  r12 = instantiate_node(SyntaxNode,input, index...index)
3065
3186
  end
@@ -3117,7 +3238,7 @@ module Treetop
3117
3238
  r15 = true
3118
3239
  @index += match_len
3119
3240
  else
3120
- terminal_parse_failure(']')
3241
+ terminal_parse_failure('\']\'')
3121
3242
  r15 = nil
3122
3243
  end
3123
3244
  s0 << r15
@@ -3156,7 +3277,7 @@ module Treetop
3156
3277
  r1 = instantiate_node(SyntaxNode,input, index...(index + match_len))
3157
3278
  @index += match_len
3158
3279
  else
3159
- terminal_parse_failure('[:')
3280
+ terminal_parse_failure('\'[:\'')
3160
3281
  r1 = nil
3161
3282
  end
3162
3283
  s0 << r1
@@ -3165,7 +3286,7 @@ module Treetop
3165
3286
  r3 = true
3166
3287
  @index += match_len
3167
3288
  else
3168
- terminal_parse_failure('^')
3289
+ terminal_parse_failure('\'^\'')
3169
3290
  r3 = nil
3170
3291
  end
3171
3292
  if r3
@@ -3180,7 +3301,7 @@ module Treetop
3180
3301
  r5 = instantiate_node(SyntaxNode,input, index...(index + match_len))
3181
3302
  @index += match_len
3182
3303
  else
3183
- terminal_parse_failure('alnum')
3304
+ terminal_parse_failure('\'alnum\'')
3184
3305
  r5 = nil
3185
3306
  end
3186
3307
  if r5
@@ -3191,7 +3312,7 @@ module Treetop
3191
3312
  r6 = instantiate_node(SyntaxNode,input, index...(index + match_len))
3192
3313
  @index += match_len
3193
3314
  else
3194
- terminal_parse_failure('alpha')
3315
+ terminal_parse_failure('\'alpha\'')
3195
3316
  r6 = nil
3196
3317
  end
3197
3318
  if r6
@@ -3202,7 +3323,7 @@ module Treetop
3202
3323
  r7 = instantiate_node(SyntaxNode,input, index...(index + match_len))
3203
3324
  @index += match_len
3204
3325
  else
3205
- terminal_parse_failure('blank')
3326
+ terminal_parse_failure('\'blank\'')
3206
3327
  r7 = nil
3207
3328
  end
3208
3329
  if r7
@@ -3213,7 +3334,7 @@ module Treetop
3213
3334
  r8 = instantiate_node(SyntaxNode,input, index...(index + match_len))
3214
3335
  @index += match_len
3215
3336
  else
3216
- terminal_parse_failure('cntrl')
3337
+ terminal_parse_failure('\'cntrl\'')
3217
3338
  r8 = nil
3218
3339
  end
3219
3340
  if r8
@@ -3224,7 +3345,7 @@ module Treetop
3224
3345
  r9 = instantiate_node(SyntaxNode,input, index...(index + match_len))
3225
3346
  @index += match_len
3226
3347
  else
3227
- terminal_parse_failure('digit')
3348
+ terminal_parse_failure('\'digit\'')
3228
3349
  r9 = nil
3229
3350
  end
3230
3351
  if r9
@@ -3235,7 +3356,7 @@ module Treetop
3235
3356
  r10 = instantiate_node(SyntaxNode,input, index...(index + match_len))
3236
3357
  @index += match_len
3237
3358
  else
3238
- terminal_parse_failure('graph')
3359
+ terminal_parse_failure('\'graph\'')
3239
3360
  r10 = nil
3240
3361
  end
3241
3362
  if r10
@@ -3246,7 +3367,7 @@ module Treetop
3246
3367
  r11 = instantiate_node(SyntaxNode,input, index...(index + match_len))
3247
3368
  @index += match_len
3248
3369
  else
3249
- terminal_parse_failure('lower')
3370
+ terminal_parse_failure('\'lower\'')
3250
3371
  r11 = nil
3251
3372
  end
3252
3373
  if r11
@@ -3257,7 +3378,7 @@ module Treetop
3257
3378
  r12 = instantiate_node(SyntaxNode,input, index...(index + match_len))
3258
3379
  @index += match_len
3259
3380
  else
3260
- terminal_parse_failure('print')
3381
+ terminal_parse_failure('\'print\'')
3261
3382
  r12 = nil
3262
3383
  end
3263
3384
  if r12
@@ -3268,7 +3389,7 @@ module Treetop
3268
3389
  r13 = instantiate_node(SyntaxNode,input, index...(index + match_len))
3269
3390
  @index += match_len
3270
3391
  else
3271
- terminal_parse_failure('punct')
3392
+ terminal_parse_failure('\'punct\'')
3272
3393
  r13 = nil
3273
3394
  end
3274
3395
  if r13
@@ -3279,7 +3400,7 @@ module Treetop
3279
3400
  r14 = instantiate_node(SyntaxNode,input, index...(index + match_len))
3280
3401
  @index += match_len
3281
3402
  else
3282
- terminal_parse_failure('space')
3403
+ terminal_parse_failure('\'space\'')
3283
3404
  r14 = nil
3284
3405
  end
3285
3406
  if r14
@@ -3290,7 +3411,7 @@ module Treetop
3290
3411
  r15 = instantiate_node(SyntaxNode,input, index...(index + match_len))
3291
3412
  @index += match_len
3292
3413
  else
3293
- terminal_parse_failure('upper')
3414
+ terminal_parse_failure('\'upper\'')
3294
3415
  r15 = nil
3295
3416
  end
3296
3417
  if r15
@@ -3301,7 +3422,7 @@ module Treetop
3301
3422
  r16 = instantiate_node(SyntaxNode,input, index...(index + match_len))
3302
3423
  @index += match_len
3303
3424
  else
3304
- terminal_parse_failure('xdigit')
3425
+ terminal_parse_failure('\'xdigit\'')
3305
3426
  r16 = nil
3306
3427
  end
3307
3428
  if r16
@@ -3312,7 +3433,7 @@ module Treetop
3312
3433
  r17 = instantiate_node(SyntaxNode,input, index...(index + match_len))
3313
3434
  @index += match_len
3314
3435
  else
3315
- terminal_parse_failure('word')
3436
+ terminal_parse_failure('\'word\'')
3316
3437
  r17 = nil
3317
3438
  end
3318
3439
  if r17
@@ -3340,7 +3461,7 @@ module Treetop
3340
3461
  r18 = instantiate_node(SyntaxNode,input, index...(index + match_len))
3341
3462
  @index += match_len
3342
3463
  else
3343
- terminal_parse_failure(':]')
3464
+ terminal_parse_failure('\':]\'')
3344
3465
  r18 = nil
3345
3466
  end
3346
3467
  s0 << r18
@@ -3375,7 +3496,7 @@ module Treetop
3375
3496
  r0 = instantiate_node(AnythingSymbol,input, index...(index + match_len))
3376
3497
  @index += match_len
3377
3498
  else
3378
- terminal_parse_failure('.')
3499
+ terminal_parse_failure('\'.\'')
3379
3500
  r0 = nil
3380
3501
  end
3381
3502
 
@@ -3426,7 +3547,7 @@ module Treetop
3426
3547
  r3 = true
3427
3548
  @index += match_len
3428
3549
  else
3429
- terminal_parse_failure('<')
3550
+ terminal_parse_failure('\'<\'')
3430
3551
  r3 = nil
3431
3552
  end
3432
3553
  s1 << r3
@@ -3439,12 +3560,15 @@ module Treetop
3439
3560
  r7 = true
3440
3561
  @index += match_len
3441
3562
  else
3442
- terminal_parse_failure('>')
3563
+ terminal_parse_failure('\'>\'')
3443
3564
  r7 = nil
3444
3565
  end
3445
3566
  if r7
3567
+ @index = i6
3446
3568
  r6 = nil
3569
+ terminal_parse_failure('\'>\'', true)
3447
3570
  else
3571
+ @terminal_failures.pop
3448
3572
  @index = i6
3449
3573
  r6 = instantiate_node(SyntaxNode,input, index...index)
3450
3574
  end
@@ -3484,7 +3608,7 @@ module Treetop
3484
3608
  r9 = true
3485
3609
  @index += match_len
3486
3610
  else
3487
- terminal_parse_failure('>')
3611
+ terminal_parse_failure('\'>\'')
3488
3612
  r9 = nil
3489
3613
  end
3490
3614
  s1 << r9
@@ -3508,7 +3632,7 @@ module Treetop
3508
3632
  r10.extend(NodeClassExpression3)
3509
3633
  @index += match_len
3510
3634
  else
3511
- terminal_parse_failure('')
3635
+ terminal_parse_failure('\'\'')
3512
3636
  r10 = nil
3513
3637
  end
3514
3638
  if r10
@@ -3536,6 +3660,9 @@ module Treetop
3536
3660
  end
3537
3661
 
3538
3662
  module TrailingInlineModule1
3663
+ def parent_modules
3664
+ []
3665
+ end
3539
3666
  def inline_modules
3540
3667
  [inline_module]
3541
3668
  end
@@ -3546,6 +3673,9 @@ module Treetop
3546
3673
  end
3547
3674
 
3548
3675
  module TrailingInlineModule2
3676
+ def parent_modules
3677
+ []
3678
+ end
3549
3679
  def inline_modules
3550
3680
  []
3551
3681
  end
@@ -3595,7 +3725,7 @@ module Treetop
3595
3725
  r4.extend(TrailingInlineModule2)
3596
3726
  @index += match_len
3597
3727
  else
3598
- terminal_parse_failure('')
3728
+ terminal_parse_failure('\'\'')
3599
3729
  r4 = nil
3600
3730
  end
3601
3731
  if r4
@@ -3634,7 +3764,7 @@ module Treetop
3634
3764
  r1 = true
3635
3765
  @index += match_len
3636
3766
  else
3637
- terminal_parse_failure('')
3767
+ terminal_parse_failure('\'\'')
3638
3768
  r1 = nil
3639
3769
  end
3640
3770
  s0 << r1
@@ -3677,7 +3807,7 @@ module Treetop
3677
3807
  r1 = true
3678
3808
  @index += match_len
3679
3809
  else
3680
- terminal_parse_failure('{')
3810
+ terminal_parse_failure('\'{\'')
3681
3811
  r1 = nil
3682
3812
  end
3683
3813
  s0 << r1
@@ -3696,11 +3826,15 @@ module Treetop
3696
3826
  r7 = true
3697
3827
  @index += 1
3698
3828
  else
3829
+ terminal_parse_failure('[{}]')
3699
3830
  r7 = nil
3700
3831
  end
3701
3832
  if r7
3833
+ @index = i6
3702
3834
  r6 = nil
3835
+ terminal_parse_failure('[{}]', true)
3703
3836
  else
3837
+ @terminal_failures.pop
3704
3838
  @index = i6
3705
3839
  r6 = instantiate_node(SyntaxNode,input, index...index)
3706
3840
  end
@@ -3743,7 +3877,7 @@ module Treetop
3743
3877
  r9 = true
3744
3878
  @index += match_len
3745
3879
  else
3746
- terminal_parse_failure('}')
3880
+ terminal_parse_failure('\'}\'')
3747
3881
  r9 = nil
3748
3882
  end
3749
3883
  s0 << r9
@@ -3782,7 +3916,7 @@ module Treetop
3782
3916
  r2 = instantiate_node(SyntaxNode,input, index...(index + match_len))
3783
3917
  @index += match_len
3784
3918
  else
3785
- terminal_parse_failure('rule')
3919
+ terminal_parse_failure('\'rule\'')
3786
3920
  r2 = nil
3787
3921
  end
3788
3922
  if r2
@@ -3793,7 +3927,7 @@ module Treetop
3793
3927
  r3 = instantiate_node(SyntaxNode,input, index...(index + match_len))
3794
3928
  @index += match_len
3795
3929
  else
3796
- terminal_parse_failure('end')
3930
+ terminal_parse_failure('\'end\'')
3797
3931
  r3 = nil
3798
3932
  end
3799
3933
  if r3
@@ -3809,6 +3943,7 @@ module Treetop
3809
3943
  i4 = index
3810
3944
  r5 = _nt_non_space_char
3811
3945
  if r5
3946
+ @index = i4
3812
3947
  r4 = nil
3813
3948
  else
3814
3949
  @index = i4
@@ -3847,6 +3982,7 @@ module Treetop
3847
3982
  i1 = index
3848
3983
  r2 = _nt_space
3849
3984
  if r2
3985
+ @index = i1
3850
3986
  r1 = nil
3851
3987
  else
3852
3988
  @index = i1
@@ -3891,6 +4027,7 @@ module Treetop
3891
4027
  r0 = instantiate_node(SyntaxNode,input, index...(index + 1))
3892
4028
  @index += 1
3893
4029
  else
4030
+ terminal_parse_failure('[A-Za-z_]')
3894
4031
  r0 = nil
3895
4032
  end
3896
4033
 
@@ -3920,6 +4057,7 @@ module Treetop
3920
4057
  r2 = true
3921
4058
  @index += 1
3922
4059
  else
4060
+ terminal_parse_failure('[0-9]')
3923
4061
  r2 = nil
3924
4062
  end
3925
4063
  if r2
@@ -4004,7 +4142,7 @@ module Treetop
4004
4142
  r1 = true
4005
4143
  @index += match_len
4006
4144
  else
4007
- terminal_parse_failure('#')
4145
+ terminal_parse_failure('\'#\'')
4008
4146
  r1 = nil
4009
4147
  end
4010
4148
  s0 << r1
@@ -4017,12 +4155,15 @@ module Treetop
4017
4155
  r5 = true
4018
4156
  @index += match_len
4019
4157
  else
4020
- terminal_parse_failure("\n")
4158
+ terminal_parse_failure('"\\n"')
4021
4159
  r5 = nil
4022
4160
  end
4023
4161
  if r5
4162
+ @index = i4
4024
4163
  r4 = nil
4164
+ terminal_parse_failure('"\\n"', true)
4025
4165
  else
4166
+ @terminal_failures.pop
4026
4167
  @index = i4
4027
4168
  r4 = instantiate_node(SyntaxNode,input, index...index)
4028
4169
  end
@@ -4081,6 +4222,7 @@ module Treetop
4081
4222
  r0 = instantiate_node(SyntaxNode,input, index...(index + 1))
4082
4223
  @index += 1
4083
4224
  else
4225
+ terminal_parse_failure('[ \\t\\n\\r]')
4084
4226
  r0 = nil
4085
4227
  end
4086
4228