rison-rb 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.github/workflows/build.yml +30 -0
- data/.gitignore +16 -0
- data/.rspec +3 -0
- data/CHANGELOG.md +3 -0
- data/CODE_OF_CONDUCT.md +74 -0
- data/Gemfile +4 -0
- data/LICENSE.txt +21 -0
- data/README.md +82 -0
- data/Rakefile +16 -0
- data/bin/console +14 -0
- data/bin/setup +8 -0
- data/lib/rison.rb +66 -0
- data/lib/rison/array/dumper.rb +18 -0
- data/lib/rison/array/parser.rb +610 -0
- data/lib/rison/array/parser.y +131 -0
- data/lib/rison/dumper.rb +34 -0
- data/lib/rison/object/dumper.rb +18 -0
- data/lib/rison/object/parser.rb +606 -0
- data/lib/rison/object/parser.y +131 -0
- data/lib/rison/parser.rb +596 -0
- data/lib/rison/parser.y +130 -0
- data/lib/rison/version.rb +3 -0
- data/rison-rb.gemspec +33 -0
- metadata +126 -0
@@ -0,0 +1,131 @@
|
|
1
|
+
class Rison::Object::Parser
|
2
|
+
rule
|
3
|
+
|
4
|
+
target: QUOTE QUOTE { result = {} }
|
5
|
+
| members
|
6
|
+
|
7
|
+
object: LPAREN RPAREN { result = {} }
|
8
|
+
| LPAREN members RPAREN { result = val[1] }
|
9
|
+
|
10
|
+
members: pair
|
11
|
+
| pair COMMA members { result = val[0].merge(val[2]) }
|
12
|
+
|
13
|
+
pair: key COLON value { result = { val[0] => val[2] } }
|
14
|
+
|
15
|
+
array: EXCLAM LPAREN RPAREN { result = [] }
|
16
|
+
| EXCLAM LPAREN elements RPAREN { result = val[2] }
|
17
|
+
|
18
|
+
elements: value { result = [val[0]] }
|
19
|
+
| value COMMA elements { result = val[2].unshift(val[0]) }
|
20
|
+
|
21
|
+
key: id | string
|
22
|
+
|
23
|
+
value: id | string | number | object | array | bool | null
|
24
|
+
|
25
|
+
bool: EXCLAM T { result = true }
|
26
|
+
| EXCLAM F { result = false }
|
27
|
+
|
28
|
+
null: EXCLAM N { result = nil }
|
29
|
+
|
30
|
+
id: idstart
|
31
|
+
| idstart idchars { result = val[0] + val[1] }
|
32
|
+
|
33
|
+
idchars: idchar
|
34
|
+
| idchar idchars { result = val[0] + val[1] }
|
35
|
+
|
36
|
+
idchar: IDCHAR | idstart | MINUS | DIGIT
|
37
|
+
|
38
|
+
idstart: IDSTART | E | T | F | N | DOT
|
39
|
+
|
40
|
+
string: QUOTE QUOTE { result = '' }
|
41
|
+
| QUOTE strchars QUOTE { result = val[1] }
|
42
|
+
|
43
|
+
strchars: strchar
|
44
|
+
| strchar strchars { result = val[0] + val[1] }
|
45
|
+
|
46
|
+
strchar: STRCHAR
|
47
|
+
| idchar
|
48
|
+
| EXCLAM EXCLAM { result = '!' }
|
49
|
+
| EXCLAM QUOTE { result = "'" }
|
50
|
+
| COLON
|
51
|
+
| LPAREN
|
52
|
+
| RPAREN
|
53
|
+
| COMMA
|
54
|
+
|
55
|
+
number: int { result = val[0].to_i }
|
56
|
+
| int frac { result = "#{val[0]}#{val[1]}".to_f }
|
57
|
+
| int exp { result = "#{val[0]}#{val[1]}".to_f }
|
58
|
+
| int frac exp { result = "#{val[0]}#{val[1]}#{val[2]}".to_f }
|
59
|
+
|
60
|
+
int : DIGIT { result = val[0].to_i }
|
61
|
+
| DIGIT digits { result = "#{val[0]}#{val[1]}".to_i }
|
62
|
+
| MINUS DIGIT { result = "-#{val[1]}".to_i }
|
63
|
+
| MINUS DIGIT digits { result = "-#{val[1]}#{val[2]}".to_i }
|
64
|
+
|
65
|
+
frac: DOT digits { result = "#{val[0]}#{val[1]}" }
|
66
|
+
|
67
|
+
exp: e digits { result = "#{val[0]}#{val[1]}" }
|
68
|
+
|
69
|
+
digits: DIGIT
|
70
|
+
| DIGIT digits { result = "#{val[0]}#{val[1]}" }
|
71
|
+
|
72
|
+
e: E { result = 'e' }
|
73
|
+
| E MINUS { result = "e-" }
|
74
|
+
|
75
|
+
---- inner
|
76
|
+
|
77
|
+
attr_reader :source, :input
|
78
|
+
|
79
|
+
def initialize(source)
|
80
|
+
@source = source
|
81
|
+
@input = StringScanner.new(source)
|
82
|
+
end
|
83
|
+
|
84
|
+
def self.parse(source)
|
85
|
+
self.new(source).do_parse
|
86
|
+
rescue Racc::ParseError => exn
|
87
|
+
raise ParserError.new("#{exn.message} in #{source}")
|
88
|
+
end
|
89
|
+
|
90
|
+
def next_token
|
91
|
+
case
|
92
|
+
when input.eos?
|
93
|
+
[false, false]
|
94
|
+
when input.scan(/'/)
|
95
|
+
[:QUOTE, input.matched]
|
96
|
+
when input.scan(/\(/)
|
97
|
+
[:LPAREN, input.matched]
|
98
|
+
when input.scan(/\)/)
|
99
|
+
[:RPAREN, input.matched]
|
100
|
+
when input.scan(/:/)
|
101
|
+
[:COLON, input.matched]
|
102
|
+
when input.scan(/\./)
|
103
|
+
[:DOT, input.matched]
|
104
|
+
when input.scan(/\,/)
|
105
|
+
[:COMMA, input.matched]
|
106
|
+
when input.scan(/!/)
|
107
|
+
[:EXCLAM, input.matched]
|
108
|
+
when input.scan(/\-/)
|
109
|
+
[:MINUS, input.matched]
|
110
|
+
when input.scan(/e/)
|
111
|
+
[:E, input.matched]
|
112
|
+
when input.scan(/t/)
|
113
|
+
[:T, input.matched]
|
114
|
+
when input.scan(/f/)
|
115
|
+
[:F, input.matched]
|
116
|
+
when input.scan(/n/)
|
117
|
+
[:N, input.matched]
|
118
|
+
# Originally, 0 is not allowed at the beginning of the number, but rison.js accepts this.
|
119
|
+
when input.scan(/[0-9]/)
|
120
|
+
[:DIGIT, input.matched]
|
121
|
+
# IDSTART and IDCHAR should originally accept only the ASCII symbols `-_./~`, but rison.js accepts other symbols.
|
122
|
+
# @see https://rison.io/
|
123
|
+
# @see https://github.com/Nanonid/rison/blob/e64af6c096fd30950ec32cfd48526ca6ee21649d/js/rison.js#L77-L84
|
124
|
+
when input.scan(/[^\-0-9 '!:\(\),\*@\$]/)
|
125
|
+
[:IDSTART, input.matched]
|
126
|
+
when input.scan(/[^ '!:\(\),\*@\$]/)
|
127
|
+
[:IDCHAR, input.matched]
|
128
|
+
when input.scan(/[^\'\!]/)
|
129
|
+
[:STRCHAR, input.matched]
|
130
|
+
end
|
131
|
+
end
|
data/lib/rison/parser.rb
ADDED
@@ -0,0 +1,596 @@
|
|
1
|
+
#
|
2
|
+
# DO NOT MODIFY!!!!
|
3
|
+
# This file is automatically generated by Racc 1.4.15
|
4
|
+
# from Racc grammer file "".
|
5
|
+
#
|
6
|
+
|
7
|
+
require 'racc/parser.rb'
|
8
|
+
module Rison
|
9
|
+
class Parser < Racc::Parser
|
10
|
+
|
11
|
+
module_eval(<<'...end parser.y/module_eval...', 'parser.y', 75)
|
12
|
+
|
13
|
+
attr_reader :source, :input
|
14
|
+
|
15
|
+
def initialize(source)
|
16
|
+
@source = source
|
17
|
+
@input = StringScanner.new(source)
|
18
|
+
end
|
19
|
+
|
20
|
+
def self.parse(source)
|
21
|
+
self.new(source).do_parse
|
22
|
+
rescue Racc::ParseError => exn
|
23
|
+
raise ParserError.new("#{exn.message} in #{source}")
|
24
|
+
end
|
25
|
+
|
26
|
+
def next_token
|
27
|
+
case
|
28
|
+
when input.eos?
|
29
|
+
[false, false]
|
30
|
+
when input.scan(/'/)
|
31
|
+
[:QUOTE, input.matched]
|
32
|
+
when input.scan(/\(/)
|
33
|
+
[:LPAREN, input.matched]
|
34
|
+
when input.scan(/\)/)
|
35
|
+
[:RPAREN, input.matched]
|
36
|
+
when input.scan(/:/)
|
37
|
+
[:COLON, input.matched]
|
38
|
+
when input.scan(/\./)
|
39
|
+
[:DOT, input.matched]
|
40
|
+
when input.scan(/\,/)
|
41
|
+
[:COMMA, input.matched]
|
42
|
+
when input.scan(/!/)
|
43
|
+
[:EXCLAM, input.matched]
|
44
|
+
when input.scan(/\-/)
|
45
|
+
[:MINUS, input.matched]
|
46
|
+
when input.scan(/e/)
|
47
|
+
[:E, input.matched]
|
48
|
+
when input.scan(/t/)
|
49
|
+
[:T, input.matched]
|
50
|
+
when input.scan(/f/)
|
51
|
+
[:F, input.matched]
|
52
|
+
when input.scan(/n/)
|
53
|
+
[:N, input.matched]
|
54
|
+
# Originally, 0 is not allowed at the beginning of the number, but rison.js accepts this.
|
55
|
+
when input.scan(/[0-9]/)
|
56
|
+
[:DIGIT, input.matched]
|
57
|
+
# IDSTART and IDCHAR should originally accept only the ASCII symbols `-_./~`, but rison.js accepts other symbols.
|
58
|
+
# @see https://rison.io/
|
59
|
+
# @see https://github.com/Nanonid/rison/blob/e64af6c096fd30950ec32cfd48526ca6ee21649d/js/rison.js#L77-L84
|
60
|
+
when input.scan(/[^\-0-9 '!:\(\),\*@\$]/)
|
61
|
+
[:IDSTART, input.matched]
|
62
|
+
when input.scan(/[^ '!:\(\),\*@\$]/)
|
63
|
+
[:IDCHAR, input.matched]
|
64
|
+
when input.scan(/[^\'\!]/)
|
65
|
+
[:STRCHAR, input.matched]
|
66
|
+
end
|
67
|
+
end
|
68
|
+
...end parser.y/module_eval...
|
69
|
+
##### State transition tables begin ###
|
70
|
+
|
71
|
+
racc_action_table = [
|
72
|
+
47, 48, 49, 46, 45, 15, 16, 17, 36, 38,
|
73
|
+
39, 13, 14, 18, 40, 43, 47, 48, 49, 46,
|
74
|
+
45, 15, 16, 17, 36, 38, 39, 13, 14, 18,
|
75
|
+
3, 43, 54, 52, 4, 15, 16, 17, 68, 22,
|
76
|
+
21, 13, 14, 18, 19, 3, 62, 78, 69, 4,
|
77
|
+
15, 16, 17, 66, 22, 21, 13, 14, 18, 19,
|
78
|
+
3, 23, 54, 56, 4, 15, 16, 17, 56, 22,
|
79
|
+
21, 13, 14, 18, 19, 3, 73, 56, 56, 4,
|
80
|
+
15, 16, 17, 79, 22, 21, 13, 14, 18, 19,
|
81
|
+
24, 57, 30, 56, 15, 16, 17, 31, 32, 33,
|
82
|
+
13, 14, 18, 19, 15, 16, 17, 58, 59, 60,
|
83
|
+
13, 14, 18, 19, 15, 16, 17, 36, 38, 39,
|
84
|
+
13, 14, 18, 15, 16, 17, 36, 38, 39, 13,
|
85
|
+
14, 18, 61 ]
|
86
|
+
|
87
|
+
racc_action_check = [
|
88
|
+
19, 19, 19, 19, 19, 19, 19, 19, 19, 19,
|
89
|
+
19, 19, 19, 19, 19, 19, 42, 42, 42, 42,
|
90
|
+
42, 42, 42, 42, 42, 42, 42, 42, 42, 42,
|
91
|
+
0, 42, 20, 20, 0, 0, 0, 0, 45, 0,
|
92
|
+
0, 0, 0, 0, 0, 30, 30, 63, 45, 30,
|
93
|
+
30, 30, 30, 41, 30, 30, 30, 30, 30, 30,
|
94
|
+
61, 1, 50, 52, 61, 61, 61, 61, 53, 61,
|
95
|
+
61, 61, 61, 61, 61, 79, 54, 56, 57, 79,
|
96
|
+
79, 79, 79, 64, 79, 79, 79, 79, 79, 79,
|
97
|
+
3, 22, 4, 21, 3, 3, 3, 4, 4, 4,
|
98
|
+
3, 3, 3, 3, 60, 60, 60, 23, 25, 26,
|
99
|
+
60, 60, 60, 60, 35, 35, 35, 35, 35, 35,
|
100
|
+
35, 35, 35, 12, 12, 12, 12, 12, 12, 12,
|
101
|
+
12, 12, 27 ]
|
102
|
+
|
103
|
+
racc_action_pointer = [
|
104
|
+
28, 61, nil, 87, 90, nil, nil, nil, nil, nil,
|
105
|
+
nil, nil, 116, nil, nil, nil, nil, nil, nil, -2,
|
106
|
+
18, 81, 79, 107, nil, 105, 105, 127, nil, nil,
|
107
|
+
43, nil, nil, nil, nil, 107, nil, nil, nil, nil,
|
108
|
+
nil, 37, 14, nil, nil, 32, nil, nil, nil, nil,
|
109
|
+
48, nil, 51, 56, 65, nil, 65, 66, nil, nil,
|
110
|
+
97, 58, nil, 44, 79, nil, nil, nil, nil, nil,
|
111
|
+
nil, nil, nil, nil, nil, nil, nil, nil, nil, 73,
|
112
|
+
nil ]
|
113
|
+
|
114
|
+
racc_action_default = [
|
115
|
+
-63, -63, -1, -63, -63, -13, -14, -15, -16, -17,
|
116
|
+
-18, -19, -23, -31, -32, -33, -34, -35, -36, -63,
|
117
|
+
-49, -53, -63, -63, -2, -63, -4, -63, -11, -12,
|
118
|
+
-63, -20, -21, -22, -24, -25, -27, -28, -29, -30,
|
119
|
+
-37, -63, -39, -41, -42, -63, -45, -46, -47, -48,
|
120
|
+
-50, -51, -63, -63, -61, -54, -59, -55, 81, -3,
|
121
|
+
-63, -63, -7, -63, -9, -26, -38, -40, -43, -44,
|
122
|
+
-52, -57, -58, -62, -60, -56, -5, -6, -8, -63,
|
123
|
+
-10 ]
|
124
|
+
|
125
|
+
racc_goto_table = [
|
126
|
+
2, 25, 28, 29, 63, 55, 44, 41, 37, 51,
|
127
|
+
34, 50, 1, nil, nil, 37, nil, nil, nil, nil,
|
128
|
+
nil, nil, nil, nil, nil, nil, nil, nil, nil, 44,
|
129
|
+
67, 37, nil, 65, nil, nil, 71, 72, 37, 70,
|
130
|
+
74, 75, nil, nil, nil, nil, nil, nil, nil, nil,
|
131
|
+
nil, nil, nil, 80, nil, nil, nil, nil, 76, 28,
|
132
|
+
29, 77 ]
|
133
|
+
|
134
|
+
racc_goto_check = [
|
135
|
+
2, 4, 9, 10, 8, 22, 16, 17, 14, 21,
|
136
|
+
15, 20, 1, nil, nil, 14, nil, nil, nil, nil,
|
137
|
+
nil, nil, nil, nil, nil, nil, nil, nil, nil, 16,
|
138
|
+
17, 14, nil, 15, nil, nil, 22, 22, 14, 21,
|
139
|
+
22, 22, nil, nil, nil, nil, nil, nil, nil, nil,
|
140
|
+
nil, nil, nil, 8, nil, nil, nil, nil, 4, 9,
|
141
|
+
10, 2 ]
|
142
|
+
|
143
|
+
racc_goto_pointer = [
|
144
|
+
nil, 12, 0, nil, -2, nil, nil, nil, -26, -1,
|
145
|
+
0, nil, nil, nil, -4, -2, -13, -12, nil, nil,
|
146
|
+
-9, -11, -16, nil ]
|
147
|
+
|
148
|
+
racc_goto_default = [
|
149
|
+
nil, nil, 64, 8, nil, 26, 27, 9, nil, 5,
|
150
|
+
6, 7, 10, 11, 12, nil, 35, nil, 42, 20,
|
151
|
+
nil, nil, nil, 53 ]
|
152
|
+
|
153
|
+
racc_reduce_table = [
|
154
|
+
0, 0, :racc_error,
|
155
|
+
1, 19, :_reduce_none,
|
156
|
+
2, 21, :_reduce_2,
|
157
|
+
3, 21, :_reduce_3,
|
158
|
+
1, 22, :_reduce_none,
|
159
|
+
3, 22, :_reduce_5,
|
160
|
+
3, 23, :_reduce_6,
|
161
|
+
3, 25, :_reduce_7,
|
162
|
+
4, 25, :_reduce_8,
|
163
|
+
1, 26, :_reduce_9,
|
164
|
+
3, 26, :_reduce_10,
|
165
|
+
1, 24, :_reduce_none,
|
166
|
+
1, 24, :_reduce_none,
|
167
|
+
1, 20, :_reduce_none,
|
168
|
+
1, 20, :_reduce_none,
|
169
|
+
1, 20, :_reduce_none,
|
170
|
+
1, 20, :_reduce_none,
|
171
|
+
1, 20, :_reduce_none,
|
172
|
+
1, 20, :_reduce_none,
|
173
|
+
1, 20, :_reduce_none,
|
174
|
+
2, 30, :_reduce_20,
|
175
|
+
2, 30, :_reduce_21,
|
176
|
+
2, 31, :_reduce_22,
|
177
|
+
1, 27, :_reduce_none,
|
178
|
+
2, 27, :_reduce_24,
|
179
|
+
1, 33, :_reduce_none,
|
180
|
+
2, 33, :_reduce_26,
|
181
|
+
1, 34, :_reduce_none,
|
182
|
+
1, 34, :_reduce_none,
|
183
|
+
1, 34, :_reduce_none,
|
184
|
+
1, 34, :_reduce_none,
|
185
|
+
1, 32, :_reduce_none,
|
186
|
+
1, 32, :_reduce_none,
|
187
|
+
1, 32, :_reduce_none,
|
188
|
+
1, 32, :_reduce_none,
|
189
|
+
1, 32, :_reduce_none,
|
190
|
+
1, 32, :_reduce_none,
|
191
|
+
2, 28, :_reduce_37,
|
192
|
+
3, 28, :_reduce_38,
|
193
|
+
1, 35, :_reduce_none,
|
194
|
+
2, 35, :_reduce_40,
|
195
|
+
1, 36, :_reduce_none,
|
196
|
+
1, 36, :_reduce_none,
|
197
|
+
2, 36, :_reduce_43,
|
198
|
+
2, 36, :_reduce_44,
|
199
|
+
1, 36, :_reduce_none,
|
200
|
+
1, 36, :_reduce_none,
|
201
|
+
1, 36, :_reduce_none,
|
202
|
+
1, 36, :_reduce_none,
|
203
|
+
1, 29, :_reduce_49,
|
204
|
+
2, 29, :_reduce_50,
|
205
|
+
2, 29, :_reduce_51,
|
206
|
+
3, 29, :_reduce_52,
|
207
|
+
1, 37, :_reduce_53,
|
208
|
+
2, 37, :_reduce_54,
|
209
|
+
2, 37, :_reduce_55,
|
210
|
+
3, 37, :_reduce_56,
|
211
|
+
2, 38, :_reduce_57,
|
212
|
+
2, 39, :_reduce_58,
|
213
|
+
1, 40, :_reduce_none,
|
214
|
+
2, 40, :_reduce_60,
|
215
|
+
1, 41, :_reduce_61,
|
216
|
+
2, 41, :_reduce_62 ]
|
217
|
+
|
218
|
+
racc_reduce_n = 63
|
219
|
+
|
220
|
+
racc_shift_n = 81
|
221
|
+
|
222
|
+
racc_token_table = {
|
223
|
+
false => 0,
|
224
|
+
:error => 1,
|
225
|
+
:LPAREN => 2,
|
226
|
+
:RPAREN => 3,
|
227
|
+
:COMMA => 4,
|
228
|
+
:COLON => 5,
|
229
|
+
:EXCLAM => 6,
|
230
|
+
:T => 7,
|
231
|
+
:F => 8,
|
232
|
+
:N => 9,
|
233
|
+
:IDCHAR => 10,
|
234
|
+
:MINUS => 11,
|
235
|
+
:DIGIT => 12,
|
236
|
+
:IDSTART => 13,
|
237
|
+
:E => 14,
|
238
|
+
:DOT => 15,
|
239
|
+
:QUOTE => 16,
|
240
|
+
:STRCHAR => 17 }
|
241
|
+
|
242
|
+
racc_nt_base = 18
|
243
|
+
|
244
|
+
racc_use_result_var = true
|
245
|
+
|
246
|
+
Racc_arg = [
|
247
|
+
racc_action_table,
|
248
|
+
racc_action_check,
|
249
|
+
racc_action_default,
|
250
|
+
racc_action_pointer,
|
251
|
+
racc_goto_table,
|
252
|
+
racc_goto_check,
|
253
|
+
racc_goto_default,
|
254
|
+
racc_goto_pointer,
|
255
|
+
racc_nt_base,
|
256
|
+
racc_reduce_table,
|
257
|
+
racc_token_table,
|
258
|
+
racc_shift_n,
|
259
|
+
racc_reduce_n,
|
260
|
+
racc_use_result_var ]
|
261
|
+
|
262
|
+
Racc_token_to_s_table = [
|
263
|
+
"$end",
|
264
|
+
"error",
|
265
|
+
"LPAREN",
|
266
|
+
"RPAREN",
|
267
|
+
"COMMA",
|
268
|
+
"COLON",
|
269
|
+
"EXCLAM",
|
270
|
+
"T",
|
271
|
+
"F",
|
272
|
+
"N",
|
273
|
+
"IDCHAR",
|
274
|
+
"MINUS",
|
275
|
+
"DIGIT",
|
276
|
+
"IDSTART",
|
277
|
+
"E",
|
278
|
+
"DOT",
|
279
|
+
"QUOTE",
|
280
|
+
"STRCHAR",
|
281
|
+
"$start",
|
282
|
+
"target",
|
283
|
+
"value",
|
284
|
+
"object",
|
285
|
+
"members",
|
286
|
+
"pair",
|
287
|
+
"key",
|
288
|
+
"array",
|
289
|
+
"elements",
|
290
|
+
"id",
|
291
|
+
"string",
|
292
|
+
"number",
|
293
|
+
"bool",
|
294
|
+
"null",
|
295
|
+
"idstart",
|
296
|
+
"idchars",
|
297
|
+
"idchar",
|
298
|
+
"strchars",
|
299
|
+
"strchar",
|
300
|
+
"int",
|
301
|
+
"frac",
|
302
|
+
"exp",
|
303
|
+
"digits",
|
304
|
+
"e" ]
|
305
|
+
|
306
|
+
Racc_debug_parser = false
|
307
|
+
|
308
|
+
##### State transition tables end #####
|
309
|
+
|
310
|
+
# reduce 0 omitted
|
311
|
+
|
312
|
+
# reduce 1 omitted
|
313
|
+
|
314
|
+
module_eval(<<'.,.,', 'parser.y', 5)
|
315
|
+
def _reduce_2(val, _values, result)
|
316
|
+
result = {}
|
317
|
+
result
|
318
|
+
end
|
319
|
+
.,.,
|
320
|
+
|
321
|
+
module_eval(<<'.,.,', 'parser.y', 6)
|
322
|
+
def _reduce_3(val, _values, result)
|
323
|
+
result = val[1]
|
324
|
+
result
|
325
|
+
end
|
326
|
+
.,.,
|
327
|
+
|
328
|
+
# reduce 4 omitted
|
329
|
+
|
330
|
+
module_eval(<<'.,.,', 'parser.y', 9)
|
331
|
+
def _reduce_5(val, _values, result)
|
332
|
+
result = val[0].merge(val[2])
|
333
|
+
result
|
334
|
+
end
|
335
|
+
.,.,
|
336
|
+
|
337
|
+
module_eval(<<'.,.,', 'parser.y', 11)
|
338
|
+
def _reduce_6(val, _values, result)
|
339
|
+
result = { val[0] => val[2] }
|
340
|
+
result
|
341
|
+
end
|
342
|
+
.,.,
|
343
|
+
|
344
|
+
module_eval(<<'.,.,', 'parser.y', 13)
|
345
|
+
def _reduce_7(val, _values, result)
|
346
|
+
result = []
|
347
|
+
result
|
348
|
+
end
|
349
|
+
.,.,
|
350
|
+
|
351
|
+
module_eval(<<'.,.,', 'parser.y', 14)
|
352
|
+
def _reduce_8(val, _values, result)
|
353
|
+
result = val[2]
|
354
|
+
result
|
355
|
+
end
|
356
|
+
.,.,
|
357
|
+
|
358
|
+
module_eval(<<'.,.,', 'parser.y', 16)
|
359
|
+
def _reduce_9(val, _values, result)
|
360
|
+
result = [val[0]]
|
361
|
+
result
|
362
|
+
end
|
363
|
+
.,.,
|
364
|
+
|
365
|
+
module_eval(<<'.,.,', 'parser.y', 17)
|
366
|
+
def _reduce_10(val, _values, result)
|
367
|
+
result = val[2].unshift(val[0])
|
368
|
+
result
|
369
|
+
end
|
370
|
+
.,.,
|
371
|
+
|
372
|
+
# reduce 11 omitted
|
373
|
+
|
374
|
+
# reduce 12 omitted
|
375
|
+
|
376
|
+
# reduce 13 omitted
|
377
|
+
|
378
|
+
# reduce 14 omitted
|
379
|
+
|
380
|
+
# reduce 15 omitted
|
381
|
+
|
382
|
+
# reduce 16 omitted
|
383
|
+
|
384
|
+
# reduce 17 omitted
|
385
|
+
|
386
|
+
# reduce 18 omitted
|
387
|
+
|
388
|
+
# reduce 19 omitted
|
389
|
+
|
390
|
+
module_eval(<<'.,.,', 'parser.y', 23)
|
391
|
+
def _reduce_20(val, _values, result)
|
392
|
+
result = true
|
393
|
+
result
|
394
|
+
end
|
395
|
+
.,.,
|
396
|
+
|
397
|
+
module_eval(<<'.,.,', 'parser.y', 24)
|
398
|
+
def _reduce_21(val, _values, result)
|
399
|
+
result = false
|
400
|
+
result
|
401
|
+
end
|
402
|
+
.,.,
|
403
|
+
|
404
|
+
module_eval(<<'.,.,', 'parser.y', 26)
|
405
|
+
def _reduce_22(val, _values, result)
|
406
|
+
result = nil
|
407
|
+
result
|
408
|
+
end
|
409
|
+
.,.,
|
410
|
+
|
411
|
+
# reduce 23 omitted
|
412
|
+
|
413
|
+
module_eval(<<'.,.,', 'parser.y', 29)
|
414
|
+
def _reduce_24(val, _values, result)
|
415
|
+
result = val[0] + val[1]
|
416
|
+
result
|
417
|
+
end
|
418
|
+
.,.,
|
419
|
+
|
420
|
+
# reduce 25 omitted
|
421
|
+
|
422
|
+
module_eval(<<'.,.,', 'parser.y', 32)
|
423
|
+
def _reduce_26(val, _values, result)
|
424
|
+
result = val[0] + val[1]
|
425
|
+
result
|
426
|
+
end
|
427
|
+
.,.,
|
428
|
+
|
429
|
+
# reduce 27 omitted
|
430
|
+
|
431
|
+
# reduce 28 omitted
|
432
|
+
|
433
|
+
# reduce 29 omitted
|
434
|
+
|
435
|
+
# reduce 30 omitted
|
436
|
+
|
437
|
+
# reduce 31 omitted
|
438
|
+
|
439
|
+
# reduce 32 omitted
|
440
|
+
|
441
|
+
# reduce 33 omitted
|
442
|
+
|
443
|
+
# reduce 34 omitted
|
444
|
+
|
445
|
+
# reduce 35 omitted
|
446
|
+
|
447
|
+
# reduce 36 omitted
|
448
|
+
|
449
|
+
module_eval(<<'.,.,', 'parser.y', 38)
|
450
|
+
def _reduce_37(val, _values, result)
|
451
|
+
result = ''
|
452
|
+
result
|
453
|
+
end
|
454
|
+
.,.,
|
455
|
+
|
456
|
+
module_eval(<<'.,.,', 'parser.y', 39)
|
457
|
+
def _reduce_38(val, _values, result)
|
458
|
+
result = val[1]
|
459
|
+
result
|
460
|
+
end
|
461
|
+
.,.,
|
462
|
+
|
463
|
+
# reduce 39 omitted
|
464
|
+
|
465
|
+
module_eval(<<'.,.,', 'parser.y', 42)
|
466
|
+
def _reduce_40(val, _values, result)
|
467
|
+
result = val[0] + val[1]
|
468
|
+
result
|
469
|
+
end
|
470
|
+
.,.,
|
471
|
+
|
472
|
+
# reduce 41 omitted
|
473
|
+
|
474
|
+
# reduce 42 omitted
|
475
|
+
|
476
|
+
module_eval(<<'.,.,', 'parser.y', 46)
|
477
|
+
def _reduce_43(val, _values, result)
|
478
|
+
result = '!'
|
479
|
+
result
|
480
|
+
end
|
481
|
+
.,.,
|
482
|
+
|
483
|
+
module_eval(<<'.,.,', 'parser.y', 47)
|
484
|
+
def _reduce_44(val, _values, result)
|
485
|
+
result = "'"
|
486
|
+
result
|
487
|
+
end
|
488
|
+
.,.,
|
489
|
+
|
490
|
+
# reduce 45 omitted
|
491
|
+
|
492
|
+
# reduce 46 omitted
|
493
|
+
|
494
|
+
# reduce 47 omitted
|
495
|
+
|
496
|
+
# reduce 48 omitted
|
497
|
+
|
498
|
+
module_eval(<<'.,.,', 'parser.y', 53)
|
499
|
+
def _reduce_49(val, _values, result)
|
500
|
+
result = val[0].to_i
|
501
|
+
result
|
502
|
+
end
|
503
|
+
.,.,
|
504
|
+
|
505
|
+
module_eval(<<'.,.,', 'parser.y', 54)
|
506
|
+
def _reduce_50(val, _values, result)
|
507
|
+
result = "#{val[0]}#{val[1]}".to_f
|
508
|
+
result
|
509
|
+
end
|
510
|
+
.,.,
|
511
|
+
|
512
|
+
module_eval(<<'.,.,', 'parser.y', 55)
|
513
|
+
def _reduce_51(val, _values, result)
|
514
|
+
result = "#{val[0]}#{val[1]}".to_f
|
515
|
+
result
|
516
|
+
end
|
517
|
+
.,.,
|
518
|
+
|
519
|
+
module_eval(<<'.,.,', 'parser.y', 56)
|
520
|
+
def _reduce_52(val, _values, result)
|
521
|
+
result = "#{val[0]}#{val[1]}#{val[2]}".to_f
|
522
|
+
result
|
523
|
+
end
|
524
|
+
.,.,
|
525
|
+
|
526
|
+
module_eval(<<'.,.,', 'parser.y', 58)
|
527
|
+
def _reduce_53(val, _values, result)
|
528
|
+
result = val[0].to_i
|
529
|
+
result
|
530
|
+
end
|
531
|
+
.,.,
|
532
|
+
|
533
|
+
module_eval(<<'.,.,', 'parser.y', 59)
|
534
|
+
def _reduce_54(val, _values, result)
|
535
|
+
result = "#{val[0]}#{val[1]}".to_i
|
536
|
+
result
|
537
|
+
end
|
538
|
+
.,.,
|
539
|
+
|
540
|
+
module_eval(<<'.,.,', 'parser.y', 60)
|
541
|
+
def _reduce_55(val, _values, result)
|
542
|
+
result = "-#{val[1]}".to_i
|
543
|
+
result
|
544
|
+
end
|
545
|
+
.,.,
|
546
|
+
|
547
|
+
module_eval(<<'.,.,', 'parser.y', 61)
|
548
|
+
def _reduce_56(val, _values, result)
|
549
|
+
result = "-#{val[1]}#{val[2]}".to_i
|
550
|
+
result
|
551
|
+
end
|
552
|
+
.,.,
|
553
|
+
|
554
|
+
module_eval(<<'.,.,', 'parser.y', 63)
|
555
|
+
def _reduce_57(val, _values, result)
|
556
|
+
result = "#{val[0]}#{val[1]}"
|
557
|
+
result
|
558
|
+
end
|
559
|
+
.,.,
|
560
|
+
|
561
|
+
module_eval(<<'.,.,', 'parser.y', 65)
|
562
|
+
def _reduce_58(val, _values, result)
|
563
|
+
result = "#{val[0]}#{val[1]}"
|
564
|
+
result
|
565
|
+
end
|
566
|
+
.,.,
|
567
|
+
|
568
|
+
# reduce 59 omitted
|
569
|
+
|
570
|
+
module_eval(<<'.,.,', 'parser.y', 68)
|
571
|
+
def _reduce_60(val, _values, result)
|
572
|
+
result = "#{val[0]}#{val[1]}"
|
573
|
+
result
|
574
|
+
end
|
575
|
+
.,.,
|
576
|
+
|
577
|
+
module_eval(<<'.,.,', 'parser.y', 70)
|
578
|
+
def _reduce_61(val, _values, result)
|
579
|
+
result = 'e'
|
580
|
+
result
|
581
|
+
end
|
582
|
+
.,.,
|
583
|
+
|
584
|
+
module_eval(<<'.,.,', 'parser.y', 71)
|
585
|
+
def _reduce_62(val, _values, result)
|
586
|
+
result = "e-"
|
587
|
+
result
|
588
|
+
end
|
589
|
+
.,.,
|
590
|
+
|
591
|
+
def _reduce_none(val, _values, result)
|
592
|
+
val[0]
|
593
|
+
end
|
594
|
+
|
595
|
+
end # class Parser
|
596
|
+
end # module Rison
|