lrama 0.6.0 → 0.6.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (41) hide show
  1. checksums.yaml +4 -4
  2. data/.github/workflows/test.yaml +20 -5
  3. data/Gemfile +1 -1
  4. data/NEWS.md +46 -0
  5. data/Steepfile +2 -3
  6. data/lib/lrama/command.rb +17 -3
  7. data/lib/lrama/context.rb +2 -22
  8. data/lib/lrama/grammar/binding.rb +24 -0
  9. data/lib/lrama/grammar/code/rule_action.rb +1 -1
  10. data/lib/lrama/grammar/parameterizing_rule/resolver.rb +39 -0
  11. data/lib/lrama/grammar/parameterizing_rule/rhs.rb +15 -0
  12. data/lib/lrama/grammar/parameterizing_rule/rule.rb +16 -0
  13. data/lib/lrama/grammar/parameterizing_rule.rb +3 -6
  14. data/lib/lrama/grammar/percent_code.rb +3 -3
  15. data/lib/lrama/grammar/rule_builder.rb +59 -25
  16. data/lib/lrama/grammar/type.rb +13 -1
  17. data/lib/lrama/grammar.rb +7 -9
  18. data/lib/lrama/lexer/grammar_file.rb +1 -1
  19. data/lib/lrama/lexer/token/instantiate_rule.rb +7 -2
  20. data/lib/lrama/lexer/token.rb +5 -0
  21. data/lib/lrama/lexer.rb +2 -7
  22. data/lib/lrama/output.rb +2 -2
  23. data/lib/lrama/parser.rb +166 -148
  24. data/lib/lrama/version.rb +1 -1
  25. data/parser.y +8 -8
  26. data/sig/lrama/grammar/binding.rbs +16 -0
  27. data/sig/lrama/grammar/parameterizing_rule/resolver.rbs +21 -0
  28. data/sig/lrama/grammar/parameterizing_rule/rhs.rbs +13 -0
  29. data/sig/lrama/grammar/parameterizing_rule/rule.rbs +14 -0
  30. data/sig/lrama/grammar/parameterizing_rule.rbs +0 -4
  31. data/sig/lrama/grammar/percent_code.rbs +3 -3
  32. data/sig/lrama/grammar/rule_builder.rbs +9 -6
  33. data/sig/lrama/lexer/token/instantiate_rule.rbs +4 -2
  34. data/sig/lrama/lexer/token.rbs +1 -0
  35. metadata +11 -9
  36. data/lib/lrama/grammar/parameterizing_rule_builder.rb +0 -34
  37. data/lib/lrama/grammar/parameterizing_rule_resolver.rb +0 -30
  38. data/lib/lrama/grammar/parameterizing_rule_rhs_builder.rb +0 -53
  39. data/sig/lrama/grammar/parameterizing_rule_builder.rbs +0 -19
  40. data/sig/lrama/grammar/parameterizing_rule_resolver.rbs +0 -16
  41. data/sig/lrama/grammar/parameterizing_rule_rhs_builder.rbs +0 -18
@@ -2,16 +2,21 @@ module Lrama
2
2
  class Lexer
3
3
  class Token
4
4
  class InstantiateRule < Token
5
- attr_accessor :args
5
+ attr_reader :args, :lhs_tag
6
6
 
7
- def initialize(s_value:, alias_name: nil, location: nil, args: [])
7
+ def initialize(s_value:, alias_name: nil, location: nil, args: [], lhs_tag: nil)
8
8
  super s_value: s_value, alias_name: alias_name, location: location
9
9
  @args = args
10
+ @lhs_tag = lhs_tag
10
11
  end
11
12
 
12
13
  def rule_name
13
14
  s_value
14
15
  end
16
+
17
+ def args_count
18
+ args.count
19
+ end
15
20
  end
16
21
  end
17
22
  end
@@ -46,6 +46,11 @@ module Lrama
46
46
  def last_column
47
47
  location.last_column
48
48
  end
49
+
50
+ def invalid_ref(ref, message)
51
+ location = self.location.partial_location(ref.first_column, ref.last_column)
52
+ raise location.generate_error_message(message)
53
+ end
49
54
  end
50
55
  end
51
56
  end
data/lib/lrama/lexer.rb CHANGED
@@ -5,9 +5,8 @@ require "lrama/lexer/token"
5
5
 
6
6
  module Lrama
7
7
  class Lexer
8
- attr_reader :head_line, :head_column
9
- attr_accessor :status
10
- attr_accessor :end_symbol
8
+ attr_reader :head_line, :head_column, :line
9
+ attr_accessor :status, :end_symbol
11
10
 
12
11
  SYMBOLS = ['%{', '%}', '%%', '{', '}', '\[', '\]', '\(', '\)', '\,', ':', '\|', ';']
13
12
  PERCENT_TOKENS = %w(
@@ -50,10 +49,6 @@ module Lrama
50
49
  end
51
50
  end
52
51
 
53
- def line
54
- @line
55
- end
56
-
57
52
  def column
58
53
  @scanner.pos - @head
59
54
  end
data/lib/lrama/output.rb CHANGED
@@ -352,9 +352,9 @@ module Lrama
352
352
  # b4_percent_code_get
353
353
  def percent_code(name)
354
354
  @grammar.percent_codes.select do |percent_code|
355
- percent_code.id.s_value == name
355
+ percent_code.name == name
356
356
  end.map do |percent_code|
357
- percent_code.code.s_value
357
+ percent_code.code
358
358
  end.join
359
359
  end
360
360
 
data/lib/lrama/parser.rb CHANGED
@@ -734,11 +734,11 @@ end
734
734
  ##### State transition tables begin ###
735
735
 
736
736
  racc_action_table = [
737
- 85, 44, 86, 145, 144, 67, 44, 44, 145, 187,
738
- 67, 67, 44, 6, 187, 7, 67, 147, 196, 44,
739
- 143, 43, 147, 188, 58, 163, 164, 165, 188, 3,
737
+ 85, 44, 86, 145, 144, 67, 44, 44, 145, 188,
738
+ 67, 67, 44, 6, 188, 7, 67, 147, 199, 44,
739
+ 143, 43, 147, 189, 58, 163, 164, 165, 189, 3,
740
740
  44, 40, 43, 8, 67, 63, 34, 44, 148, 43,
741
- 41, 87, 40, 148, 189, 47, 44, 80, 43, 189,
741
+ 41, 87, 40, 148, 190, 47, 44, 80, 43, 190,
742
742
  21, 23, 24, 25, 26, 27, 28, 29, 30, 31,
743
743
  47, 21, 23, 24, 25, 26, 27, 28, 29, 30,
744
744
  31, 9, 44, 47, 43, 13, 14, 15, 16, 17,
@@ -750,22 +750,23 @@ racc_action_table = [
750
750
  43, 43, 67, 173, 44, 44, 43, 43, 67, 173,
751
751
  44, 44, 43, 43, 67, 173, 44, 44, 43, 43,
752
752
  67, 67, 44, 44, 43, 43, 67, 67, 44, 44,
753
- 43, 43, 67, 67, 44, 44, 43, 43, 67, 67,
754
- 44, 44, 43, 43, 67, 67, 163, 164, 165, 83,
755
- 44, 44, 43, 43, 141, 190, 142, 191, 205, 54,
756
- 191, 55, 76, 77, 81, 83, 88, 88, 88, 90,
757
- 96, 100, 101, 104, 104, 104, 104, 107, 110, 111,
758
- 113, 115, 116, 117, 118, 119, 122, 126, 127, 128,
759
- 131, 132, 133, 135, 150, 152, 153, 154, 155, 156,
760
- 157, 158, 131, 160, 168, 169, 178, 182, 183, 185,
761
- 178, 83, 182, 201, 203, 83, 207, 83 ]
753
+ 43, 43, 67, 67, 44, 44, 179, 43, 67, 67,
754
+ 44, 44, 179, 43, 67, 67, 44, 44, 179, 43,
755
+ 67, 163, 164, 165, 83, 44, 141, 43, 142, 192,
756
+ 54, 193, 163, 164, 165, 208, 210, 193, 193, 55,
757
+ 76, 77, 81, 83, 88, 88, 88, 90, 96, 100,
758
+ 101, 104, 104, 104, 104, 107, 110, 111, 113, 115,
759
+ 116, 117, 118, 119, 122, 126, 127, 128, 131, 132,
760
+ 133, 135, 150, 152, 153, 154, 155, 156, 157, 158,
761
+ 131, 160, 168, 169, 178, 183, 184, 186, 191, 178,
762
+ 83, 183, 205, 207, 83, 212, 83 ]
762
763
 
763
764
  racc_action_check = [
764
765
  42, 130, 42, 130, 129, 130, 159, 177, 159, 177,
765
- 159, 177, 193, 2, 193, 2, 193, 130, 187, 26,
766
- 129, 26, 159, 177, 26, 187, 187, 187, 193, 1,
766
+ 159, 177, 196, 2, 196, 2, 196, 130, 188, 26,
767
+ 129, 26, 159, 177, 26, 188, 188, 188, 196, 1,
767
768
  27, 9, 27, 3, 27, 27, 7, 14, 130, 14,
768
- 13, 42, 35, 159, 177, 15, 57, 35, 57, 193,
769
+ 13, 42, 35, 159, 177, 15, 57, 35, 57, 196,
769
770
  9, 9, 9, 9, 9, 9, 9, 9, 9, 9,
770
771
  16, 35, 35, 35, 35, 35, 35, 35, 35, 35,
771
772
  35, 4, 58, 17, 58, 4, 4, 4, 4, 4,
@@ -777,110 +778,113 @@ racc_action_check = [
777
778
  170, 98, 170, 170, 174, 104, 174, 104, 174, 174,
778
779
  175, 106, 175, 106, 175, 175, 62, 63, 62, 63,
779
780
  62, 63, 101, 103, 101, 103, 101, 103, 123, 148,
780
- 123, 148, 123, 148, 160, 189, 160, 189, 160, 189,
781
- 191, 196, 191, 196, 191, 196, 146, 146, 146, 146,
782
- 120, 124, 120, 124, 125, 179, 125, 179, 202, 24,
783
- 202, 25, 32, 33, 38, 39, 46, 48, 49, 50,
784
- 56, 60, 61, 68, 73, 74, 75, 76, 82, 83,
785
- 89, 91, 92, 93, 94, 95, 99, 107, 108, 109,
786
- 110, 111, 112, 114, 134, 136, 137, 138, 139, 140,
787
- 141, 142, 143, 145, 149, 151, 157, 162, 166, 176,
788
- 185, 186, 190, 192, 197, 201, 206, 207 ]
781
+ 123, 148, 123, 148, 160, 190, 160, 190, 160, 190,
782
+ 191, 193, 191, 193, 191, 193, 199, 120, 199, 120,
783
+ 199, 146, 146, 146, 146, 124, 125, 124, 125, 180,
784
+ 24, 180, 181, 181, 181, 202, 206, 202, 206, 25,
785
+ 32, 33, 38, 39, 46, 48, 49, 50, 56, 60,
786
+ 61, 68, 73, 74, 75, 76, 82, 83, 89, 91,
787
+ 92, 93, 94, 95, 99, 107, 108, 109, 110, 111,
788
+ 112, 114, 134, 136, 137, 138, 139, 140, 141, 142,
789
+ 143, 145, 149, 151, 157, 162, 166, 176, 179, 186,
790
+ 187, 192, 195, 200, 205, 211, 212 ]
789
791
 
790
792
  racc_action_pointer = [
791
793
  nil, 29, 3, 33, 62, nil, nil, 29, nil, 27,
792
794
  nil, nil, nil, 34, 34, 26, 41, 54, 76, 63,
793
- nil, 81, nil, 88, 170, 172, 16, 27, 93, 94,
794
- 100, 101, 187, 191, nil, 38, nil, nil, 172, 151,
795
- nil, nil, -5, nil, nil, nil, 177, nil, 178, 179,
796
- 180, nil, nil, nil, nil, nil, 192, 43, 69, nil,
797
- 195, 194, 143, 144, nil, nil, nil, nil, 195, 108,
798
- 114, nil, nil, 196, 197, 198, 173, nil, nil, nil,
799
- nil, nil, 172, 204, nil, nil, nil, nil, nil, 208,
800
- nil, 209, 210, 211, 212, 213, 120, nil, 126, 209,
801
- nil, 149, nil, 150, 132, nil, 138, 212, 207, 217,
802
- 181, 176, 220, nil, 221, nil, nil, nil, nil, nil,
803
- 177, nil, nil, 155, 178, 149, nil, nil, nil, -18,
804
- -2, nil, nil, nil, 204, nil, 205, 206, 207, 208,
805
- 209, 194, 226, 193, nil, 199, 135, nil, 156, 214,
806
- nil, 215, nil, nil, 107, 113, 119, 197, nil, 3,
807
- 161, nil, 229, nil, nil, nil, 236, nil, nil, nil,
808
- 125, nil, nil, nil, 131, 137, 201, 4, nil, 150,
809
- nil, nil, nil, nil, nil, 201, 197, -16, nil, 162,
810
- 234, 167, 223, 9, nil, nil, 168, 242, nil, nil,
811
- nil, 201, 153, nil, nil, nil, 226, 203, nil ]
795
+ nil, 81, nil, 88, 171, 180, 16, 27, 93, 94,
796
+ 100, 101, 195, 199, nil, 38, nil, nil, 180, 159,
797
+ nil, nil, -5, nil, nil, nil, 185, nil, 186, 187,
798
+ 188, nil, nil, nil, nil, nil, 200, 43, 69, nil,
799
+ 203, 202, 143, 144, nil, nil, nil, nil, 203, 108,
800
+ 114, nil, nil, 204, 205, 206, 181, nil, nil, nil,
801
+ nil, nil, 180, 212, nil, nil, nil, nil, nil, 216,
802
+ nil, 217, 218, 219, 220, 221, 120, nil, 126, 217,
803
+ nil, 149, nil, 150, 132, nil, 138, 220, 215, 225,
804
+ 189, 184, 228, nil, 229, nil, nil, nil, nil, nil,
805
+ 174, nil, nil, 155, 182, 151, nil, nil, nil, -18,
806
+ -2, nil, nil, nil, 212, nil, 213, 214, 215, 216,
807
+ 217, 202, 234, 201, nil, 207, 140, nil, 156, 222,
808
+ nil, 223, nil, nil, 107, 113, 119, 205, nil, 3,
809
+ 161, nil, 237, nil, nil, nil, 244, nil, nil, nil,
810
+ 125, nil, nil, nil, 131, 137, 209, 4, nil, 214,
811
+ 154, 151, nil, nil, nil, nil, 210, 206, -16, nil,
812
+ 162, 167, 243, 168, nil, 232, 9, nil, nil, 173,
813
+ 251, nil, 160, nil, nil, 210, 161, nil, nil, nil,
814
+ nil, 235, 212, nil ]
812
815
 
813
816
  racc_action_default = [
814
- -2, -128, -8, -128, -128, -3, -4, -128, 209, -128,
815
- -9, -10, -11, -128, -128, -128, -128, -128, -128, -128,
816
- -23, -128, -27, -128, -128, -128, -128, -128, -128, -128,
817
- -128, -128, -128, -128, -7, -113, -88, -90, -128, -110,
818
- -112, -12, -117, -86, -87, -116, -14, -77, -15, -16,
819
- -128, -20, -24, -28, -31, -34, -37, -43, -128, -46,
820
- -63, -38, -67, -128, -70, -72, -73, -125, -39, -80,
821
- -128, -83, -85, -40, -41, -42, -128, -5, -1, -89,
822
- -114, -91, -128, -128, -13, -118, -119, -120, -74, -128,
823
- -17, -128, -128, -128, -128, -128, -128, -47, -44, -65,
824
- -64, -128, -71, -68, -128, -84, -81, -128, -128, -128,
825
- -96, -128, -128, -78, -128, -21, -25, -29, -32, -35,
826
- -45, -48, -66, -69, -82, -128, -50, -6, -115, -92,
827
- -93, -97, -111, -75, -128, -18, -128, -128, -128, -128,
828
- -128, -128, -128, -96, -95, -86, -110, -101, -128, -128,
829
- -79, -128, -22, -26, -128, -128, -128, -54, -51, -94,
830
- -128, -98, -126, -105, -106, -107, -128, -104, -76, -19,
831
- -30, -121, -123, -124, -33, -36, -49, -52, -55, -128,
832
- -108, -99, -127, -102, -122, -54, -110, -86, -59, -128,
833
- -126, -128, -128, -53, -56, -57, -128, -128, -62, -100,
834
- -109, -110, -128, -60, -103, -58, -128, -110, -61 ]
817
+ -2, -130, -8, -130, -130, -3, -4, -130, 214, -130,
818
+ -9, -10, -11, -130, -130, -130, -130, -130, -130, -130,
819
+ -23, -130, -27, -130, -130, -130, -130, -130, -130, -130,
820
+ -130, -130, -130, -130, -7, -115, -88, -90, -130, -112,
821
+ -114, -12, -119, -86, -87, -118, -14, -77, -15, -16,
822
+ -130, -20, -24, -28, -31, -34, -37, -43, -130, -46,
823
+ -63, -38, -67, -130, -70, -72, -73, -127, -39, -80,
824
+ -130, -83, -85, -40, -41, -42, -130, -5, -1, -89,
825
+ -116, -91, -130, -130, -13, -120, -121, -122, -74, -130,
826
+ -17, -130, -130, -130, -130, -130, -130, -47, -44, -65,
827
+ -64, -130, -71, -68, -130, -84, -81, -130, -130, -130,
828
+ -96, -130, -130, -78, -130, -21, -25, -29, -32, -35,
829
+ -45, -48, -66, -69, -82, -130, -50, -6, -117, -92,
830
+ -93, -97, -113, -75, -130, -18, -130, -130, -130, -130,
831
+ -130, -130, -130, -96, -95, -86, -112, -101, -130, -130,
832
+ -79, -130, -22, -26, -130, -130, -130, -54, -51, -94,
833
+ -130, -98, -128, -105, -106, -107, -130, -104, -76, -19,
834
+ -30, -123, -125, -126, -33, -36, -49, -52, -55, -86,
835
+ -130, -108, -99, -129, -102, -124, -54, -112, -86, -59,
836
+ -130, -130, -128, -130, -110, -130, -53, -56, -57, -130,
837
+ -130, -62, -130, -100, -109, -112, -130, -60, -111, -103,
838
+ -58, -130, -112, -61 ]
835
839
 
836
840
  racc_goto_table = [
837
- 64, 45, 57, 62, 105, 82, 97, 162, 106, 177,
838
- 179, 1, 181, 60, 2, 72, 72, 72, 72, 130,
839
- 184, 4, 35, 36, 184, 184, 68, 73, 74, 75,
840
- 46, 48, 49, 78, 98, 102, 64, 193, 5, 103,
841
- 199, 105, 124, 33, 60, 60, 202, 97, 195, 79,
842
- 108, 10, 159, 170, 174, 175, 72, 72, 11, 105,
843
- 12, 42, 84, 114, 151, 91, 136, 92, 137, 97,
844
- 93, 138, 120, 94, 64, 139, 102, 123, 95, 140,
845
- 56, 61, 99, 60, 121, 60, 125, 176, 197, 206,
846
- 112, 72, 149, 72, 89, 134, 102, 129, 166, 192,
847
- 109, nil, nil, 146, nil, nil, nil, 60, nil, nil,
848
- nil, 72, 161, nil, nil, nil, nil, nil, nil, nil,
849
- nil, 167, nil, nil, nil, nil, nil, nil, nil, nil,
850
- nil, nil, 146, 180, nil, nil, nil, nil, nil, nil,
851
- nil, nil, nil, nil, nil, nil, nil, nil, nil, nil,
852
- 186, nil, 194, nil, nil, nil, nil, nil, nil, nil,
853
- nil, nil, 198, nil, 200, nil, 186, 204, nil, 180,
854
- nil, nil, nil, 208 ]
841
+ 82, 62, 57, 45, 97, 64, 105, 162, 182, 36,
842
+ 177, 1, 2, 180, 106, 60, 4, 72, 72, 72,
843
+ 72, 130, 185, 46, 48, 49, 185, 185, 68, 73,
844
+ 74, 75, 35, 78, 98, 79, 5, 103, 203, 196,
845
+ 102, 64, 194, 105, 202, 97, 60, 60, 124, 198,
846
+ 33, 108, 206, 10, 159, 170, 174, 175, 72, 72,
847
+ 11, 105, 12, 42, 84, 114, 151, 97, 91, 136,
848
+ 92, 137, 120, 93, 138, 123, 94, 139, 95, 64,
849
+ 140, 102, 56, 61, 99, 60, 121, 60, 125, 176,
850
+ 200, 211, 112, 72, 149, 72, 89, 134, 129, 166,
851
+ 195, 102, 109, nil, nil, nil, nil, 161, 146, 60,
852
+ nil, nil, nil, 72, nil, nil, nil, nil, nil, nil,
853
+ nil, nil, nil, nil, nil, nil, 167, nil, nil, nil,
854
+ nil, nil, nil, nil, nil, nil, nil, 146, 181, nil,
855
+ nil, nil, nil, nil, nil, nil, nil, nil, 197, nil,
856
+ nil, nil, nil, nil, nil, 187, nil, nil, nil, nil,
857
+ nil, nil, nil, nil, nil, nil, 209, nil, 201, 181,
858
+ nil, 204, nil, 213, 187, nil, nil, 181 ]
855
859
 
856
860
  racc_goto_check = [
857
- 40, 34, 32, 46, 53, 41, 33, 42, 52, 39,
858
- 43, 1, 59, 34, 2, 34, 34, 34, 34, 58,
859
- 63, 3, 4, 54, 63, 63, 31, 31, 31, 31,
860
- 14, 14, 14, 5, 32, 40, 40, 39, 6, 46,
861
- 59, 53, 52, 7, 34, 34, 43, 33, 42, 54,
862
- 8, 9, 58, 20, 20, 20, 34, 34, 10, 53,
863
- 11, 12, 13, 15, 16, 17, 18, 21, 22, 33,
864
- 23, 24, 32, 25, 40, 26, 40, 46, 27, 28,
865
- 29, 30, 35, 34, 36, 34, 37, 38, 44, 45,
866
- 48, 34, 49, 34, 50, 51, 40, 57, 60, 61,
867
- 62, nil, nil, 40, nil, nil, nil, 34, nil, nil,
868
- nil, 34, 41, nil, nil, nil, nil, nil, nil, nil,
869
- nil, 40, nil, nil, nil, nil, nil, nil, nil, nil,
870
- nil, nil, 40, 40, nil, nil, nil, nil, nil, nil,
871
- nil, nil, nil, nil, nil, nil, nil, nil, nil, nil,
872
- 40, nil, 41, nil, nil, nil, nil, nil, nil, nil,
873
- nil, nil, 40, nil, 40, nil, 40, 41, nil, 40,
874
- nil, nil, nil, 41 ]
861
+ 41, 46, 32, 34, 33, 40, 53, 42, 59, 54,
862
+ 39, 1, 2, 43, 52, 34, 3, 34, 34, 34,
863
+ 34, 58, 63, 14, 14, 14, 63, 63, 31, 31,
864
+ 31, 31, 4, 5, 32, 54, 6, 46, 59, 39,
865
+ 40, 40, 42, 53, 43, 33, 34, 34, 52, 42,
866
+ 7, 8, 43, 9, 58, 20, 20, 20, 34, 34,
867
+ 10, 53, 11, 12, 13, 15, 16, 33, 17, 18,
868
+ 21, 22, 32, 23, 24, 46, 25, 26, 27, 40,
869
+ 28, 40, 29, 30, 35, 34, 36, 34, 37, 38,
870
+ 44, 45, 48, 34, 49, 34, 50, 51, 57, 60,
871
+ 61, 40, 62, nil, nil, nil, nil, 41, 40, 34,
872
+ nil, nil, nil, 34, nil, nil, nil, nil, nil, nil,
873
+ nil, nil, nil, nil, nil, nil, 40, nil, nil, nil,
874
+ nil, nil, nil, nil, nil, nil, nil, 40, 40, nil,
875
+ nil, nil, nil, nil, nil, nil, nil, nil, 41, nil,
876
+ nil, nil, nil, nil, nil, 40, nil, nil, nil, nil,
877
+ nil, nil, nil, nil, nil, nil, 41, nil, 40, 40,
878
+ nil, 40, nil, 41, 40, nil, nil, 40 ]
875
879
 
876
880
  racc_goto_pointer = [
877
- nil, 11, 14, 19, 13, -2, 36, 37, -27, 47,
878
- 54, 56, 47, 20, 15, -27, -71, 14, -49, nil,
879
- -101, 15, -48, 17, -46, 19, -43, 23, -40, 54,
880
- 54, -2, -24, -51, -13, 22, -15, -21, -70, -148,
881
- -27, -34, -139, -150, -100, -114, -24, nil, 2, -41,
882
- 47, -18, -62, -65, 14, nil, nil, -13, -91, -150,
883
- -49, -84, 20, -150 ]
881
+ nil, 11, 12, 14, 23, -2, 34, 44, -26, 49,
882
+ 56, 58, 49, 22, 8, -25, -69, 17, -46, nil,
883
+ -99, 18, -45, 20, -43, 22, -41, 23, -39, 56,
884
+ 56, 0, -24, -53, -11, 24, -13, -19, -68, -147,
885
+ -22, -39, -139, -147, -99, -116, -26, nil, 4, -39,
886
+ 49, -16, -56, -63, 0, nil, nil, -12, -89, -154,
887
+ -48, -84, 22, -148 ]
884
888
 
885
889
  racc_goto_default = [
886
890
  nil, nil, nil, nil, nil, nil, nil, nil, nil, nil,
@@ -1002,28 +1006,30 @@ racc_reduce_table = [
1002
1006
  1, 89, :_reduce_none,
1003
1007
  1, 90, :_reduce_108,
1004
1008
  3, 90, :_reduce_109,
1009
+ 2, 90, :_reduce_110,
1010
+ 4, 90, :_reduce_111,
1005
1011
  0, 88, :_reduce_none,
1006
- 3, 88, :_reduce_111,
1012
+ 3, 88, :_reduce_113,
1007
1013
  1, 103, :_reduce_none,
1008
1014
  0, 52, :_reduce_none,
1009
- 0, 109, :_reduce_114,
1010
- 3, 52, :_reduce_115,
1015
+ 0, 109, :_reduce_116,
1016
+ 3, 52, :_reduce_117,
1011
1017
  1, 59, :_reduce_none,
1012
1018
  0, 60, :_reduce_none,
1013
1019
  1, 60, :_reduce_none,
1014
1020
  1, 60, :_reduce_none,
1015
1021
  1, 60, :_reduce_none,
1016
- 1, 67, :_reduce_121,
1017
- 2, 67, :_reduce_122,
1022
+ 1, 67, :_reduce_123,
1023
+ 2, 67, :_reduce_124,
1018
1024
  1, 110, :_reduce_none,
1019
1025
  1, 110, :_reduce_none,
1020
- 1, 94, :_reduce_125,
1026
+ 1, 94, :_reduce_127,
1021
1027
  0, 106, :_reduce_none,
1022
1028
  1, 106, :_reduce_none ]
1023
1029
 
1024
- racc_reduce_n = 128
1030
+ racc_reduce_n = 130
1025
1031
 
1026
- racc_shift_n = 209
1032
+ racc_shift_n = 214
1027
1033
 
1028
1034
  racc_token_table = {
1029
1035
  false => 0,
@@ -1568,8 +1574,8 @@ module_eval(<<'.,.,', 'parser.y', 203)
1568
1574
 
1569
1575
  module_eval(<<'.,.,', 'parser.y', 207)
1570
1576
  def _reduce_49(val, _values, result)
1571
- builder = Grammar::ParameterizingRuleBuilder.new(val[1].s_value, val[3], val[6])
1572
- @grammar.add_parameterizing_rule_builder(builder)
1577
+ rule = Grammar::ParameterizingRule::Rule.new(val[1].s_value, val[3], val[6])
1578
+ @grammar.add_parameterizing_rule(rule)
1573
1579
 
1574
1580
  result
1575
1581
  end
@@ -1610,7 +1616,7 @@ module_eval(<<'.,.,', 'parser.y', 221)
1610
1616
  module_eval(<<'.,.,', 'parser.y', 227)
1611
1617
  def _reduce_54(val, _values, result)
1612
1618
  reset_precs
1613
- result = Grammar::ParameterizingRuleRhsBuilder.new
1619
+ result = Grammar::ParameterizingRule::Rhs.new
1614
1620
 
1615
1621
  result
1616
1622
  end
@@ -1619,7 +1625,7 @@ module_eval(<<'.,.,', 'parser.y', 227)
1619
1625
  module_eval(<<'.,.,', 'parser.y', 232)
1620
1626
  def _reduce_55(val, _values, result)
1621
1627
  reset_precs
1622
- result = Grammar::ParameterizingRuleRhsBuilder.new
1628
+ result = Grammar::ParameterizingRule::Rhs.new
1623
1629
 
1624
1630
  result
1625
1631
  end
@@ -1933,10 +1939,9 @@ module_eval(<<'.,.,', 'parser.y', 402)
1933
1939
 
1934
1940
  module_eval(<<'.,.,', 'parser.y', 410)
1935
1941
  def _reduce_99(val, _values, result)
1936
- token = Lrama::Lexer::Token::InstantiateRule.new(s_value: val[2], location: @lexer.location, args: [val[1]])
1942
+ token = Lrama::Lexer::Token::InstantiateRule.new(s_value: val[2], location: @lexer.location, args: [val[1]], lhs_tag: val[3])
1937
1943
  builder = val[0]
1938
1944
  builder.add_rhs(token)
1939
- builder.lhs_tag = val[3]
1940
1945
  builder.line = val[1].first_line
1941
1946
  result = builder
1942
1947
 
@@ -1944,12 +1949,11 @@ module_eval(<<'.,.,', 'parser.y', 410)
1944
1949
  end
1945
1950
  .,.,
1946
1951
 
1947
- module_eval(<<'.,.,', 'parser.y', 419)
1952
+ module_eval(<<'.,.,', 'parser.y', 418)
1948
1953
  def _reduce_100(val, _values, result)
1949
- token = Lrama::Lexer::Token::InstantiateRule.new(s_value: val[1].s_value, location: @lexer.location, args: val[3])
1954
+ token = Lrama::Lexer::Token::InstantiateRule.new(s_value: val[1].s_value, location: @lexer.location, args: val[3], lhs_tag: val[5])
1950
1955
  builder = val[0]
1951
1956
  builder.add_rhs(token)
1952
- builder.lhs_tag = val[5]
1953
1957
  builder.line = val[1].first_line
1954
1958
  result = builder
1955
1959
 
@@ -1957,7 +1961,7 @@ module_eval(<<'.,.,', 'parser.y', 419)
1957
1961
  end
1958
1962
  .,.,
1959
1963
 
1960
- module_eval(<<'.,.,', 'parser.y', 428)
1964
+ module_eval(<<'.,.,', 'parser.y', 426)
1961
1965
  def _reduce_101(val, _values, result)
1962
1966
  if @prec_seen
1963
1967
  on_action_error("multiple User_code after %prec", val[0]) if @code_after_prec
@@ -1969,7 +1973,7 @@ module_eval(<<'.,.,', 'parser.y', 428)
1969
1973
  end
1970
1974
  .,.,
1971
1975
 
1972
- module_eval(<<'.,.,', 'parser.y', 436)
1976
+ module_eval(<<'.,.,', 'parser.y', 434)
1973
1977
  def _reduce_102(val, _values, result)
1974
1978
  end_c_declaration
1975
1979
 
@@ -1977,7 +1981,7 @@ module_eval(<<'.,.,', 'parser.y', 436)
1977
1981
  end
1978
1982
  .,.,
1979
1983
 
1980
- module_eval(<<'.,.,', 'parser.y', 440)
1984
+ module_eval(<<'.,.,', 'parser.y', 438)
1981
1985
  def _reduce_103(val, _values, result)
1982
1986
  user_code = val[3]
1983
1987
  user_code.alias_name = val[6]
@@ -1989,7 +1993,7 @@ module_eval(<<'.,.,', 'parser.y', 440)
1989
1993
  end
1990
1994
  .,.,
1991
1995
 
1992
- module_eval(<<'.,.,', 'parser.y', 448)
1996
+ module_eval(<<'.,.,', 'parser.y', 446)
1993
1997
  def _reduce_104(val, _values, result)
1994
1998
  sym = @grammar.find_symbol_by_id!(val[2])
1995
1999
  @prec_seen = true
@@ -2007,35 +2011,49 @@ module_eval(<<'.,.,', 'parser.y', 448)
2007
2011
 
2008
2012
  # reduce 107 omitted
2009
2013
 
2010
- module_eval(<<'.,.,', 'parser.y', 459)
2014
+ module_eval(<<'.,.,', 'parser.y', 457)
2011
2015
  def _reduce_108(val, _values, result)
2012
2016
  result = [val[0]]
2013
2017
  result
2014
2018
  end
2015
2019
  .,.,
2016
2020
 
2017
- module_eval(<<'.,.,', 'parser.y', 460)
2021
+ module_eval(<<'.,.,', 'parser.y', 458)
2018
2022
  def _reduce_109(val, _values, result)
2019
2023
  result = val[0].append(val[2])
2020
2024
  result
2021
2025
  end
2022
2026
  .,.,
2023
2027
 
2024
- # reduce 110 omitted
2028
+ module_eval(<<'.,.,', 'parser.y', 459)
2029
+ def _reduce_110(val, _values, result)
2030
+ result = [Lrama::Lexer::Token::InstantiateRule.new(s_value: val[1].s_value, location: @lexer.location, args: val[0])]
2031
+ result
2032
+ end
2033
+ .,.,
2025
2034
 
2026
- module_eval(<<'.,.,', 'parser.y', 463)
2035
+ module_eval(<<'.,.,', 'parser.y', 460)
2027
2036
  def _reduce_111(val, _values, result)
2028
- result = val[1].s_value
2037
+ result = [Lrama::Lexer::Token::InstantiateRule.new(s_value: val[0].s_value, location: @lexer.location, args: val[2])]
2029
2038
  result
2030
2039
  end
2031
2040
  .,.,
2032
2041
 
2033
2042
  # reduce 112 omitted
2034
2043
 
2035
- # reduce 113 omitted
2044
+ module_eval(<<'.,.,', 'parser.y', 463)
2045
+ def _reduce_113(val, _values, result)
2046
+ result = val[1].s_value
2047
+ result
2048
+ end
2049
+ .,.,
2050
+
2051
+ # reduce 114 omitted
2052
+
2053
+ # reduce 115 omitted
2036
2054
 
2037
2055
  module_eval(<<'.,.,', 'parser.y', 470)
2038
- def _reduce_114(val, _values, result)
2056
+ def _reduce_116(val, _values, result)
2039
2057
  begin_c_declaration('\Z')
2040
2058
  @grammar.epilogue_first_lineno = @lexer.line + 1
2041
2059
 
@@ -2044,7 +2062,7 @@ module_eval(<<'.,.,', 'parser.y', 470)
2044
2062
  .,.,
2045
2063
 
2046
2064
  module_eval(<<'.,.,', 'parser.y', 475)
2047
- def _reduce_115(val, _values, result)
2065
+ def _reduce_117(val, _values, result)
2048
2066
  end_c_declaration
2049
2067
  @grammar.epilogue = val[2].s_value
2050
2068
 
@@ -2052,44 +2070,44 @@ module_eval(<<'.,.,', 'parser.y', 475)
2052
2070
  end
2053
2071
  .,.,
2054
2072
 
2055
- # reduce 116 omitted
2056
-
2057
- # reduce 117 omitted
2058
-
2059
2073
  # reduce 118 omitted
2060
2074
 
2061
2075
  # reduce 119 omitted
2062
2076
 
2063
2077
  # reduce 120 omitted
2064
2078
 
2079
+ # reduce 121 omitted
2080
+
2081
+ # reduce 122 omitted
2082
+
2065
2083
  module_eval(<<'.,.,', 'parser.y', 486)
2066
- def _reduce_121(val, _values, result)
2084
+ def _reduce_123(val, _values, result)
2067
2085
  result = [val[0]]
2068
2086
  result
2069
2087
  end
2070
2088
  .,.,
2071
2089
 
2072
2090
  module_eval(<<'.,.,', 'parser.y', 487)
2073
- def _reduce_122(val, _values, result)
2091
+ def _reduce_124(val, _values, result)
2074
2092
  result = val[0].append(val[1])
2075
2093
  result
2076
2094
  end
2077
2095
  .,.,
2078
2096
 
2079
- # reduce 123 omitted
2097
+ # reduce 125 omitted
2080
2098
 
2081
- # reduce 124 omitted
2099
+ # reduce 126 omitted
2082
2100
 
2083
2101
  module_eval(<<'.,.,', 'parser.y', 492)
2084
- def _reduce_125(val, _values, result)
2102
+ def _reduce_127(val, _values, result)
2085
2103
  result = Lrama::Lexer::Token::Ident.new(s_value: val[0])
2086
2104
  result
2087
2105
  end
2088
2106
  .,.,
2089
2107
 
2090
- # reduce 126 omitted
2108
+ # reduce 128 omitted
2091
2109
 
2092
- # reduce 127 omitted
2110
+ # reduce 129 omitted
2093
2111
 
2094
2112
  def _reduce_none(val, _values, result)
2095
2113
  val[0]
data/lib/lrama/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Lrama
2
- VERSION = "0.6.0".freeze
2
+ VERSION = "0.6.1".freeze
3
3
  end