lrama 0.6.8 → 0.6.9
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/lrama/grammar/parameterizing_rule/rhs.rb +22 -0
- data/lib/lrama/grammar/parameterizing_rule/rule.rb +3 -2
- data/lib/lrama/grammar/rule_builder.rb +2 -2
- data/lib/lrama/parser.rb +122 -122
- data/lib/lrama/version.rb +1 -1
- data/parser.y +2 -2
- data/sig/lrama/grammar/parameterizing_rule/rhs.rbs +1 -0
- data/sig/lrama/grammar/parameterizing_rule/rule.rbs +2 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 9143e179e798e02afb8e7b2b4b1dd64291ac9ec128c851a4b4e660c647531675
|
4
|
+
data.tar.gz: 34613495597d6d8c9334034d7167f34253ca97e910752b446fa6cc26f773a2ce
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a54f5f7096bc3f3f984a7da54945cd3913d02a16882975e99c982f06a2dd70988dba461106f000b54cc26f06c0e62eb294c63d3d35dd606b0e63ff6a17b127d4
|
7
|
+
data.tar.gz: 007f8c7b8cf7ad1690f3b59e505f790273ddfacdab18ede2f1e3667a48309487739310d065fd7c54ee7656f9ee3791e2e1ed29e69726b69a4b861c083b8e5b4e
|
@@ -9,6 +9,28 @@ module Lrama
|
|
9
9
|
@user_code = nil
|
10
10
|
@precedence_sym = nil
|
11
11
|
end
|
12
|
+
|
13
|
+
def resolve_user_code(bindings)
|
14
|
+
return unless user_code
|
15
|
+
|
16
|
+
var_to_arg = {}
|
17
|
+
symbols.each do |sym|
|
18
|
+
resolved_sym = bindings.resolve_symbol(sym)
|
19
|
+
if resolved_sym != sym
|
20
|
+
var_to_arg[sym.s_value] = resolved_sym.s_value
|
21
|
+
end
|
22
|
+
end
|
23
|
+
|
24
|
+
var_to_arg.each do |var, arg|
|
25
|
+
user_code.references.each do |ref|
|
26
|
+
if ref.name == var
|
27
|
+
ref.name = arg
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
31
|
+
|
32
|
+
return user_code
|
33
|
+
end
|
12
34
|
end
|
13
35
|
end
|
14
36
|
end
|
@@ -2,12 +2,13 @@ module Lrama
|
|
2
2
|
class Grammar
|
3
3
|
class ParameterizingRule
|
4
4
|
class Rule
|
5
|
-
attr_reader :name, :parameters, :rhs_list, :required_parameters_count, :is_inline
|
5
|
+
attr_reader :name, :parameters, :rhs_list, :required_parameters_count, :tag, :is_inline
|
6
6
|
|
7
|
-
def initialize(name, parameters, rhs_list, is_inline: false)
|
7
|
+
def initialize(name, parameters, rhs_list, tag: nil, is_inline: false)
|
8
8
|
@name = name
|
9
9
|
@parameters = parameters
|
10
10
|
@rhs_list = rhs_list
|
11
|
+
@tag = tag
|
11
12
|
@is_inline = is_inline
|
12
13
|
@required_parameters_count = parameters.count
|
13
14
|
end
|
@@ -130,12 +130,12 @@ module Lrama
|
|
130
130
|
@replaced_rhs << lhs_token
|
131
131
|
parameterizing_rule_resolver.created_lhs_list << lhs_token
|
132
132
|
parameterizing_rule.rhs_list.each do |r|
|
133
|
-
rule_builder = RuleBuilder.new(@rule_counter, @midrule_action_counter, lhs_tag: token.lhs_tag)
|
133
|
+
rule_builder = RuleBuilder.new(@rule_counter, @midrule_action_counter, lhs_tag: token.lhs_tag || parameterizing_rule.tag)
|
134
134
|
rule_builder.lhs = lhs_token
|
135
135
|
r.symbols.each { |sym| rule_builder.add_rhs(bindings.resolve_symbol(sym)) }
|
136
136
|
rule_builder.line = line
|
137
137
|
rule_builder.precedence_sym = r.precedence_sym
|
138
|
-
rule_builder.user_code = r.
|
138
|
+
rule_builder.user_code = r.resolve_user_code(bindings)
|
139
139
|
rule_builder.complete_input
|
140
140
|
rule_builder.setup_rules(parameterizing_rule_resolver)
|
141
141
|
@rule_builders_for_parameterizing_rules << rule_builder
|
data/lib/lrama/parser.rb
CHANGED
@@ -732,43 +732,43 @@ end
|
|
732
732
|
##### State transition tables begin ###
|
733
733
|
|
734
734
|
racc_action_table = [
|
735
|
-
98, 51, 99, 163, 88, 79, 51, 51,
|
736
|
-
79, 79, 51, 162,
|
737
|
-
3, 50,
|
735
|
+
98, 51, 99, 163, 88, 79, 51, 51, 180, 163,
|
736
|
+
79, 79, 51, 162, 180, 156, 79, 165, 157, 51,
|
737
|
+
3, 50, 181, 165, 70, 51, 8, 50, 181, 79,
|
738
738
|
75, 51, 6, 50, 7, 161, 82, 47, 51, 51,
|
739
739
|
50, 50, 89, 82, 82, 166, 41, 51, 100, 50,
|
740
|
-
|
740
|
+
182, 166, 82, 51, 48, 50, 182, 23, 25, 26,
|
741
741
|
27, 28, 29, 30, 31, 32, 33, 34, 35, 36,
|
742
|
-
37, 38, 47, 51, 51, 50, 50, 93, 79,
|
743
|
-
51, 51, 50, 50, 79,
|
744
|
-
79,
|
742
|
+
37, 38, 47, 51, 51, 50, 50, 93, 79, 197,
|
743
|
+
51, 51, 50, 50, 79, 197, 51, 51, 50, 50,
|
744
|
+
79, 197, 23, 25, 26, 27, 28, 29, 30, 31,
|
745
745
|
32, 33, 34, 35, 36, 37, 38, 9, 51, 54,
|
746
746
|
50, 14, 15, 16, 17, 18, 19, 54, 54, 20,
|
747
747
|
21, 22, 23, 25, 26, 27, 28, 29, 30, 31,
|
748
748
|
32, 33, 34, 35, 36, 37, 38, 39, 51, 51,
|
749
|
-
50, 50, 79,
|
750
|
-
51, 51, 50, 50, 79,
|
749
|
+
50, 50, 79, 197, 51, 51, 50, 50, 79, 197,
|
750
|
+
51, 51, 50, 50, 79, 197, 51, 51, 50, 50,
|
751
751
|
79, 79, 51, 51, 50, 50, 79, 79, 51, 51,
|
752
|
-
50, 50, 79, 79, 51, 51, 50,
|
753
|
-
51, 51,
|
754
|
-
79,
|
755
|
-
|
756
|
-
|
752
|
+
50, 50, 79, 79, 51, 51, 50, 207, 79, 79,
|
753
|
+
51, 51, 207, 207, 79, 79, 51, 51, 50, 50,
|
754
|
+
79, 187, 188, 189, 96, 187, 188, 189, 96, 217,
|
755
|
+
221, 229, 218, 218, 218, 51, 51, 50, 50, 187,
|
756
|
+
188, 189, 57, 58, 59, 60, 61, 62, 63, 64,
|
757
757
|
65, 66, 67, 90, 94, 96, 101, 101, 101, 103,
|
758
758
|
109, 113, 114, 117, 117, 117, 117, 120, 47, 124,
|
759
759
|
125, 127, 129, 130, 131, 132, 133, 136, 140, 141,
|
760
760
|
142, 143, 146, 147, 148, 150, 160, 168, 170, 171,
|
761
|
-
172, 173, 174,
|
762
|
-
|
763
|
-
|
761
|
+
172, 173, 174, 176, 177, 178, 146, 184, 192, 193,
|
762
|
+
200, 160, 204, 176, 211, 160, 215, 216, 178, 176,
|
763
|
+
226, 176, 228, 96, 96, 176 ]
|
764
764
|
|
765
765
|
racc_action_check = [
|
766
|
-
49, 145, 49, 145, 39, 145, 159,
|
767
|
-
159,
|
768
|
-
1, 33, 159,
|
766
|
+
49, 145, 49, 145, 39, 145, 159, 183, 159, 183,
|
767
|
+
159, 183, 201, 144, 201, 139, 201, 145, 139, 33,
|
768
|
+
1, 33, 159, 183, 33, 34, 3, 34, 201, 34,
|
769
769
|
34, 35, 2, 35, 2, 144, 35, 9, 36, 37,
|
770
770
|
36, 37, 39, 36, 37, 145, 7, 38, 49, 38,
|
771
|
-
159,
|
771
|
+
159, 183, 38, 15, 14, 15, 201, 9, 9, 9,
|
772
772
|
9, 9, 9, 9, 9, 9, 9, 9, 9, 9,
|
773
773
|
9, 9, 42, 69, 172, 69, 172, 42, 172, 172,
|
774
774
|
173, 70, 173, 70, 173, 173, 174, 81, 174, 81,
|
@@ -776,22 +776,22 @@ racc_action_check = [
|
|
776
776
|
42, 42, 42, 42, 42, 42, 42, 4, 82, 16,
|
777
777
|
82, 4, 4, 4, 4, 4, 4, 17, 18, 4,
|
778
778
|
4, 4, 4, 4, 4, 4, 4, 4, 4, 4,
|
779
|
-
4, 4, 4, 4, 4, 4, 4, 4,
|
780
|
-
|
781
|
-
|
779
|
+
4, 4, 4, 4, 4, 4, 4, 4, 194, 109,
|
780
|
+
194, 109, 194, 194, 198, 111, 198, 111, 198, 198,
|
781
|
+
199, 117, 199, 117, 199, 199, 74, 75, 74, 75,
|
782
782
|
74, 75, 114, 116, 114, 116, 114, 116, 137, 166,
|
783
|
-
137, 166, 137, 166,
|
784
|
-
|
785
|
-
|
786
|
-
|
787
|
-
|
783
|
+
137, 166, 137, 166, 182, 184, 182, 184, 182, 184,
|
784
|
+
204, 216, 204, 216, 204, 216, 218, 119, 218, 119,
|
785
|
+
218, 164, 164, 164, 164, 179, 179, 179, 179, 208,
|
786
|
+
214, 223, 208, 214, 223, 134, 138, 134, 138, 209,
|
787
|
+
209, 209, 19, 20, 23, 25, 26, 27, 28, 29,
|
788
788
|
30, 31, 32, 40, 45, 46, 53, 55, 56, 57,
|
789
789
|
68, 72, 73, 80, 85, 86, 87, 88, 89, 95,
|
790
790
|
96, 102, 104, 105, 106, 107, 108, 112, 120, 121,
|
791
791
|
122, 123, 124, 125, 126, 128, 141, 149, 151, 152,
|
792
792
|
153, 154, 155, 156, 157, 158, 161, 163, 167, 169,
|
793
|
-
175,
|
794
|
-
220, 221,
|
793
|
+
175, 178, 180, 186, 190, 200, 205, 207, 213, 217,
|
794
|
+
220, 221, 222, 226, 228, 230 ]
|
795
795
|
|
796
796
|
racc_action_pointer = [
|
797
797
|
nil, 20, 22, 26, 98, nil, nil, 39, nil, 33,
|
@@ -809,18 +809,18 @@ racc_action_pointer = [
|
|
809
809
|
243, 207, 239, 249, 206, 201, 252, nil, 253, nil,
|
810
810
|
nil, nil, nil, nil, 202, nil, nil, 165, 203, -26,
|
811
811
|
nil, 210, nil, nil, -10, -2, nil, nil, nil, 237,
|
812
|
-
nil, 238, 239, 240, 241, 242,
|
812
|
+
nil, 238, 239, 240, 241, 242, 255, 259, 220, 3,
|
813
813
|
nil, 220, nil, 227, 143, nil, 166, 248, nil, 249,
|
814
|
-
nil, nil, 71, 77, 83,
|
815
|
-
nil, 171, 4, 172, nil, 265, nil, nil, nil,
|
816
|
-
nil, nil, nil, 135, nil, nil, nil, 141, 147,
|
817
|
-
9, nil, nil, 177, 274, nil, 237, 158, 161,
|
818
|
-
nil, nil, nil, 159, nil, 178,
|
819
|
-
|
820
|
-
nil, nil ]
|
814
|
+
nil, nil, 71, 77, 83, 228, nil, nil, 225, 147,
|
815
|
+
232, nil, 171, 4, 172, nil, 265, nil, nil, nil,
|
816
|
+
272, nil, nil, nil, 135, nil, nil, nil, 141, 147,
|
817
|
+
229, 9, nil, nil, 177, 274, nil, 237, 158, 161,
|
818
|
+
nil, nil, nil, 233, 159, nil, 178, 271, 183, nil,
|
819
|
+
260, 273, 262, 160, nil, nil, 232, nil, 233, nil,
|
820
|
+
277, nil, nil ]
|
821
821
|
|
822
822
|
racc_action_default = [
|
823
|
-
-2, -138, -8, -138, -138, -3, -4, -138,
|
823
|
+
-2, -138, -8, -138, -138, -3, -4, -138, 233, -138,
|
824
824
|
-9, -10, -11, -12, -138, -138, -138, -138, -138, -138,
|
825
825
|
-138, -24, -25, -138, -29, -138, -138, -138, -138, -138,
|
826
826
|
-138, -138, -138, -138, -138, -138, -138, -138, -138, -138,
|
@@ -835,75 +835,75 @@ racc_action_default = [
|
|
835
835
|
-138, -138, -138, -138, -104, -138, -138, -86, -138, -22,
|
836
836
|
-27, -31, -34, -37, -52, -55, -74, -77, -90, -138,
|
837
837
|
-58, -62, -6, -125, -100, -101, -105, -121, -83, -138,
|
838
|
-
-19, -138, -138, -138, -138, -138, -
|
838
|
+
-19, -138, -138, -138, -138, -138, -136, -138, -57, -60,
|
839
839
|
-63, -104, -103, -94, -120, -109, -138, -138, -87, -138,
|
840
|
-
-23, -28, -138, -138, -138,
|
841
|
-
-67, -138, -102, -138, -106, -136, -113, -114, -115,
|
842
|
-
-112, -84, -20, -32, -131, -133, -134, -35, -38,
|
843
|
-
-61, -64, -65, -138, -138, -70, -94, -138, -116,
|
844
|
-
-
|
845
|
-
-136, -138, -138, -108, -117, -120, -66, -120, -119,
|
846
|
-
-69, -111 ]
|
840
|
+
-23, -28, -138, -138, -138, -138, -137, -59, -62, -120,
|
841
|
+
-94, -67, -138, -102, -138, -106, -136, -113, -114, -115,
|
842
|
+
-138, -112, -84, -20, -32, -131, -133, -134, -35, -38,
|
843
|
+
-62, -61, -64, -65, -138, -138, -70, -94, -138, -116,
|
844
|
+
-107, -110, -132, -56, -138, -68, -138, -136, -138, -118,
|
845
|
+
-138, -136, -138, -138, -108, -117, -120, -66, -120, -119,
|
846
|
+
-136, -69, -111 ]
|
847
847
|
|
848
848
|
racc_goto_table = [
|
849
|
-
76, 95, 69, 52, 74,
|
850
|
-
|
851
|
-
|
852
|
-
|
853
|
-
115, 76,
|
854
|
-
|
855
|
-
|
856
|
-
84, 110,
|
857
|
-
76,
|
858
|
-
121,
|
859
|
-
|
860
|
-
nil, 164, nil, nil, nil, nil, nil, nil, nil,
|
861
|
-
nil, nil, 72, nil, nil,
|
862
|
-
nil, nil,
|
863
|
-
nil, nil, nil, nil, nil, nil, nil,
|
864
|
-
|
865
|
-
nil, nil, nil, nil, nil, nil,
|
866
|
-
|
867
|
-
|
849
|
+
76, 95, 69, 52, 74, 158, 110, 175, 118, 119,
|
850
|
+
145, 208, 1, 212, 186, 2, 43, 212, 212, 4,
|
851
|
+
42, 72, 91, 84, 84, 84, 84, 5, 40, 203,
|
852
|
+
122, 214, 80, 85, 86, 87, 10, 210, 11, 111,
|
853
|
+
115, 76, 12, 223, 138, 116, 118, 183, 110, 92,
|
854
|
+
53, 55, 56, 194, 198, 199, 13, 72, 72, 219,
|
855
|
+
49, 97, 128, 169, 213, 118, 104, 151, 224, 84,
|
856
|
+
84, 110, 227, 105, 152, 106, 153, 107, 134, 154,
|
857
|
+
76, 232, 115, 108, 137, 155, 68, 73, 112, 135,
|
858
|
+
139, 121, 201, 205, 222, 126, 167, 72, 102, 72,
|
859
|
+
149, 144, 190, 115, 220, 84, 123, 84, nil, nil,
|
860
|
+
nil, 164, nil, nil, nil, nil, nil, nil, nil, 185,
|
861
|
+
nil, nil, 72, nil, nil, 179, 84, nil, nil, nil,
|
862
|
+
nil, nil, 191, nil, 202, nil, nil, nil, nil, nil,
|
863
|
+
nil, nil, nil, nil, nil, nil, nil, nil, 206, 164,
|
864
|
+
209, nil, nil, nil, nil, nil, nil, nil, nil, nil,
|
865
|
+
nil, nil, nil, nil, nil, nil, nil, 179, nil, nil,
|
866
|
+
209, nil, nil, nil, nil, nil, nil, nil, nil, nil,
|
867
|
+
nil, 230, 209, 231, 225 ]
|
868
868
|
|
869
869
|
racc_goto_check = [
|
870
|
-
|
871
|
-
|
872
|
-
|
873
|
-
|
874
|
-
|
875
|
-
|
876
|
-
|
877
|
-
35, 34,
|
878
|
-
|
879
|
-
|
880
|
-
59, 61, 62,
|
881
|
-
nil,
|
882
|
-
nil, nil, 35, nil, nil,
|
883
|
-
nil, nil,
|
884
|
-
nil, nil, nil, nil, nil, nil, nil,
|
885
|
-
|
886
|
-
nil, nil, nil, nil, nil, nil,
|
887
|
-
|
888
|
-
43,
|
870
|
+
43, 44, 33, 35, 49, 40, 34, 39, 56, 55,
|
871
|
+
60, 46, 1, 64, 45, 2, 57, 64, 64, 3,
|
872
|
+
4, 35, 5, 35, 35, 35, 35, 6, 7, 45,
|
873
|
+
8, 46, 32, 32, 32, 32, 9, 39, 10, 33,
|
874
|
+
43, 43, 11, 46, 55, 49, 56, 60, 34, 57,
|
875
|
+
15, 15, 15, 21, 21, 21, 12, 35, 35, 45,
|
876
|
+
13, 14, 16, 17, 40, 56, 18, 19, 39, 35,
|
877
|
+
35, 34, 39, 22, 23, 24, 25, 26, 33, 27,
|
878
|
+
43, 39, 43, 28, 49, 29, 30, 31, 36, 37,
|
879
|
+
38, 41, 42, 47, 48, 51, 52, 35, 53, 35,
|
880
|
+
54, 59, 61, 43, 62, 35, 63, 35, nil, nil,
|
881
|
+
nil, 43, nil, nil, nil, nil, nil, nil, nil, 44,
|
882
|
+
nil, nil, 35, nil, nil, 43, 35, nil, nil, nil,
|
883
|
+
nil, nil, 43, nil, 44, nil, nil, nil, nil, nil,
|
884
|
+
nil, nil, nil, nil, nil, nil, nil, nil, 43, 43,
|
885
|
+
43, nil, nil, nil, nil, nil, nil, nil, nil, nil,
|
886
|
+
nil, nil, nil, nil, nil, nil, nil, 43, nil, nil,
|
887
|
+
43, nil, nil, nil, nil, nil, nil, nil, nil, nil,
|
888
|
+
nil, 44, 43, 44, 43 ]
|
889
889
|
|
890
890
|
racc_goto_pointer = [
|
891
|
-
nil,
|
892
|
-
|
893
|
-
nil, -
|
894
|
-
|
895
|
-
|
896
|
-
nil, -
|
897
|
-
-
|
891
|
+
nil, 12, 15, 17, 11, -20, 25, 22, -60, 32,
|
892
|
+
34, 38, 52, 45, 12, 34, -41, -87, 8, -62,
|
893
|
+
nil, -119, 14, -56, 15, -55, 16, -53, 21, -48,
|
894
|
+
53, 53, -3, -31, -63, -12, 16, -23, -30, -149,
|
895
|
+
-136, 2, -86, -34, -45, -150, -173, -88, -121, -30,
|
896
|
+
nil, -6, -52, 44, -27, -73, -73, 7, nil, -23,
|
897
|
+
-114, -63, -107, 13, -181 ]
|
898
898
|
|
899
899
|
racc_goto_default = [
|
900
900
|
nil, nil, nil, nil, nil, nil, nil, nil, nil, nil,
|
901
901
|
45, nil, nil, nil, nil, nil, nil, nil, nil, nil,
|
902
902
|
24, nil, nil, nil, nil, nil, nil, nil, nil, nil,
|
903
903
|
nil, nil, nil, nil, 71, 77, nil, nil, nil, nil,
|
904
|
-
46, 159,
|
904
|
+
nil, 46, 159, 196, nil, nil, nil, nil, nil, nil,
|
905
905
|
78, nil, nil, nil, nil, 81, 83, nil, 44, nil,
|
906
|
-
nil, nil, nil, nil,
|
906
|
+
nil, nil, nil, nil, 195 ]
|
907
907
|
|
908
908
|
racc_reduce_table = [
|
909
909
|
0, 0, :racc_error,
|
@@ -962,21 +962,21 @@ racc_reduce_table = [
|
|
962
962
|
1, 87, :_reduce_53,
|
963
963
|
2, 87, :_reduce_54,
|
964
964
|
3, 88, :_reduce_55,
|
965
|
-
|
965
|
+
8, 65, :_reduce_56,
|
966
966
|
5, 66, :_reduce_57,
|
967
967
|
1, 92, :_reduce_58,
|
968
968
|
3, 92, :_reduce_59,
|
969
|
-
1,
|
970
|
-
3,
|
971
|
-
0,
|
972
|
-
1,
|
973
|
-
3,
|
974
|
-
3,
|
975
|
-
6,
|
969
|
+
1, 94, :_reduce_60,
|
970
|
+
3, 94, :_reduce_61,
|
971
|
+
0, 96, :_reduce_62,
|
972
|
+
1, 96, :_reduce_63,
|
973
|
+
3, 96, :_reduce_64,
|
974
|
+
3, 96, :_reduce_65,
|
975
|
+
6, 96, :_reduce_66,
|
976
976
|
0, 101, :_reduce_67,
|
977
977
|
0, 102, :_reduce_68,
|
978
|
-
7,
|
979
|
-
3,
|
978
|
+
7, 96, :_reduce_69,
|
979
|
+
3, 96, :_reduce_70,
|
980
980
|
0, 90, :_reduce_none,
|
981
981
|
1, 90, :_reduce_none,
|
982
982
|
0, 91, :_reduce_none,
|
@@ -986,8 +986,8 @@ racc_reduce_table = [
|
|
986
986
|
3, 85, :_reduce_77,
|
987
987
|
1, 103, :_reduce_78,
|
988
988
|
2, 103, :_reduce_79,
|
989
|
-
1,
|
990
|
-
1,
|
989
|
+
1, 97, :_reduce_none,
|
990
|
+
1, 97, :_reduce_none,
|
991
991
|
0, 105, :_reduce_82,
|
992
992
|
0, 106, :_reduce_83,
|
993
993
|
6, 69, :_reduce_84,
|
@@ -1019,16 +1019,16 @@ racc_reduce_table = [
|
|
1019
1019
|
0, 116, :_reduce_110,
|
1020
1020
|
8, 114, :_reduce_111,
|
1021
1021
|
3, 114, :_reduce_112,
|
1022
|
-
1,
|
1023
|
-
1,
|
1024
|
-
1,
|
1025
|
-
1,
|
1026
|
-
3,
|
1027
|
-
2,
|
1028
|
-
4,
|
1029
|
-
0,
|
1030
|
-
3,
|
1031
|
-
1,
|
1022
|
+
1, 99, :_reduce_113,
|
1023
|
+
1, 99, :_reduce_114,
|
1024
|
+
1, 99, :_reduce_115,
|
1025
|
+
1, 100, :_reduce_116,
|
1026
|
+
3, 100, :_reduce_117,
|
1027
|
+
2, 100, :_reduce_118,
|
1028
|
+
4, 100, :_reduce_119,
|
1029
|
+
0, 98, :_reduce_none,
|
1030
|
+
3, 98, :_reduce_121,
|
1031
|
+
1, 95, :_reduce_none,
|
1032
1032
|
0, 59, :_reduce_none,
|
1033
1033
|
0, 117, :_reduce_124,
|
1034
1034
|
3, 59, :_reduce_125,
|
@@ -1042,12 +1042,12 @@ racc_reduce_table = [
|
|
1042
1042
|
1, 118, :_reduce_none,
|
1043
1043
|
1, 118, :_reduce_none,
|
1044
1044
|
1, 104, :_reduce_135,
|
1045
|
-
0,
|
1046
|
-
1,
|
1045
|
+
0, 93, :_reduce_none,
|
1046
|
+
1, 93, :_reduce_none ]
|
1047
1047
|
|
1048
1048
|
racc_reduce_n = 138
|
1049
1049
|
|
1050
|
-
racc_shift_n =
|
1050
|
+
racc_shift_n = 233
|
1051
1051
|
|
1052
1052
|
racc_token_table = {
|
1053
1053
|
false => 0,
|
@@ -1220,6 +1220,7 @@ Racc_token_to_s_table = [
|
|
1220
1220
|
"int_opt",
|
1221
1221
|
"alias",
|
1222
1222
|
"rule_args",
|
1223
|
+
"tag_opt",
|
1223
1224
|
"rule_rhs_list",
|
1224
1225
|
"id_colon",
|
1225
1226
|
"rule_rhs",
|
@@ -1227,7 +1228,6 @@ Racc_token_to_s_table = [
|
|
1227
1228
|
"named_ref_opt",
|
1228
1229
|
"parameterizing_suffix",
|
1229
1230
|
"parameterizing_args",
|
1230
|
-
"tag_opt",
|
1231
1231
|
"@15",
|
1232
1232
|
"@16",
|
1233
1233
|
"symbol_declaration_list",
|
@@ -1666,7 +1666,7 @@ module_eval(<<'.,.,', 'parser.y', 232)
|
|
1666
1666
|
|
1667
1667
|
module_eval(<<'.,.,', 'parser.y', 236)
|
1668
1668
|
def _reduce_56(val, _values, result)
|
1669
|
-
rule = Grammar::ParameterizingRule::Rule.new(val[1].s_value, val[3], val[
|
1669
|
+
rule = Grammar::ParameterizingRule::Rule.new(val[1].s_value, val[3], val[7], tag: val[5])
|
1670
1670
|
@grammar.add_parameterizing_rule(rule)
|
1671
1671
|
|
1672
1672
|
result
|
data/lib/lrama/version.rb
CHANGED
data/parser.y
CHANGED
@@ -232,9 +232,9 @@ rule
|
|
232
232
|
|
233
233
|
token_declaration: id int_opt alias { result = val }
|
234
234
|
|
235
|
-
rule_declaration: "%rule" IDENTIFIER "(" rule_args ")" ":" rule_rhs_list
|
235
|
+
rule_declaration: "%rule" IDENTIFIER "(" rule_args ")" tag_opt ":" rule_rhs_list
|
236
236
|
{
|
237
|
-
rule = Grammar::ParameterizingRule::Rule.new(val[1].s_value, val[3], val[
|
237
|
+
rule = Grammar::ParameterizingRule::Rule.new(val[1].s_value, val[3], val[7], tag: val[5])
|
238
238
|
@grammar.add_parameterizing_rule(rule)
|
239
239
|
}
|
240
240
|
|
@@ -6,9 +6,10 @@ module Lrama
|
|
6
6
|
attr_reader parameters: Array[Lexer::Token]
|
7
7
|
attr_reader rhs_list: Array[Grammar::ParameterizingRule::Rhs]
|
8
8
|
attr_reader required_parameters_count: Integer
|
9
|
+
attr_reader tag: Lexer::Token::Tag?
|
9
10
|
attr_reader is_inline: bool
|
10
11
|
|
11
|
-
def initialize: (String name, Array[Lexer::Token] parameters, Array[Grammar::ParameterizingRule::Rhs] rhs_list, ?is_inline: bool) -> void
|
12
|
+
def initialize: (String name, Array[Lexer::Token] parameters, Array[Grammar::ParameterizingRule::Rhs] rhs_list, ?tag: Lexer::Token::Tag, ?is_inline: bool) -> void
|
12
13
|
end
|
13
14
|
end
|
14
15
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: lrama
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.6.
|
4
|
+
version: 0.6.9
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Yuichiro Kaneko
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2024-
|
11
|
+
date: 2024-05-02 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description: LALR (1) parser generator written by Ruby
|
14
14
|
email:
|