bel_parser 1.0.8 → 1.1.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (112) hide show
  1. checksums.yaml +4 -4
  2. data/.gemspec +12 -2
  3. data/VERSION +1 -1
  4. data/bin/bel2_compatibility +12 -9
  5. data/bin/bel2_upgrade +18 -6
  6. data/bin/bel2_validator +6 -3
  7. data/bin/bel_script_reader +1 -0
  8. data/lib/bel_parser/completion.rb +984 -0
  9. data/lib/bel_parser/language/apply_namespace_encoding.rb +14 -3
  10. data/lib/bel_parser/language/expression_validator.rb +1 -2
  11. data/lib/bel_parser/language/function.rb +4 -0
  12. data/lib/bel_parser/language/relationship.rb +4 -0
  13. data/lib/bel_parser/language/semantics/function_deprecation.rb +1 -0
  14. data/lib/bel_parser/language/semantics/list_function_subject.rb +2 -0
  15. data/lib/bel_parser/language/semantics/multiple_subject_object.rb +4 -1
  16. data/lib/bel_parser/language/semantics/nested_statement_without_object.rb +43 -0
  17. data/lib/bel_parser/language/semantics/non_object_list.rb +3 -0
  18. data/lib/bel_parser/language/semantics/relationship_not_listable.rb +2 -0
  19. data/lib/bel_parser/language/semantics/signature_mapping.rb +2 -0
  20. data/lib/bel_parser/language/semantics_ast.rb +0 -7
  21. data/lib/bel_parser/language/syntax/invalid_function.rb +6 -1
  22. data/lib/bel_parser/language/syntax/invalid_relationship.rb +1 -0
  23. data/lib/bel_parser/language/version1_0/relationships/acts_in.rb +9 -9
  24. data/lib/bel_parser/language/version1_0/relationships/analogous.rb +6 -4
  25. data/lib/bel_parser/language/version1_0/relationships/association.rb +8 -7
  26. data/lib/bel_parser/language/version1_0/relationships/biomarker_for.rb +6 -5
  27. data/lib/bel_parser/language/version1_0/relationships/causes_no_change.rb +8 -7
  28. data/lib/bel_parser/language/version1_0/relationships/decreases.rb +13 -12
  29. data/lib/bel_parser/language/version1_0/relationships/directly_decreases.rb +8 -6
  30. data/lib/bel_parser/language/version1_0/relationships/directly_increases.rb +8 -6
  31. data/lib/bel_parser/language/version1_0/relationships/has_component.rb +14 -14
  32. data/lib/bel_parser/language/version1_0/relationships/has_components.rb +12 -11
  33. data/lib/bel_parser/language/version1_0/relationships/has_member.rb +10 -8
  34. data/lib/bel_parser/language/version1_0/relationships/has_members.rb +12 -11
  35. data/lib/bel_parser/language/version1_0/relationships/has_modification.rb +9 -7
  36. data/lib/bel_parser/language/version1_0/relationships/has_product.rb +10 -8
  37. data/lib/bel_parser/language/version1_0/relationships/has_variant.rb +9 -7
  38. data/lib/bel_parser/language/version1_0/relationships/includes.rb +11 -10
  39. data/lib/bel_parser/language/version1_0/relationships/increases.rb +12 -13
  40. data/lib/bel_parser/language/version1_0/relationships/is_a.rb +10 -8
  41. data/lib/bel_parser/language/version1_0/relationships/negative_correlation.rb +9 -7
  42. data/lib/bel_parser/language/version1_0/relationships/orthologous.rb +9 -8
  43. data/lib/bel_parser/language/version1_0/relationships/positive_correlation.rb +8 -5
  44. data/lib/bel_parser/language/version1_0/relationships/prognostic_biomarker_for.rb +8 -6
  45. data/lib/bel_parser/language/version1_0/relationships/rate_limiting_step_of.rb +10 -9
  46. data/lib/bel_parser/language/version1_0/relationships/reactant_in.rb +10 -8
  47. data/lib/bel_parser/language/version1_0/relationships/sub_process_of.rb +13 -12
  48. data/lib/bel_parser/language/version1_0/relationships/transcribed_to.rb +8 -7
  49. data/lib/bel_parser/language/version1_0/relationships/translated_to.rb +9 -7
  50. data/lib/bel_parser/language/version1_0/relationships/translocates.rb +10 -9
  51. data/lib/bel_parser/language/version2_0/functions/protein_modification.rb +1 -2
  52. data/lib/bel_parser/language/version2_0/functions/translocation.rb +1 -2
  53. data/lib/bel_parser/language/version2_0/functions/variant.rb +1 -2
  54. data/lib/bel_parser/language/version2_0/relationships/acts_in.rb +10 -9
  55. data/lib/bel_parser/language/version2_0/relationships/biomarker_for.rb +7 -5
  56. data/lib/bel_parser/language/version2_0/relationships/causes_no_change.rb +9 -7
  57. data/lib/bel_parser/language/version2_0/relationships/decreases.rb +13 -12
  58. data/lib/bel_parser/language/version2_0/relationships/directly_decreases.rb +8 -6
  59. data/lib/bel_parser/language/version2_0/relationships/directly_increases.rb +8 -6
  60. data/lib/bel_parser/language/version2_0/relationships/has_component.rb +15 -14
  61. data/lib/bel_parser/language/version2_0/relationships/has_components.rb +12 -11
  62. data/lib/bel_parser/language/version2_0/relationships/has_member.rb +9 -8
  63. data/lib/bel_parser/language/version2_0/relationships/has_members.rb +12 -11
  64. data/lib/bel_parser/language/version2_0/relationships/has_modification.rb +9 -7
  65. data/lib/bel_parser/language/version2_0/relationships/has_product.rb +10 -8
  66. data/lib/bel_parser/language/version2_0/relationships/has_variant.rb +9 -7
  67. data/lib/bel_parser/language/version2_0/relationships/includes.rb +11 -10
  68. data/lib/bel_parser/language/version2_0/relationships/increases.rb +13 -12
  69. data/lib/bel_parser/language/version2_0/relationships/is_a.rb +10 -8
  70. data/lib/bel_parser/language/version2_0/relationships/negative_correlation.rb +9 -7
  71. data/lib/bel_parser/language/version2_0/relationships/orthologous.rb +10 -8
  72. data/lib/bel_parser/language/version2_0/relationships/positive_correlation.rb +7 -5
  73. data/lib/bel_parser/language/version2_0/relationships/prognostic_biomarker_for.rb +8 -6
  74. data/lib/bel_parser/language/version2_0/relationships/rate_limiting_step_of.rb +10 -9
  75. data/lib/bel_parser/language/version2_0/relationships/reactant_in.rb +10 -8
  76. data/lib/bel_parser/language/version2_0/relationships/regulates.rb +9 -8
  77. data/lib/bel_parser/language/version2_0/relationships/sub_process_of.rb +13 -12
  78. data/lib/bel_parser/language/version2_0/relationships/transcribed_to.rb +8 -7
  79. data/lib/bel_parser/language/version2_0/relationships/translated_to.rb +9 -7
  80. data/lib/bel_parser/language/version2_0/relationships/translocates.rb +10 -9
  81. data/lib/bel_parser/mixin/levenshtein.rb +20 -0
  82. data/lib/bel_parser/parsers/ast/node.rb +49 -2
  83. data/lib/bel_parser/parsers/bel_script/define_annotation.rb +156 -156
  84. data/lib/bel_parser/parsers/bel_script/define_namespace.rb +60 -60
  85. data/lib/bel_parser/parsers/bel_script/set.rb +200 -200
  86. data/lib/bel_parser/parsers/bel_script/set_document.rb +188 -188
  87. data/lib/bel_parser/parsers/bel_script/unset.rb +14 -14
  88. data/lib/bel_parser/parsers/common/common.rl +1 -0
  89. data/lib/bel_parser/parsers/common/function.rb +8 -8
  90. data/lib/bel_parser/parsers/common/function.rl +6 -6
  91. data/lib/bel_parser/parsers/common/identifier.rb +3 -3
  92. data/lib/bel_parser/parsers/common/identifier.rl +4 -4
  93. data/lib/bel_parser/parsers/common/list.rb +78 -78
  94. data/lib/bel_parser/parsers/common/multi_identifier.rb +275 -0
  95. data/lib/bel_parser/parsers/common/multi_identifier.rl +141 -0
  96. data/lib/bel_parser/parsers/common/string.rb +6 -6
  97. data/lib/bel_parser/parsers/common/string.rl +4 -4
  98. data/lib/bel_parser/parsers/common.rb +1 -0
  99. data/lib/bel_parser/parsers/expression/nested_statement.rb +30180 -29055
  100. data/lib/bel_parser/parsers/expression/observed_term.rb +1456 -1099
  101. data/lib/bel_parser/parsers/expression/parameter.rb +192 -111
  102. data/lib/bel_parser/parsers/expression/parameter.rl +6 -3
  103. data/lib/bel_parser/parsers/expression/relationship.rb +43 -19
  104. data/lib/bel_parser/parsers/expression/relationship.rl +1 -0
  105. data/lib/bel_parser/parsers/expression/simple_statement.rb +17805 -17093
  106. data/lib/bel_parser/parsers/expression/statement_autocomplete.rb +1035 -0
  107. data/lib/bel_parser/parsers/expression/statement_autocomplete.rl +736 -0
  108. data/lib/bel_parser/parsers/expression/term.rb +960 -705
  109. data/lib/bel_parser/parsers/serializer.rb +8 -4
  110. data/lib/bel_parser/version.rb +33 -0
  111. data/lib/bel_parser.rb +3 -0
  112. metadata +25 -3
@@ -313,7 +313,7 @@ begin
313
313
  id_end = p
314
314
  chars = data[id_start...id_end]
315
315
  completed = !chars.empty?
316
- ast_node = identifier(utf8_string(chars), complete: completed)
316
+ ast_node = identifier(utf8_string(chars), complete: completed, character_range: [id_start, id_end])
317
317
  @buffers[:ident] = ast_node
318
318
  end
319
319
  when 17 then
@@ -322,7 +322,7 @@ begin
322
322
  trace('IDENTIFIER an_ident_err')
323
323
  id_end = p
324
324
  chars = data[id_start...id_end]
325
- ast_node = identifier(utf8_string(chars), complete: false)
325
+ ast_node = identifier(utf8_string(chars), complete: false, character_range: [id_start, id_end])
326
326
  @buffers[:ident] = ast_node
327
327
  end
328
328
  when 29 then
@@ -331,7 +331,7 @@ begin
331
331
  trace('IDENTIFIER ident_node_err')
332
332
  id_end = p
333
333
  chars = data[id_start...id_end]
334
- ast_node = identifier(utf8_string(chars), complete: false)
334
+ ast_node = identifier(utf8_string(chars), complete: false, character_range: [id_start, id_end])
335
335
  yield ast_node
336
336
  end
337
337
  when 7 then
@@ -347,7 +347,7 @@ begin
347
347
  trace('STRING a_string_err')
348
348
  p_end = p
349
349
  chars = data[p_start...p_end]
350
- ast_node = string(utf8_string(chars), complete: false)
350
+ ast_node = string(utf8_string(chars), complete: false, character_range: [p_start, p_end])
351
351
  @buffers[:string] = ast_node
352
352
  end
353
353
  when 11 then
@@ -356,7 +356,7 @@ begin
356
356
  trace('STRING string_node_err')
357
357
  p_end = p
358
358
  chars = data[p_start...p_end]
359
- ast_node = string(utf8_string(chars), complete: false)
359
+ ast_node = string(utf8_string(chars), complete: false, character_range: [p_start, p_end])
360
360
  yield ast_node
361
361
  end
362
362
  when 22 then
@@ -364,7 +364,7 @@ begin
364
364
 
365
365
  trace('PARAMETER add_prefix')
366
366
  ident = @buffers.delete(:ident)
367
- prefix_node = prefix(ident, complete: ident.complete)
367
+ prefix_node = prefix(ident, complete: ident.complete, character_range: ident.character_range)
368
368
  @buffers[:param_prefix] = prefix_node
369
369
  end
370
370
  when 2 then
@@ -373,7 +373,7 @@ begin
373
373
  trace('IDENTIFIER an_ident_err')
374
374
  id_end = p
375
375
  chars = data[id_start...id_end]
376
- ast_node = identifier(utf8_string(chars), complete: false)
376
+ ast_node = identifier(utf8_string(chars), complete: false, character_range: [id_start, id_end])
377
377
  @buffers[:ident] = ast_node
378
378
  end
379
379
  begin
@@ -381,7 +381,7 @@ begin
381
381
  trace('STRING a_string_err')
382
382
  p_end = p
383
383
  chars = data[p_start...p_end]
384
- ast_node = string(utf8_string(chars), complete: false)
384
+ ast_node = string(utf8_string(chars), complete: false, character_range: [p_start, p_end])
385
385
  @buffers[:string] = ast_node
386
386
  end
387
387
  when 9 then
@@ -396,7 +396,7 @@ begin
396
396
  trace('STRING string_end')
397
397
  completed = @string_opened && @string_closed
398
398
  chars = data[p_start...p_end]
399
- ast_node = string(utf8_string(chars), complete: true)
399
+ ast_node = string(utf8_string(chars), complete: true, character_range: [p_start, p_end])
400
400
  @buffers[:string] = ast_node
401
401
  end
402
402
  when 26 then
@@ -412,6 +412,7 @@ begin
412
412
  trace('PN incomplete')
413
413
  completed = false
414
414
  end
415
+ param_start = prefix_node.range_start
415
416
  else
416
417
  prefix_node = prefix(nil)
417
418
  prefix_node.complete = true
@@ -428,6 +429,8 @@ begin
428
429
  trace('VN incomplete')
429
430
  completed = false
430
431
  end
432
+ param_start ||= value_node.range_start
433
+ param_node.character_range = [param_start, value_node.range_end]
431
434
  else
432
435
  completed = false
433
436
  end
@@ -445,7 +448,7 @@ begin
445
448
 
446
449
  trace('PARAMETER add_prefix')
447
450
  ident = @buffers.delete(:ident)
448
- prefix_node = prefix(ident, complete: ident.complete)
451
+ prefix_node = prefix(ident, complete: ident.complete, character_range: ident.character_range)
449
452
  @buffers[:param_prefix] = prefix_node
450
453
  end
451
454
  begin
@@ -472,7 +475,7 @@ begin
472
475
  trace('STRING string_end')
473
476
  completed = @string_opened && @string_closed
474
477
  chars = data[p_start...p_end]
475
- ast_node = string(utf8_string(chars), complete: true)
478
+ ast_node = string(utf8_string(chars), complete: true, character_range: [p_start, p_end])
476
479
  @buffers[:string] = ast_node
477
480
  end
478
481
  when 14 then
@@ -487,7 +490,7 @@ begin
487
490
  trace('STRING string_end')
488
491
  completed = @string_opened && @string_closed
489
492
  chars = data[p_start...p_end]
490
- ast_node = string(utf8_string(chars), complete: true)
493
+ ast_node = string(utf8_string(chars), complete: true, character_range: [p_start, p_end])
491
494
  @buffers[:string] = ast_node
492
495
  end
493
496
  begin
@@ -500,7 +503,7 @@ begin
500
503
 
501
504
  trace('PARAMETER add_string_param_value')
502
505
  string_node = @buffers.delete(:string)
503
- value_node = value(string_node, complete: string_node.complete)
506
+ value_node = value(string_node, complete: string_node.complete, character_range: string_node.character_range)
504
507
  @buffers[:param_value] = value_node
505
508
  end
506
509
  begin
@@ -515,6 +518,7 @@ begin
515
518
  trace('PN incomplete')
516
519
  completed = false
517
520
  end
521
+ param_start = prefix_node.range_start
518
522
  else
519
523
  prefix_node = prefix(nil)
520
524
  prefix_node.complete = true
@@ -531,6 +535,8 @@ begin
531
535
  trace('VN incomplete')
532
536
  completed = false
533
537
  end
538
+ param_start ||= value_node.range_start
539
+ param_node.character_range = [param_start, value_node.range_end]
534
540
  else
535
541
  completed = false
536
542
  end
@@ -548,7 +554,7 @@ begin
548
554
 
549
555
  trace('PARAMETER add_prefix')
550
556
  ident = @buffers.delete(:ident)
551
- prefix_node = prefix(ident, complete: ident.complete)
557
+ prefix_node = prefix(ident, complete: ident.complete, character_range: ident.character_range)
552
558
  @buffers[:param_prefix] = prefix_node
553
559
  end
554
560
  begin
@@ -563,6 +569,7 @@ begin
563
569
  trace('PN incomplete')
564
570
  completed = false
565
571
  end
572
+ param_start = prefix_node.range_start
566
573
  else
567
574
  prefix_node = prefix(nil)
568
575
  prefix_node.complete = true
@@ -579,6 +586,8 @@ begin
579
586
  trace('VN incomplete')
580
587
  completed = false
581
588
  end
589
+ param_start ||= value_node.range_start
590
+ param_node.character_range = [param_start, value_node.range_end]
582
591
  else
583
592
  completed = false
584
593
  end
@@ -598,14 +607,14 @@ begin
598
607
  id_end = p
599
608
  chars = data[id_start...id_end]
600
609
  completed = !chars.empty?
601
- ast_node = identifier(utf8_string(chars), complete: completed)
610
+ ast_node = identifier(utf8_string(chars), complete: completed, character_range: [id_start, id_end])
602
611
  @buffers[:ident] = ast_node
603
612
  end
604
613
  begin
605
614
 
606
615
  trace('PARAMETER add_ident_param_value')
607
616
  ident = @buffers.delete(:ident)
608
- value_node = value(ident, complete: ident.complete)
617
+ value_node = value(ident, complete: ident.complete, character_range: ident.character_range)
609
618
  @buffers[:param_value] = value_node
610
619
  end
611
620
  begin
@@ -620,6 +629,7 @@ begin
620
629
  trace('PN incomplete')
621
630
  completed = false
622
631
  end
632
+ param_start = prefix_node.range_start
623
633
  else
624
634
  prefix_node = prefix(nil)
625
635
  prefix_node.complete = true
@@ -636,6 +646,8 @@ begin
636
646
  trace('VN incomplete')
637
647
  completed = false
638
648
  end
649
+ param_start ||= value_node.range_start
650
+ param_node.character_range = [param_start, value_node.range_end]
639
651
  else
640
652
  completed = false
641
653
  end
@@ -666,7 +678,7 @@ begin
666
678
  trace('STRING string_end')
667
679
  completed = @string_opened && @string_closed
668
680
  chars = data[p_start...p_end]
669
- ast_node = string(utf8_string(chars), complete: true)
681
+ ast_node = string(utf8_string(chars), complete: true, character_range: [p_start, p_end])
670
682
  @buffers[:string] = ast_node
671
683
  end
672
684
  begin
@@ -731,7 +743,7 @@ begin
731
743
  id_end = p
732
744
  chars = data[id_start...id_end]
733
745
  completed = !chars.empty?
734
- ast_node = identifier(utf8_string(chars), complete: completed)
746
+ ast_node = identifier(utf8_string(chars), complete: completed, character_range: [id_start, id_end])
735
747
  @buffers[:ident] = ast_node
736
748
  end
737
749
  begin
@@ -745,7 +757,7 @@ begin
745
757
  trace('STRING a_string_err')
746
758
  p_end = p
747
759
  chars = data[p_start...p_end]
748
- ast_node = string(utf8_string(chars), complete: false)
760
+ ast_node = string(utf8_string(chars), complete: false, character_range: [p_start, p_end])
749
761
  @buffers[:string] = ast_node
750
762
  end
751
763
  begin
@@ -780,7 +792,7 @@ begin
780
792
  trace('STRING string_node_err')
781
793
  p_end = p
782
794
  chars = data[p_start...p_end]
783
- ast_node = string(utf8_string(chars), complete: false)
795
+ ast_node = string(utf8_string(chars), complete: false, character_range: [p_start, p_end])
784
796
  yield ast_node
785
797
  end
786
798
  begin
@@ -796,7 +808,7 @@ begin
796
808
  id_end = p
797
809
  chars = data[id_start...id_end]
798
810
  completed = !chars.empty?
799
- ast_node = identifier(utf8_string(chars), complete: completed)
811
+ ast_node = identifier(utf8_string(chars), complete: completed, character_range: [id_start, id_end])
800
812
  @buffers[:ident] = ast_node
801
813
  end
802
814
  end
@@ -812,6 +824,7 @@ begin
812
824
  trace('PN incomplete')
813
825
  completed = false
814
826
  end
827
+ param_start = prefix_node.range_start
815
828
  else
816
829
  prefix_node = prefix(nil)
817
830
  prefix_node.complete = true
@@ -828,6 +841,8 @@ begin
828
841
  trace('VN incomplete')
829
842
  completed = false
830
843
  end
844
+ param_start ||= value_node.range_start
845
+ param_node.character_range = [param_start, value_node.range_end]
831
846
  else
832
847
  completed = false
833
848
  end
@@ -846,7 +861,7 @@ begin
846
861
  trace('STRING eof_string')
847
862
  p_end = p
848
863
  chars = data[p_start...p_end]
849
- ast_node = string(utf8_string(chars), complete: false)
864
+ ast_node = string(utf8_string(chars), complete: false, character_range: [p_start, p_end])
850
865
  @buffers[:string] = ast_node
851
866
  end
852
867
  begin
@@ -854,7 +869,7 @@ begin
854
869
  trace('STRING a_string_err')
855
870
  p_end = p
856
871
  chars = data[p_start...p_end]
857
- ast_node = string(utf8_string(chars), complete: false)
872
+ ast_node = string(utf8_string(chars), complete: false, character_range: [p_start, p_end])
858
873
  @buffers[:string] = ast_node
859
874
  end
860
875
  begin
@@ -889,7 +904,7 @@ begin
889
904
  trace('STRING eof_string')
890
905
  p_end = p
891
906
  chars = data[p_start...p_end]
892
- ast_node = string(utf8_string(chars), complete: false)
907
+ ast_node = string(utf8_string(chars), complete: false, character_range: [p_start, p_end])
893
908
  @buffers[:string] = ast_node
894
909
  end
895
910
  begin
@@ -897,7 +912,7 @@ begin
897
912
  trace('STRING string_node_err')
898
913
  p_end = p
899
914
  chars = data[p_start...p_end]
900
- ast_node = string(utf8_string(chars), complete: false)
915
+ ast_node = string(utf8_string(chars), complete: false, character_range: [p_start, p_end])
901
916
  yield ast_node
902
917
  end
903
918
  begin
@@ -910,7 +925,7 @@ begin
910
925
 
911
926
  trace('PARAMETER add_string_param_value')
912
927
  string_node = @buffers.delete(:string)
913
- value_node = value(string_node, complete: string_node.complete)
928
+ value_node = value(string_node, complete: string_node.complete, character_range: string_node.character_range)
914
929
  @buffers[:param_value] = value_node
915
930
  end
916
931
  begin
@@ -925,6 +940,7 @@ begin
925
940
  trace('PN incomplete')
926
941
  completed = false
927
942
  end
943
+ param_start = prefix_node.range_start
928
944
  else
929
945
  prefix_node = prefix(nil)
930
946
  prefix_node.complete = true
@@ -941,6 +957,8 @@ begin
941
957
  trace('VN incomplete')
942
958
  completed = false
943
959
  end
960
+ param_start ||= value_node.range_start
961
+ param_node.character_range = [param_start, value_node.range_end]
944
962
  else
945
963
  completed = false
946
964
  end
@@ -961,7 +979,7 @@ begin
961
979
  id_end = p
962
980
  chars = data[id_start...id_end]
963
981
  completed = !chars.empty?
964
- ast_node = identifier(utf8_string(chars), complete: completed)
982
+ ast_node = identifier(utf8_string(chars), complete: completed, character_range: [id_start, id_end])
965
983
  @buffers[:ident] = ast_node
966
984
  end
967
985
  end
@@ -970,7 +988,7 @@ begin
970
988
  trace('IDENTIFIER an_ident_err')
971
989
  id_end = p
972
990
  chars = data[id_start...id_end]
973
- ast_node = identifier(utf8_string(chars), complete: false)
991
+ ast_node = identifier(utf8_string(chars), complete: false, character_range: [id_start, id_end])
974
992
  @buffers[:ident] = ast_node
975
993
  end
976
994
  begin
@@ -978,7 +996,7 @@ begin
978
996
  trace('STRING a_string_err')
979
997
  p_end = p
980
998
  chars = data[p_start...p_end]
981
- ast_node = string(utf8_string(chars), complete: false)
999
+ ast_node = string(utf8_string(chars), complete: false, character_range: [p_start, p_end])
982
1000
  @buffers[:string] = ast_node
983
1001
  end
984
1002
  begin
@@ -1015,7 +1033,7 @@ begin
1015
1033
  id_end = p
1016
1034
  chars = data[id_start...id_end]
1017
1035
  completed = !chars.empty?
1018
- ast_node = identifier(utf8_string(chars), complete: completed)
1036
+ ast_node = identifier(utf8_string(chars), complete: completed, character_range: [id_start, id_end])
1019
1037
  @buffers[:ident] = ast_node
1020
1038
  end
1021
1039
  end
@@ -1023,7 +1041,7 @@ begin
1023
1041
 
1024
1042
  trace('PARAMETER add_prefix')
1025
1043
  ident = @buffers.delete(:ident)
1026
- prefix_node = prefix(ident, complete: ident.complete)
1044
+ prefix_node = prefix(ident, complete: ident.complete, character_range: ident.character_range)
1027
1045
  @buffers[:param_prefix] = prefix_node
1028
1046
  end
1029
1047
  begin
@@ -1038,6 +1056,7 @@ begin
1038
1056
  trace('PN incomplete')
1039
1057
  completed = false
1040
1058
  end
1059
+ param_start = prefix_node.range_start
1041
1060
  else
1042
1061
  prefix_node = prefix(nil)
1043
1062
  prefix_node.complete = true
@@ -1054,6 +1073,8 @@ begin
1054
1073
  trace('VN incomplete')
1055
1074
  completed = false
1056
1075
  end
1076
+ param_start ||= value_node.range_start
1077
+ param_node.character_range = [param_start, value_node.range_end]
1057
1078
  else
1058
1079
  completed = false
1059
1080
  end
@@ -1073,7 +1094,7 @@ begin
1073
1094
  id_end = p
1074
1095
  chars = data[id_start...id_end]
1075
1096
  completed = !chars.empty?
1076
- ast_node = identifier(utf8_string(chars), complete: completed)
1097
+ ast_node = identifier(utf8_string(chars), complete: completed, character_range: [id_start, id_end])
1077
1098
  @buffers[:ident] = ast_node
1078
1099
  end
1079
1100
  begin
@@ -1083,7 +1104,7 @@ begin
1083
1104
  id_end = p
1084
1105
  chars = data[id_start...id_end]
1085
1106
  completed = !chars.empty?
1086
- ast_node = identifier(utf8_string(chars), complete: completed)
1107
+ ast_node = identifier(utf8_string(chars), complete: completed, character_range: [id_start, id_end])
1087
1108
  @buffers[:ident] = ast_node
1088
1109
  end
1089
1110
  end
@@ -1091,7 +1112,7 @@ begin
1091
1112
 
1092
1113
  trace('PARAMETER add_ident_param_value')
1093
1114
  ident = @buffers.delete(:ident)
1094
- value_node = value(ident, complete: ident.complete)
1115
+ value_node = value(ident, complete: ident.complete, character_range: ident.character_range)
1095
1116
  @buffers[:param_value] = value_node
1096
1117
  end
1097
1118
  begin
@@ -1106,6 +1127,7 @@ begin
1106
1127
  trace('PN incomplete')
1107
1128
  completed = false
1108
1129
  end
1130
+ param_start = prefix_node.range_start
1109
1131
  else
1110
1132
  prefix_node = prefix(nil)
1111
1133
  prefix_node.complete = true
@@ -1122,6 +1144,8 @@ begin
1122
1144
  trace('VN incomplete')
1123
1145
  completed = false
1124
1146
  end
1147
+ param_start ||= value_node.range_start
1148
+ param_node.character_range = [param_start, value_node.range_end]
1125
1149
  else
1126
1150
  completed = false
1127
1151
  end
@@ -1142,7 +1166,7 @@ begin
1142
1166
  id_end = p
1143
1167
  chars = data[id_start...id_end]
1144
1168
  completed = !chars.empty?
1145
- ast_node = identifier(utf8_string(chars), complete: completed)
1169
+ ast_node = identifier(utf8_string(chars), complete: completed, character_range: [id_start, id_end])
1146
1170
  @buffers[:ident] = ast_node
1147
1171
  end
1148
1172
  end
@@ -1152,14 +1176,14 @@ begin
1152
1176
  id_end = p
1153
1177
  chars = data[id_start...id_end]
1154
1178
  completed = !chars.empty?
1155
- ast_node = identifier(utf8_string(chars), complete: completed)
1179
+ ast_node = identifier(utf8_string(chars), complete: completed, character_range: [id_start, id_end])
1156
1180
  @buffers[:ident] = ast_node
1157
1181
  end
1158
1182
  begin
1159
1183
 
1160
1184
  trace('PARAMETER add_ident_param_value')
1161
1185
  ident = @buffers.delete(:ident)
1162
- value_node = value(ident, complete: ident.complete)
1186
+ value_node = value(ident, complete: ident.complete, character_range: ident.character_range)
1163
1187
  @buffers[:param_value] = value_node
1164
1188
  end
1165
1189
  begin
@@ -1174,6 +1198,7 @@ begin
1174
1198
  trace('PN incomplete')
1175
1199
  completed = false
1176
1200
  end
1201
+ param_start = prefix_node.range_start
1177
1202
  else
1178
1203
  prefix_node = prefix(nil)
1179
1204
  prefix_node.complete = true
@@ -1190,6 +1215,8 @@ begin
1190
1215
  trace('VN incomplete')
1191
1216
  completed = false
1192
1217
  end
1218
+ param_start ||= value_node.range_start
1219
+ param_node.character_range = [param_start, value_node.range_end]
1193
1220
  else
1194
1221
  completed = false
1195
1222
  end
@@ -1523,7 +1550,7 @@ begin
1523
1550
  id_end = p
1524
1551
  chars = data[id_start...id_end]
1525
1552
  completed = !chars.empty?
1526
- ast_node = identifier(utf8_string(chars), complete: completed)
1553
+ ast_node = identifier(utf8_string(chars), complete: completed, character_range: [id_start, id_end])
1527
1554
  @buffers[:ident] = ast_node
1528
1555
  end
1529
1556
  when 17 then
@@ -1532,7 +1559,7 @@ begin
1532
1559
  trace('IDENTIFIER an_ident_err')
1533
1560
  id_end = p
1534
1561
  chars = data[id_start...id_end]
1535
- ast_node = identifier(utf8_string(chars), complete: false)
1562
+ ast_node = identifier(utf8_string(chars), complete: false, character_range: [id_start, id_end])
1536
1563
  @buffers[:ident] = ast_node
1537
1564
  end
1538
1565
  when 29 then
@@ -1541,7 +1568,7 @@ begin
1541
1568
  trace('IDENTIFIER ident_node_err')
1542
1569
  id_end = p
1543
1570
  chars = data[id_start...id_end]
1544
- ast_node = identifier(utf8_string(chars), complete: false)
1571
+ ast_node = identifier(utf8_string(chars), complete: false, character_range: [id_start, id_end])
1545
1572
  yield ast_node
1546
1573
  end
1547
1574
  when 7 then
@@ -1557,7 +1584,7 @@ begin
1557
1584
  trace('STRING a_string_err')
1558
1585
  p_end = p
1559
1586
  chars = data[p_start...p_end]
1560
- ast_node = string(utf8_string(chars), complete: false)
1587
+ ast_node = string(utf8_string(chars), complete: false, character_range: [p_start, p_end])
1561
1588
  @buffers[:string] = ast_node
1562
1589
  end
1563
1590
  when 11 then
@@ -1566,7 +1593,7 @@ begin
1566
1593
  trace('STRING string_node_err')
1567
1594
  p_end = p
1568
1595
  chars = data[p_start...p_end]
1569
- ast_node = string(utf8_string(chars), complete: false)
1596
+ ast_node = string(utf8_string(chars), complete: false, character_range: [p_start, p_end])
1570
1597
  yield ast_node
1571
1598
  end
1572
1599
  when 22 then
@@ -1574,7 +1601,7 @@ begin
1574
1601
 
1575
1602
  trace('PARAMETER add_prefix')
1576
1603
  ident = @buffers.delete(:ident)
1577
- prefix_node = prefix(ident, complete: ident.complete)
1604
+ prefix_node = prefix(ident, complete: ident.complete, character_range: ident.character_range)
1578
1605
  @buffers[:param_prefix] = prefix_node
1579
1606
  end
1580
1607
  when 2 then
@@ -1583,7 +1610,7 @@ begin
1583
1610
  trace('IDENTIFIER an_ident_err')
1584
1611
  id_end = p
1585
1612
  chars = data[id_start...id_end]
1586
- ast_node = identifier(utf8_string(chars), complete: false)
1613
+ ast_node = identifier(utf8_string(chars), complete: false, character_range: [id_start, id_end])
1587
1614
  @buffers[:ident] = ast_node
1588
1615
  end
1589
1616
  begin
@@ -1591,7 +1618,7 @@ begin
1591
1618
  trace('STRING a_string_err')
1592
1619
  p_end = p
1593
1620
  chars = data[p_start...p_end]
1594
- ast_node = string(utf8_string(chars), complete: false)
1621
+ ast_node = string(utf8_string(chars), complete: false, character_range: [p_start, p_end])
1595
1622
  @buffers[:string] = ast_node
1596
1623
  end
1597
1624
  when 9 then
@@ -1606,7 +1633,7 @@ begin
1606
1633
  trace('STRING string_end')
1607
1634
  completed = @string_opened && @string_closed
1608
1635
  chars = data[p_start...p_end]
1609
- ast_node = string(utf8_string(chars), complete: true)
1636
+ ast_node = string(utf8_string(chars), complete: true, character_range: [p_start, p_end])
1610
1637
  @buffers[:string] = ast_node
1611
1638
  end
1612
1639
  when 26 then
@@ -1622,6 +1649,7 @@ begin
1622
1649
  trace('PN incomplete')
1623
1650
  completed = false
1624
1651
  end
1652
+ param_start = prefix_node.range_start
1625
1653
  else
1626
1654
  prefix_node = prefix(nil)
1627
1655
  prefix_node.complete = true
@@ -1638,6 +1666,8 @@ begin
1638
1666
  trace('VN incomplete')
1639
1667
  completed = false
1640
1668
  end
1669
+ param_start ||= value_node.range_start
1670
+ param_node.character_range = [param_start, value_node.range_end]
1641
1671
  else
1642
1672
  completed = false
1643
1673
  end
@@ -1655,7 +1685,7 @@ begin
1655
1685
 
1656
1686
  trace('PARAMETER add_prefix')
1657
1687
  ident = @buffers.delete(:ident)
1658
- prefix_node = prefix(ident, complete: ident.complete)
1688
+ prefix_node = prefix(ident, complete: ident.complete, character_range: ident.character_range)
1659
1689
  @buffers[:param_prefix] = prefix_node
1660
1690
  end
1661
1691
  begin
@@ -1682,7 +1712,7 @@ begin
1682
1712
  trace('STRING string_end')
1683
1713
  completed = @string_opened && @string_closed
1684
1714
  chars = data[p_start...p_end]
1685
- ast_node = string(utf8_string(chars), complete: true)
1715
+ ast_node = string(utf8_string(chars), complete: true, character_range: [p_start, p_end])
1686
1716
  @buffers[:string] = ast_node
1687
1717
  end
1688
1718
  when 14 then
@@ -1697,7 +1727,7 @@ begin
1697
1727
  trace('STRING string_end')
1698
1728
  completed = @string_opened && @string_closed
1699
1729
  chars = data[p_start...p_end]
1700
- ast_node = string(utf8_string(chars), complete: true)
1730
+ ast_node = string(utf8_string(chars), complete: true, character_range: [p_start, p_end])
1701
1731
  @buffers[:string] = ast_node
1702
1732
  end
1703
1733
  begin
@@ -1710,7 +1740,7 @@ begin
1710
1740
 
1711
1741
  trace('PARAMETER add_string_param_value')
1712
1742
  string_node = @buffers.delete(:string)
1713
- value_node = value(string_node, complete: string_node.complete)
1743
+ value_node = value(string_node, complete: string_node.complete, character_range: string_node.character_range)
1714
1744
  @buffers[:param_value] = value_node
1715
1745
  end
1716
1746
  begin
@@ -1725,6 +1755,7 @@ begin
1725
1755
  trace('PN incomplete')
1726
1756
  completed = false
1727
1757
  end
1758
+ param_start = prefix_node.range_start
1728
1759
  else
1729
1760
  prefix_node = prefix(nil)
1730
1761
  prefix_node.complete = true
@@ -1741,6 +1772,8 @@ begin
1741
1772
  trace('VN incomplete')
1742
1773
  completed = false
1743
1774
  end
1775
+ param_start ||= value_node.range_start
1776
+ param_node.character_range = [param_start, value_node.range_end]
1744
1777
  else
1745
1778
  completed = false
1746
1779
  end
@@ -1758,7 +1791,7 @@ begin
1758
1791
 
1759
1792
  trace('PARAMETER add_prefix')
1760
1793
  ident = @buffers.delete(:ident)
1761
- prefix_node = prefix(ident, complete: ident.complete)
1794
+ prefix_node = prefix(ident, complete: ident.complete, character_range: ident.character_range)
1762
1795
  @buffers[:param_prefix] = prefix_node
1763
1796
  end
1764
1797
  begin
@@ -1773,6 +1806,7 @@ begin
1773
1806
  trace('PN incomplete')
1774
1807
  completed = false
1775
1808
  end
1809
+ param_start = prefix_node.range_start
1776
1810
  else
1777
1811
  prefix_node = prefix(nil)
1778
1812
  prefix_node.complete = true
@@ -1789,6 +1823,8 @@ begin
1789
1823
  trace('VN incomplete')
1790
1824
  completed = false
1791
1825
  end
1826
+ param_start ||= value_node.range_start
1827
+ param_node.character_range = [param_start, value_node.range_end]
1792
1828
  else
1793
1829
  completed = false
1794
1830
  end
@@ -1808,14 +1844,14 @@ begin
1808
1844
  id_end = p
1809
1845
  chars = data[id_start...id_end]
1810
1846
  completed = !chars.empty?
1811
- ast_node = identifier(utf8_string(chars), complete: completed)
1847
+ ast_node = identifier(utf8_string(chars), complete: completed, character_range: [id_start, id_end])
1812
1848
  @buffers[:ident] = ast_node
1813
1849
  end
1814
1850
  begin
1815
1851
 
1816
1852
  trace('PARAMETER add_ident_param_value')
1817
1853
  ident = @buffers.delete(:ident)
1818
- value_node = value(ident, complete: ident.complete)
1854
+ value_node = value(ident, complete: ident.complete, character_range: ident.character_range)
1819
1855
  @buffers[:param_value] = value_node
1820
1856
  end
1821
1857
  begin
@@ -1830,6 +1866,7 @@ begin
1830
1866
  trace('PN incomplete')
1831
1867
  completed = false
1832
1868
  end
1869
+ param_start = prefix_node.range_start
1833
1870
  else
1834
1871
  prefix_node = prefix(nil)
1835
1872
  prefix_node.complete = true
@@ -1846,6 +1883,8 @@ begin
1846
1883
  trace('VN incomplete')
1847
1884
  completed = false
1848
1885
  end
1886
+ param_start ||= value_node.range_start
1887
+ param_node.character_range = [param_start, value_node.range_end]
1849
1888
  else
1850
1889
  completed = false
1851
1890
  end
@@ -1876,7 +1915,7 @@ begin
1876
1915
  trace('STRING string_end')
1877
1916
  completed = @string_opened && @string_closed
1878
1917
  chars = data[p_start...p_end]
1879
- ast_node = string(utf8_string(chars), complete: true)
1918
+ ast_node = string(utf8_string(chars), complete: true, character_range: [p_start, p_end])
1880
1919
  @buffers[:string] = ast_node
1881
1920
  end
1882
1921
  begin
@@ -1941,7 +1980,7 @@ begin
1941
1980
  id_end = p
1942
1981
  chars = data[id_start...id_end]
1943
1982
  completed = !chars.empty?
1944
- ast_node = identifier(utf8_string(chars), complete: completed)
1983
+ ast_node = identifier(utf8_string(chars), complete: completed, character_range: [id_start, id_end])
1945
1984
  @buffers[:ident] = ast_node
1946
1985
  end
1947
1986
  begin
@@ -1955,7 +1994,7 @@ begin
1955
1994
  trace('STRING a_string_err')
1956
1995
  p_end = p
1957
1996
  chars = data[p_start...p_end]
1958
- ast_node = string(utf8_string(chars), complete: false)
1997
+ ast_node = string(utf8_string(chars), complete: false, character_range: [p_start, p_end])
1959
1998
  @buffers[:string] = ast_node
1960
1999
  end
1961
2000
  begin
@@ -1990,7 +2029,7 @@ begin
1990
2029
  trace('STRING string_node_err')
1991
2030
  p_end = p
1992
2031
  chars = data[p_start...p_end]
1993
- ast_node = string(utf8_string(chars), complete: false)
2032
+ ast_node = string(utf8_string(chars), complete: false, character_range: [p_start, p_end])
1994
2033
  yield ast_node
1995
2034
  end
1996
2035
  begin
@@ -2006,7 +2045,7 @@ begin
2006
2045
  id_end = p
2007
2046
  chars = data[id_start...id_end]
2008
2047
  completed = !chars.empty?
2009
- ast_node = identifier(utf8_string(chars), complete: completed)
2048
+ ast_node = identifier(utf8_string(chars), complete: completed, character_range: [id_start, id_end])
2010
2049
  @buffers[:ident] = ast_node
2011
2050
  end
2012
2051
  end
@@ -2022,6 +2061,7 @@ begin
2022
2061
  trace('PN incomplete')
2023
2062
  completed = false
2024
2063
  end
2064
+ param_start = prefix_node.range_start
2025
2065
  else
2026
2066
  prefix_node = prefix(nil)
2027
2067
  prefix_node.complete = true
@@ -2038,6 +2078,8 @@ begin
2038
2078
  trace('VN incomplete')
2039
2079
  completed = false
2040
2080
  end
2081
+ param_start ||= value_node.range_start
2082
+ param_node.character_range = [param_start, value_node.range_end]
2041
2083
  else
2042
2084
  completed = false
2043
2085
  end
@@ -2056,7 +2098,7 @@ begin
2056
2098
  trace('STRING eof_string')
2057
2099
  p_end = p
2058
2100
  chars = data[p_start...p_end]
2059
- ast_node = string(utf8_string(chars), complete: false)
2101
+ ast_node = string(utf8_string(chars), complete: false, character_range: [p_start, p_end])
2060
2102
  @buffers[:string] = ast_node
2061
2103
  end
2062
2104
  begin
@@ -2064,7 +2106,7 @@ begin
2064
2106
  trace('STRING a_string_err')
2065
2107
  p_end = p
2066
2108
  chars = data[p_start...p_end]
2067
- ast_node = string(utf8_string(chars), complete: false)
2109
+ ast_node = string(utf8_string(chars), complete: false, character_range: [p_start, p_end])
2068
2110
  @buffers[:string] = ast_node
2069
2111
  end
2070
2112
  begin
@@ -2099,7 +2141,7 @@ begin
2099
2141
  trace('STRING eof_string')
2100
2142
  p_end = p
2101
2143
  chars = data[p_start...p_end]
2102
- ast_node = string(utf8_string(chars), complete: false)
2144
+ ast_node = string(utf8_string(chars), complete: false, character_range: [p_start, p_end])
2103
2145
  @buffers[:string] = ast_node
2104
2146
  end
2105
2147
  begin
@@ -2107,7 +2149,7 @@ begin
2107
2149
  trace('STRING string_node_err')
2108
2150
  p_end = p
2109
2151
  chars = data[p_start...p_end]
2110
- ast_node = string(utf8_string(chars), complete: false)
2152
+ ast_node = string(utf8_string(chars), complete: false, character_range: [p_start, p_end])
2111
2153
  yield ast_node
2112
2154
  end
2113
2155
  begin
@@ -2120,7 +2162,7 @@ begin
2120
2162
 
2121
2163
  trace('PARAMETER add_string_param_value')
2122
2164
  string_node = @buffers.delete(:string)
2123
- value_node = value(string_node, complete: string_node.complete)
2165
+ value_node = value(string_node, complete: string_node.complete, character_range: string_node.character_range)
2124
2166
  @buffers[:param_value] = value_node
2125
2167
  end
2126
2168
  begin
@@ -2135,6 +2177,7 @@ begin
2135
2177
  trace('PN incomplete')
2136
2178
  completed = false
2137
2179
  end
2180
+ param_start = prefix_node.range_start
2138
2181
  else
2139
2182
  prefix_node = prefix(nil)
2140
2183
  prefix_node.complete = true
@@ -2151,6 +2194,8 @@ begin
2151
2194
  trace('VN incomplete')
2152
2195
  completed = false
2153
2196
  end
2197
+ param_start ||= value_node.range_start
2198
+ param_node.character_range = [param_start, value_node.range_end]
2154
2199
  else
2155
2200
  completed = false
2156
2201
  end
@@ -2171,7 +2216,7 @@ begin
2171
2216
  id_end = p
2172
2217
  chars = data[id_start...id_end]
2173
2218
  completed = !chars.empty?
2174
- ast_node = identifier(utf8_string(chars), complete: completed)
2219
+ ast_node = identifier(utf8_string(chars), complete: completed, character_range: [id_start, id_end])
2175
2220
  @buffers[:ident] = ast_node
2176
2221
  end
2177
2222
  end
@@ -2180,7 +2225,7 @@ begin
2180
2225
  trace('IDENTIFIER an_ident_err')
2181
2226
  id_end = p
2182
2227
  chars = data[id_start...id_end]
2183
- ast_node = identifier(utf8_string(chars), complete: false)
2228
+ ast_node = identifier(utf8_string(chars), complete: false, character_range: [id_start, id_end])
2184
2229
  @buffers[:ident] = ast_node
2185
2230
  end
2186
2231
  begin
@@ -2188,7 +2233,7 @@ begin
2188
2233
  trace('STRING a_string_err')
2189
2234
  p_end = p
2190
2235
  chars = data[p_start...p_end]
2191
- ast_node = string(utf8_string(chars), complete: false)
2236
+ ast_node = string(utf8_string(chars), complete: false, character_range: [p_start, p_end])
2192
2237
  @buffers[:string] = ast_node
2193
2238
  end
2194
2239
  begin
@@ -2225,7 +2270,7 @@ begin
2225
2270
  id_end = p
2226
2271
  chars = data[id_start...id_end]
2227
2272
  completed = !chars.empty?
2228
- ast_node = identifier(utf8_string(chars), complete: completed)
2273
+ ast_node = identifier(utf8_string(chars), complete: completed, character_range: [id_start, id_end])
2229
2274
  @buffers[:ident] = ast_node
2230
2275
  end
2231
2276
  end
@@ -2233,7 +2278,7 @@ begin
2233
2278
 
2234
2279
  trace('PARAMETER add_prefix')
2235
2280
  ident = @buffers.delete(:ident)
2236
- prefix_node = prefix(ident, complete: ident.complete)
2281
+ prefix_node = prefix(ident, complete: ident.complete, character_range: ident.character_range)
2237
2282
  @buffers[:param_prefix] = prefix_node
2238
2283
  end
2239
2284
  begin
@@ -2248,6 +2293,7 @@ begin
2248
2293
  trace('PN incomplete')
2249
2294
  completed = false
2250
2295
  end
2296
+ param_start = prefix_node.range_start
2251
2297
  else
2252
2298
  prefix_node = prefix(nil)
2253
2299
  prefix_node.complete = true
@@ -2264,6 +2310,8 @@ begin
2264
2310
  trace('VN incomplete')
2265
2311
  completed = false
2266
2312
  end
2313
+ param_start ||= value_node.range_start
2314
+ param_node.character_range = [param_start, value_node.range_end]
2267
2315
  else
2268
2316
  completed = false
2269
2317
  end
@@ -2283,7 +2331,7 @@ begin
2283
2331
  id_end = p
2284
2332
  chars = data[id_start...id_end]
2285
2333
  completed = !chars.empty?
2286
- ast_node = identifier(utf8_string(chars), complete: completed)
2334
+ ast_node = identifier(utf8_string(chars), complete: completed, character_range: [id_start, id_end])
2287
2335
  @buffers[:ident] = ast_node
2288
2336
  end
2289
2337
  begin
@@ -2293,7 +2341,7 @@ begin
2293
2341
  id_end = p
2294
2342
  chars = data[id_start...id_end]
2295
2343
  completed = !chars.empty?
2296
- ast_node = identifier(utf8_string(chars), complete: completed)
2344
+ ast_node = identifier(utf8_string(chars), complete: completed, character_range: [id_start, id_end])
2297
2345
  @buffers[:ident] = ast_node
2298
2346
  end
2299
2347
  end
@@ -2301,7 +2349,7 @@ begin
2301
2349
 
2302
2350
  trace('PARAMETER add_ident_param_value')
2303
2351
  ident = @buffers.delete(:ident)
2304
- value_node = value(ident, complete: ident.complete)
2352
+ value_node = value(ident, complete: ident.complete, character_range: ident.character_range)
2305
2353
  @buffers[:param_value] = value_node
2306
2354
  end
2307
2355
  begin
@@ -2316,6 +2364,7 @@ begin
2316
2364
  trace('PN incomplete')
2317
2365
  completed = false
2318
2366
  end
2367
+ param_start = prefix_node.range_start
2319
2368
  else
2320
2369
  prefix_node = prefix(nil)
2321
2370
  prefix_node.complete = true
@@ -2332,6 +2381,8 @@ begin
2332
2381
  trace('VN incomplete')
2333
2382
  completed = false
2334
2383
  end
2384
+ param_start ||= value_node.range_start
2385
+ param_node.character_range = [param_start, value_node.range_end]
2335
2386
  else
2336
2387
  completed = false
2337
2388
  end
@@ -2352,7 +2403,7 @@ begin
2352
2403
  id_end = p
2353
2404
  chars = data[id_start...id_end]
2354
2405
  completed = !chars.empty?
2355
- ast_node = identifier(utf8_string(chars), complete: completed)
2406
+ ast_node = identifier(utf8_string(chars), complete: completed, character_range: [id_start, id_end])
2356
2407
  @buffers[:ident] = ast_node
2357
2408
  end
2358
2409
  end
@@ -2362,14 +2413,14 @@ begin
2362
2413
  id_end = p
2363
2414
  chars = data[id_start...id_end]
2364
2415
  completed = !chars.empty?
2365
- ast_node = identifier(utf8_string(chars), complete: completed)
2416
+ ast_node = identifier(utf8_string(chars), complete: completed, character_range: [id_start, id_end])
2366
2417
  @buffers[:ident] = ast_node
2367
2418
  end
2368
2419
  begin
2369
2420
 
2370
2421
  trace('PARAMETER add_ident_param_value')
2371
2422
  ident = @buffers.delete(:ident)
2372
- value_node = value(ident, complete: ident.complete)
2423
+ value_node = value(ident, complete: ident.complete, character_range: ident.character_range)
2373
2424
  @buffers[:param_value] = value_node
2374
2425
  end
2375
2426
  begin
@@ -2384,6 +2435,7 @@ begin
2384
2435
  trace('PN incomplete')
2385
2436
  completed = false
2386
2437
  end
2438
+ param_start = prefix_node.range_start
2387
2439
  else
2388
2440
  prefix_node = prefix(nil)
2389
2441
  prefix_node.complete = true
@@ -2400,6 +2452,8 @@ begin
2400
2452
  trace('VN incomplete')
2401
2453
  completed = false
2402
2454
  end
2455
+ param_start ||= value_node.range_start
2456
+ param_node.character_range = [param_start, value_node.range_end]
2403
2457
  else
2404
2458
  completed = false
2405
2459
  end
@@ -2790,7 +2844,7 @@ begin
2790
2844
  id_end = p
2791
2845
  chars = data[id_start...id_end]
2792
2846
  completed = !chars.empty?
2793
- ast_node = identifier(utf8_string(chars), complete: completed)
2847
+ ast_node = identifier(utf8_string(chars), complete: completed, character_range: [id_start, id_end])
2794
2848
  @buffers[:ident] = ast_node
2795
2849
  end
2796
2850
  when 17 then
@@ -2799,7 +2853,7 @@ begin
2799
2853
  trace('IDENTIFIER an_ident_err')
2800
2854
  id_end = p
2801
2855
  chars = data[id_start...id_end]
2802
- ast_node = identifier(utf8_string(chars), complete: false)
2856
+ ast_node = identifier(utf8_string(chars), complete: false, character_range: [id_start, id_end])
2803
2857
  @buffers[:ident] = ast_node
2804
2858
  end
2805
2859
  when 29 then
@@ -2808,7 +2862,7 @@ begin
2808
2862
  trace('IDENTIFIER ident_node_err')
2809
2863
  id_end = p
2810
2864
  chars = data[id_start...id_end]
2811
- ast_node = identifier(utf8_string(chars), complete: false)
2865
+ ast_node = identifier(utf8_string(chars), complete: false, character_range: [id_start, id_end])
2812
2866
  yield ast_node
2813
2867
  end
2814
2868
  when 7 then
@@ -2824,7 +2878,7 @@ begin
2824
2878
  trace('STRING a_string_err')
2825
2879
  p_end = p
2826
2880
  chars = data[p_start...p_end]
2827
- ast_node = string(utf8_string(chars), complete: false)
2881
+ ast_node = string(utf8_string(chars), complete: false, character_range: [p_start, p_end])
2828
2882
  @buffers[:string] = ast_node
2829
2883
  end
2830
2884
  when 11 then
@@ -2833,7 +2887,7 @@ begin
2833
2887
  trace('STRING string_node_err')
2834
2888
  p_end = p
2835
2889
  chars = data[p_start...p_end]
2836
- ast_node = string(utf8_string(chars), complete: false)
2890
+ ast_node = string(utf8_string(chars), complete: false, character_range: [p_start, p_end])
2837
2891
  yield ast_node
2838
2892
  end
2839
2893
  when 22 then
@@ -2841,7 +2895,7 @@ begin
2841
2895
 
2842
2896
  trace('PARAMETER add_prefix')
2843
2897
  ident = @buffers.delete(:ident)
2844
- prefix_node = prefix(ident, complete: ident.complete)
2898
+ prefix_node = prefix(ident, complete: ident.complete, character_range: ident.character_range)
2845
2899
  @buffers[:param_prefix] = prefix_node
2846
2900
  end
2847
2901
  when 2 then
@@ -2850,7 +2904,7 @@ begin
2850
2904
  trace('IDENTIFIER an_ident_err')
2851
2905
  id_end = p
2852
2906
  chars = data[id_start...id_end]
2853
- ast_node = identifier(utf8_string(chars), complete: false)
2907
+ ast_node = identifier(utf8_string(chars), complete: false, character_range: [id_start, id_end])
2854
2908
  @buffers[:ident] = ast_node
2855
2909
  end
2856
2910
  begin
@@ -2858,7 +2912,7 @@ begin
2858
2912
  trace('STRING a_string_err')
2859
2913
  p_end = p
2860
2914
  chars = data[p_start...p_end]
2861
- ast_node = string(utf8_string(chars), complete: false)
2915
+ ast_node = string(utf8_string(chars), complete: false, character_range: [p_start, p_end])
2862
2916
  @buffers[:string] = ast_node
2863
2917
  end
2864
2918
  when 9 then
@@ -2873,7 +2927,7 @@ begin
2873
2927
  trace('STRING string_end')
2874
2928
  completed = @string_opened && @string_closed
2875
2929
  chars = data[p_start...p_end]
2876
- ast_node = string(utf8_string(chars), complete: true)
2930
+ ast_node = string(utf8_string(chars), complete: true, character_range: [p_start, p_end])
2877
2931
  @buffers[:string] = ast_node
2878
2932
  end
2879
2933
  when 26 then
@@ -2889,6 +2943,7 @@ begin
2889
2943
  trace('PN incomplete')
2890
2944
  completed = false
2891
2945
  end
2946
+ param_start = prefix_node.range_start
2892
2947
  else
2893
2948
  prefix_node = prefix(nil)
2894
2949
  prefix_node.complete = true
@@ -2905,6 +2960,8 @@ begin
2905
2960
  trace('VN incomplete')
2906
2961
  completed = false
2907
2962
  end
2963
+ param_start ||= value_node.range_start
2964
+ param_node.character_range = [param_start, value_node.range_end]
2908
2965
  else
2909
2966
  completed = false
2910
2967
  end
@@ -2922,7 +2979,7 @@ begin
2922
2979
 
2923
2980
  trace('PARAMETER add_prefix')
2924
2981
  ident = @buffers.delete(:ident)
2925
- prefix_node = prefix(ident, complete: ident.complete)
2982
+ prefix_node = prefix(ident, complete: ident.complete, character_range: ident.character_range)
2926
2983
  @buffers[:param_prefix] = prefix_node
2927
2984
  end
2928
2985
  begin
@@ -2949,7 +3006,7 @@ begin
2949
3006
  trace('STRING string_end')
2950
3007
  completed = @string_opened && @string_closed
2951
3008
  chars = data[p_start...p_end]
2952
- ast_node = string(utf8_string(chars), complete: true)
3009
+ ast_node = string(utf8_string(chars), complete: true, character_range: [p_start, p_end])
2953
3010
  @buffers[:string] = ast_node
2954
3011
  end
2955
3012
  when 14 then
@@ -2964,7 +3021,7 @@ begin
2964
3021
  trace('STRING string_end')
2965
3022
  completed = @string_opened && @string_closed
2966
3023
  chars = data[p_start...p_end]
2967
- ast_node = string(utf8_string(chars), complete: true)
3024
+ ast_node = string(utf8_string(chars), complete: true, character_range: [p_start, p_end])
2968
3025
  @buffers[:string] = ast_node
2969
3026
  end
2970
3027
  begin
@@ -2977,7 +3034,7 @@ begin
2977
3034
 
2978
3035
  trace('PARAMETER add_string_param_value')
2979
3036
  string_node = @buffers.delete(:string)
2980
- value_node = value(string_node, complete: string_node.complete)
3037
+ value_node = value(string_node, complete: string_node.complete, character_range: string_node.character_range)
2981
3038
  @buffers[:param_value] = value_node
2982
3039
  end
2983
3040
  begin
@@ -2992,6 +3049,7 @@ begin
2992
3049
  trace('PN incomplete')
2993
3050
  completed = false
2994
3051
  end
3052
+ param_start = prefix_node.range_start
2995
3053
  else
2996
3054
  prefix_node = prefix(nil)
2997
3055
  prefix_node.complete = true
@@ -3008,6 +3066,8 @@ begin
3008
3066
  trace('VN incomplete')
3009
3067
  completed = false
3010
3068
  end
3069
+ param_start ||= value_node.range_start
3070
+ param_node.character_range = [param_start, value_node.range_end]
3011
3071
  else
3012
3072
  completed = false
3013
3073
  end
@@ -3025,7 +3085,7 @@ begin
3025
3085
 
3026
3086
  trace('PARAMETER add_prefix')
3027
3087
  ident = @buffers.delete(:ident)
3028
- prefix_node = prefix(ident, complete: ident.complete)
3088
+ prefix_node = prefix(ident, complete: ident.complete, character_range: ident.character_range)
3029
3089
  @buffers[:param_prefix] = prefix_node
3030
3090
  end
3031
3091
  begin
@@ -3040,6 +3100,7 @@ begin
3040
3100
  trace('PN incomplete')
3041
3101
  completed = false
3042
3102
  end
3103
+ param_start = prefix_node.range_start
3043
3104
  else
3044
3105
  prefix_node = prefix(nil)
3045
3106
  prefix_node.complete = true
@@ -3056,6 +3117,8 @@ begin
3056
3117
  trace('VN incomplete')
3057
3118
  completed = false
3058
3119
  end
3120
+ param_start ||= value_node.range_start
3121
+ param_node.character_range = [param_start, value_node.range_end]
3059
3122
  else
3060
3123
  completed = false
3061
3124
  end
@@ -3075,14 +3138,14 @@ begin
3075
3138
  id_end = p
3076
3139
  chars = data[id_start...id_end]
3077
3140
  completed = !chars.empty?
3078
- ast_node = identifier(utf8_string(chars), complete: completed)
3141
+ ast_node = identifier(utf8_string(chars), complete: completed, character_range: [id_start, id_end])
3079
3142
  @buffers[:ident] = ast_node
3080
3143
  end
3081
3144
  begin
3082
3145
 
3083
3146
  trace('PARAMETER add_ident_param_value')
3084
3147
  ident = @buffers.delete(:ident)
3085
- value_node = value(ident, complete: ident.complete)
3148
+ value_node = value(ident, complete: ident.complete, character_range: ident.character_range)
3086
3149
  @buffers[:param_value] = value_node
3087
3150
  end
3088
3151
  begin
@@ -3097,6 +3160,7 @@ begin
3097
3160
  trace('PN incomplete')
3098
3161
  completed = false
3099
3162
  end
3163
+ param_start = prefix_node.range_start
3100
3164
  else
3101
3165
  prefix_node = prefix(nil)
3102
3166
  prefix_node.complete = true
@@ -3113,6 +3177,8 @@ begin
3113
3177
  trace('VN incomplete')
3114
3178
  completed = false
3115
3179
  end
3180
+ param_start ||= value_node.range_start
3181
+ param_node.character_range = [param_start, value_node.range_end]
3116
3182
  else
3117
3183
  completed = false
3118
3184
  end
@@ -3143,7 +3209,7 @@ begin
3143
3209
  trace('STRING string_end')
3144
3210
  completed = @string_opened && @string_closed
3145
3211
  chars = data[p_start...p_end]
3146
- ast_node = string(utf8_string(chars), complete: true)
3212
+ ast_node = string(utf8_string(chars), complete: true, character_range: [p_start, p_end])
3147
3213
  @buffers[:string] = ast_node
3148
3214
  end
3149
3215
  begin
@@ -3208,7 +3274,7 @@ begin
3208
3274
  id_end = p
3209
3275
  chars = data[id_start...id_end]
3210
3276
  completed = !chars.empty?
3211
- ast_node = identifier(utf8_string(chars), complete: completed)
3277
+ ast_node = identifier(utf8_string(chars), complete: completed, character_range: [id_start, id_end])
3212
3278
  @buffers[:ident] = ast_node
3213
3279
  end
3214
3280
  begin
@@ -3222,7 +3288,7 @@ begin
3222
3288
  trace('STRING a_string_err')
3223
3289
  p_end = p
3224
3290
  chars = data[p_start...p_end]
3225
- ast_node = string(utf8_string(chars), complete: false)
3291
+ ast_node = string(utf8_string(chars), complete: false, character_range: [p_start, p_end])
3226
3292
  @buffers[:string] = ast_node
3227
3293
  end
3228
3294
  begin
@@ -3257,7 +3323,7 @@ begin
3257
3323
  trace('STRING string_node_err')
3258
3324
  p_end = p
3259
3325
  chars = data[p_start...p_end]
3260
- ast_node = string(utf8_string(chars), complete: false)
3326
+ ast_node = string(utf8_string(chars), complete: false, character_range: [p_start, p_end])
3261
3327
  yield ast_node
3262
3328
  end
3263
3329
  begin
@@ -3273,7 +3339,7 @@ begin
3273
3339
  id_end = p
3274
3340
  chars = data[id_start...id_end]
3275
3341
  completed = !chars.empty?
3276
- ast_node = identifier(utf8_string(chars), complete: completed)
3342
+ ast_node = identifier(utf8_string(chars), complete: completed, character_range: [id_start, id_end])
3277
3343
  @buffers[:ident] = ast_node
3278
3344
  end
3279
3345
  end
@@ -3289,6 +3355,7 @@ begin
3289
3355
  trace('PN incomplete')
3290
3356
  completed = false
3291
3357
  end
3358
+ param_start = prefix_node.range_start
3292
3359
  else
3293
3360
  prefix_node = prefix(nil)
3294
3361
  prefix_node.complete = true
@@ -3305,6 +3372,8 @@ begin
3305
3372
  trace('VN incomplete')
3306
3373
  completed = false
3307
3374
  end
3375
+ param_start ||= value_node.range_start
3376
+ param_node.character_range = [param_start, value_node.range_end]
3308
3377
  else
3309
3378
  completed = false
3310
3379
  end
@@ -3323,7 +3392,7 @@ begin
3323
3392
  trace('STRING eof_string')
3324
3393
  p_end = p
3325
3394
  chars = data[p_start...p_end]
3326
- ast_node = string(utf8_string(chars), complete: false)
3395
+ ast_node = string(utf8_string(chars), complete: false, character_range: [p_start, p_end])
3327
3396
  @buffers[:string] = ast_node
3328
3397
  end
3329
3398
  begin
@@ -3331,7 +3400,7 @@ begin
3331
3400
  trace('STRING a_string_err')
3332
3401
  p_end = p
3333
3402
  chars = data[p_start...p_end]
3334
- ast_node = string(utf8_string(chars), complete: false)
3403
+ ast_node = string(utf8_string(chars), complete: false, character_range: [p_start, p_end])
3335
3404
  @buffers[:string] = ast_node
3336
3405
  end
3337
3406
  begin
@@ -3366,7 +3435,7 @@ begin
3366
3435
  trace('STRING eof_string')
3367
3436
  p_end = p
3368
3437
  chars = data[p_start...p_end]
3369
- ast_node = string(utf8_string(chars), complete: false)
3438
+ ast_node = string(utf8_string(chars), complete: false, character_range: [p_start, p_end])
3370
3439
  @buffers[:string] = ast_node
3371
3440
  end
3372
3441
  begin
@@ -3374,7 +3443,7 @@ begin
3374
3443
  trace('STRING string_node_err')
3375
3444
  p_end = p
3376
3445
  chars = data[p_start...p_end]
3377
- ast_node = string(utf8_string(chars), complete: false)
3446
+ ast_node = string(utf8_string(chars), complete: false, character_range: [p_start, p_end])
3378
3447
  yield ast_node
3379
3448
  end
3380
3449
  begin
@@ -3387,7 +3456,7 @@ begin
3387
3456
 
3388
3457
  trace('PARAMETER add_string_param_value')
3389
3458
  string_node = @buffers.delete(:string)
3390
- value_node = value(string_node, complete: string_node.complete)
3459
+ value_node = value(string_node, complete: string_node.complete, character_range: string_node.character_range)
3391
3460
  @buffers[:param_value] = value_node
3392
3461
  end
3393
3462
  begin
@@ -3402,6 +3471,7 @@ begin
3402
3471
  trace('PN incomplete')
3403
3472
  completed = false
3404
3473
  end
3474
+ param_start = prefix_node.range_start
3405
3475
  else
3406
3476
  prefix_node = prefix(nil)
3407
3477
  prefix_node.complete = true
@@ -3418,6 +3488,8 @@ begin
3418
3488
  trace('VN incomplete')
3419
3489
  completed = false
3420
3490
  end
3491
+ param_start ||= value_node.range_start
3492
+ param_node.character_range = [param_start, value_node.range_end]
3421
3493
  else
3422
3494
  completed = false
3423
3495
  end
@@ -3438,7 +3510,7 @@ begin
3438
3510
  id_end = p
3439
3511
  chars = data[id_start...id_end]
3440
3512
  completed = !chars.empty?
3441
- ast_node = identifier(utf8_string(chars), complete: completed)
3513
+ ast_node = identifier(utf8_string(chars), complete: completed, character_range: [id_start, id_end])
3442
3514
  @buffers[:ident] = ast_node
3443
3515
  end
3444
3516
  end
@@ -3447,7 +3519,7 @@ begin
3447
3519
  trace('IDENTIFIER an_ident_err')
3448
3520
  id_end = p
3449
3521
  chars = data[id_start...id_end]
3450
- ast_node = identifier(utf8_string(chars), complete: false)
3522
+ ast_node = identifier(utf8_string(chars), complete: false, character_range: [id_start, id_end])
3451
3523
  @buffers[:ident] = ast_node
3452
3524
  end
3453
3525
  begin
@@ -3455,7 +3527,7 @@ begin
3455
3527
  trace('STRING a_string_err')
3456
3528
  p_end = p
3457
3529
  chars = data[p_start...p_end]
3458
- ast_node = string(utf8_string(chars), complete: false)
3530
+ ast_node = string(utf8_string(chars), complete: false, character_range: [p_start, p_end])
3459
3531
  @buffers[:string] = ast_node
3460
3532
  end
3461
3533
  begin
@@ -3492,7 +3564,7 @@ begin
3492
3564
  id_end = p
3493
3565
  chars = data[id_start...id_end]
3494
3566
  completed = !chars.empty?
3495
- ast_node = identifier(utf8_string(chars), complete: completed)
3567
+ ast_node = identifier(utf8_string(chars), complete: completed, character_range: [id_start, id_end])
3496
3568
  @buffers[:ident] = ast_node
3497
3569
  end
3498
3570
  end
@@ -3500,7 +3572,7 @@ begin
3500
3572
 
3501
3573
  trace('PARAMETER add_prefix')
3502
3574
  ident = @buffers.delete(:ident)
3503
- prefix_node = prefix(ident, complete: ident.complete)
3575
+ prefix_node = prefix(ident, complete: ident.complete, character_range: ident.character_range)
3504
3576
  @buffers[:param_prefix] = prefix_node
3505
3577
  end
3506
3578
  begin
@@ -3515,6 +3587,7 @@ begin
3515
3587
  trace('PN incomplete')
3516
3588
  completed = false
3517
3589
  end
3590
+ param_start = prefix_node.range_start
3518
3591
  else
3519
3592
  prefix_node = prefix(nil)
3520
3593
  prefix_node.complete = true
@@ -3531,6 +3604,8 @@ begin
3531
3604
  trace('VN incomplete')
3532
3605
  completed = false
3533
3606
  end
3607
+ param_start ||= value_node.range_start
3608
+ param_node.character_range = [param_start, value_node.range_end]
3534
3609
  else
3535
3610
  completed = false
3536
3611
  end
@@ -3550,7 +3625,7 @@ begin
3550
3625
  id_end = p
3551
3626
  chars = data[id_start...id_end]
3552
3627
  completed = !chars.empty?
3553
- ast_node = identifier(utf8_string(chars), complete: completed)
3628
+ ast_node = identifier(utf8_string(chars), complete: completed, character_range: [id_start, id_end])
3554
3629
  @buffers[:ident] = ast_node
3555
3630
  end
3556
3631
  begin
@@ -3560,7 +3635,7 @@ begin
3560
3635
  id_end = p
3561
3636
  chars = data[id_start...id_end]
3562
3637
  completed = !chars.empty?
3563
- ast_node = identifier(utf8_string(chars), complete: completed)
3638
+ ast_node = identifier(utf8_string(chars), complete: completed, character_range: [id_start, id_end])
3564
3639
  @buffers[:ident] = ast_node
3565
3640
  end
3566
3641
  end
@@ -3568,7 +3643,7 @@ begin
3568
3643
 
3569
3644
  trace('PARAMETER add_ident_param_value')
3570
3645
  ident = @buffers.delete(:ident)
3571
- value_node = value(ident, complete: ident.complete)
3646
+ value_node = value(ident, complete: ident.complete, character_range: ident.character_range)
3572
3647
  @buffers[:param_value] = value_node
3573
3648
  end
3574
3649
  begin
@@ -3583,6 +3658,7 @@ begin
3583
3658
  trace('PN incomplete')
3584
3659
  completed = false
3585
3660
  end
3661
+ param_start = prefix_node.range_start
3586
3662
  else
3587
3663
  prefix_node = prefix(nil)
3588
3664
  prefix_node.complete = true
@@ -3599,6 +3675,8 @@ begin
3599
3675
  trace('VN incomplete')
3600
3676
  completed = false
3601
3677
  end
3678
+ param_start ||= value_node.range_start
3679
+ param_node.character_range = [param_start, value_node.range_end]
3602
3680
  else
3603
3681
  completed = false
3604
3682
  end
@@ -3619,7 +3697,7 @@ begin
3619
3697
  id_end = p
3620
3698
  chars = data[id_start...id_end]
3621
3699
  completed = !chars.empty?
3622
- ast_node = identifier(utf8_string(chars), complete: completed)
3700
+ ast_node = identifier(utf8_string(chars), complete: completed, character_range: [id_start, id_end])
3623
3701
  @buffers[:ident] = ast_node
3624
3702
  end
3625
3703
  end
@@ -3629,14 +3707,14 @@ begin
3629
3707
  id_end = p
3630
3708
  chars = data[id_start...id_end]
3631
3709
  completed = !chars.empty?
3632
- ast_node = identifier(utf8_string(chars), complete: completed)
3710
+ ast_node = identifier(utf8_string(chars), complete: completed, character_range: [id_start, id_end])
3633
3711
  @buffers[:ident] = ast_node
3634
3712
  end
3635
3713
  begin
3636
3714
 
3637
3715
  trace('PARAMETER add_ident_param_value')
3638
3716
  ident = @buffers.delete(:ident)
3639
- value_node = value(ident, complete: ident.complete)
3717
+ value_node = value(ident, complete: ident.complete, character_range: ident.character_range)
3640
3718
  @buffers[:param_value] = value_node
3641
3719
  end
3642
3720
  begin
@@ -3651,6 +3729,7 @@ begin
3651
3729
  trace('PN incomplete')
3652
3730
  completed = false
3653
3731
  end
3732
+ param_start = prefix_node.range_start
3654
3733
  else
3655
3734
  prefix_node = prefix(nil)
3656
3735
  prefix_node.complete = true
@@ -3667,6 +3746,8 @@ begin
3667
3746
  trace('VN incomplete')
3668
3747
  completed = false
3669
3748
  end
3749
+ param_start ||= value_node.range_start
3750
+ param_node.character_range = [param_start, value_node.range_end]
3670
3751
  else
3671
3752
  completed = false
3672
3753
  end