tomlrb 1.2.7 → 2.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/tomlrb.rb +5 -2
- data/lib/tomlrb/generated_parser.rb +376 -257
- data/lib/tomlrb/handler.rb +161 -3
- data/lib/tomlrb/local_date.rb +33 -0
- data/lib/tomlrb/local_date_time.rb +40 -0
- data/lib/tomlrb/local_time.rb +38 -0
- data/lib/tomlrb/parser.rb +1 -1
- data/lib/tomlrb/parser.y +100 -25
- data/lib/tomlrb/scanner.rb +35 -21
- data/lib/tomlrb/string_utils.rb +7 -1
- data/lib/tomlrb/version.rb +1 -1
- metadata +7 -15
- data/.gitignore +0 -9
- data/.travis.yml +0 -5
- data/CHANGELOG.md +0 -12
- data/Gemfile +0 -13
- data/README.md +0 -80
- data/Rakefile +0 -14
- data/benchmarks/bench.rb +0 -22
- data/bin/console +0 -10
- data/bin/setup +0 -6
- data/tomlrb.gemspec +0 -22
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 629b0c5e56e0d5978b6038fba1e1ac597cfd2932b6379fe84d09508defe7ce65
|
4
|
+
data.tar.gz: 5a018444a9506276d874c43d3a2b9a234f54350fb732dd5ec5c4fac901917757
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8960f08241d02b8a36d600587d148d034a229588dbb96e4738aab0c30355def92bcbf4280da4ad9966e0e3a676aff01dd8faeb0c62f16c595c4bccc32c9d3e77
|
7
|
+
data.tar.gz: 4e4179cbf1c9f88ff86ecbf15f23e2a964cd7cc3449bf420f7e8242aa125de08b7b0be9658c55d4a8c7d5c805654926144d0a30ed7d03b0d328fdb1db6a456b6
|
data/lib/tomlrb.rb
CHANGED
@@ -1,6 +1,9 @@
|
|
1
1
|
require 'time'
|
2
2
|
require 'stringio'
|
3
3
|
require "tomlrb/version"
|
4
|
+
require 'tomlrb/local_date_time'
|
5
|
+
require 'tomlrb/local_date'
|
6
|
+
require 'tomlrb/local_time'
|
4
7
|
require 'tomlrb/string_utils'
|
5
8
|
require "tomlrb/scanner"
|
6
9
|
require "tomlrb/parser"
|
@@ -18,7 +21,7 @@ module Tomlrb
|
|
18
21
|
def self.parse(string_or_io, **options)
|
19
22
|
io = string_or_io.is_a?(String) ? StringIO.new(string_or_io) : string_or_io
|
20
23
|
scanner = Scanner.new(io)
|
21
|
-
parser = Parser.new(scanner, options)
|
24
|
+
parser = Parser.new(scanner, **options)
|
22
25
|
begin
|
23
26
|
handler = parser.parse
|
24
27
|
rescue Racc::ParseError => e
|
@@ -39,6 +42,6 @@ module Tomlrb
|
|
39
42
|
# default external encoding. The default external encoding is set by
|
40
43
|
# locale encoding or the interpreter -E option.
|
41
44
|
tmp = File.read(path, :encoding=>'utf-8')
|
42
|
-
Tomlrb.parse(tmp, options)
|
45
|
+
Tomlrb.parse(tmp, **options)
|
43
46
|
end
|
44
47
|
end
|
@@ -1,7 +1,7 @@
|
|
1
1
|
#
|
2
2
|
# DO NOT MODIFY!!!!
|
3
|
-
# This file is automatically generated by Racc 1.
|
4
|
-
# from Racc
|
3
|
+
# This file is automatically generated by Racc 1.5.1
|
4
|
+
# from Racc grammar file "".
|
5
5
|
#
|
6
6
|
|
7
7
|
require 'racc/parser.rb'
|
@@ -10,150 +10,177 @@ module Tomlrb
|
|
10
10
|
##### State transition tables begin ###
|
11
11
|
|
12
12
|
racc_action_table = [
|
13
|
-
2,
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
nil,
|
28
|
-
nil,
|
13
|
+
2, 43, 16, 41, 17, 42, 18, 44, 45, 19,
|
14
|
+
20, 14, 21, 22, 8, 4, 10, 48, 49, 12,
|
15
|
+
23, 39, 69, 70, 71, 72, 67, 68, 64, 65,
|
16
|
+
62, 63, 66, 52, 36, 56, 46, 53, 12, 69,
|
17
|
+
70, 71, 72, 67, 68, 64, 65, 62, 63, 66,
|
18
|
+
84, 83, 56, 39, 75, 12, 69, 70, 71, 72,
|
19
|
+
67, 68, 64, 65, 62, 63, 66, 88, 80, 56,
|
20
|
+
86, 81, 12, 69, 70, 71, 72, 67, 68, 64,
|
21
|
+
65, 62, 63, 66, 88, 41, 56, 86, nil, 12,
|
22
|
+
69, 70, 71, 72, 67, 68, 64, 65, 62, 63,
|
23
|
+
66, 88, nil, 56, 86, nil, 12, 69, 70, 71,
|
24
|
+
72, 67, 68, 64, 65, 62, 63, 66, 88, nil,
|
25
|
+
56, 86, 29, 12, 30, nil, 31, nil, nil, 32,
|
26
|
+
33, 27, 34, 35, 29, nil, 30, 25, 31, nil,
|
27
|
+
nil, 32, 33, 78, 34, 35, 16, nil, 17, 25,
|
28
|
+
18, nil, nil, 19, 20, 74, 21, 22, 93, nil,
|
29
|
+
nil, 91, nil, nil, nil, 92 ]
|
29
30
|
|
30
31
|
racc_action_check = [
|
31
|
-
1,
|
32
|
-
1, 1, 1,
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
nil,
|
46
|
-
nil,
|
32
|
+
1, 13, 1, 11, 1, 13, 1, 24, 24, 1,
|
33
|
+
1, 1, 1, 1, 1, 1, 1, 26, 26, 1,
|
34
|
+
2, 11, 42, 42, 42, 42, 42, 42, 42, 42,
|
35
|
+
42, 42, 42, 40, 10, 42, 25, 40, 42, 53,
|
36
|
+
53, 53, 53, 53, 53, 53, 53, 53, 53, 53,
|
37
|
+
54, 54, 53, 38, 48, 53, 55, 55, 55, 55,
|
38
|
+
55, 55, 55, 55, 55, 55, 55, 55, 51, 55,
|
39
|
+
55, 52, 55, 88, 88, 88, 88, 88, 88, 88,
|
40
|
+
88, 88, 88, 88, 88, 80, 88, 88, nil, 88,
|
41
|
+
92, 92, 92, 92, 92, 92, 92, 92, 92, 92,
|
42
|
+
92, 92, nil, 92, 92, nil, 92, 93, 93, 93,
|
43
|
+
93, 93, 93, 93, 93, 93, 93, 93, 93, nil,
|
44
|
+
93, 93, 9, 93, 9, nil, 9, nil, nil, 9,
|
45
|
+
9, 9, 9, 9, 49, nil, 49, 9, 49, nil,
|
46
|
+
nil, 49, 49, 49, 49, 49, 43, nil, 43, 49,
|
47
|
+
43, nil, nil, 43, 43, 43, 43, 43, 87, nil,
|
48
|
+
nil, 87, nil, nil, nil, 87 ]
|
47
49
|
|
48
50
|
racc_action_pointer = [
|
49
|
-
nil, 0,
|
50
|
-
nil,
|
51
|
-
|
52
|
-
|
53
|
-
|
51
|
+
nil, 0, 20, nil, nil, nil, nil, nil, nil, 120,
|
52
|
+
18, 1, nil, -17, nil, nil, nil, nil, nil, nil,
|
53
|
+
nil, nil, nil, nil, -7, 19, 0, nil, nil, nil,
|
54
|
+
nil, nil, nil, nil, nil, nil, nil, nil, 33, nil,
|
55
|
+
15, nil, 19, 144, nil, nil, nil, nil, 37, 132,
|
56
|
+
nil, 47, 69, 36, 36, 53, nil, nil, nil, nil,
|
54
57
|
nil, nil, nil, nil, nil, nil, nil, nil, nil, nil,
|
55
58
|
nil, nil, nil, nil, nil, nil, nil, nil, nil, nil,
|
56
|
-
|
59
|
+
83, nil, nil, nil, nil, nil, nil, 144, 70, nil,
|
60
|
+
nil, nil, 87, 104, nil, nil, nil ]
|
57
61
|
|
58
62
|
racc_action_default = [
|
59
|
-
-1, -
|
60
|
-
-
|
61
|
-
-
|
62
|
-
-
|
63
|
-
-
|
64
|
-
-
|
65
|
-
-
|
66
|
-
-
|
63
|
+
-1, -77, -77, -2, -3, -4, -5, -6, -7, -77,
|
64
|
+
-11, -77, -31, -77, -43, -44, -45, -46, -47, -48,
|
65
|
+
-49, -50, -51, 97, -77, -13, -77, -20, -21, -22,
|
66
|
+
-23, -24, -25, -26, -27, -28, -10, -29, -77, -32,
|
67
|
+
-77, -37, -65, -77, -8, -9, -12, -14, -16, -77,
|
68
|
+
-30, -33, -77, -65, -77, -65, -59, -60, -61, -62,
|
69
|
+
-63, -64, -66, -67, -68, -69, -70, -71, -72, -73,
|
70
|
+
-74, -75, -76, -41, -42, -15, -17, -18, -19, -34,
|
71
|
+
-77, -36, -38, -39, -40, -52, -53, -77, -65, -35,
|
72
|
+
-54, -56, -65, -65, -55, -57, -58 ]
|
67
73
|
|
68
74
|
racc_goto_table = [
|
69
|
-
|
70
|
-
|
75
|
+
38, 15, 24, 85, 28, 37, 54, 1, 3, 5,
|
76
|
+
6, 7, 9, 47, 51, 79, 13, 82, 90, nil,
|
71
77
|
nil, nil, nil, nil, nil, nil, nil, nil, nil, nil,
|
72
|
-
nil, nil, nil, nil, nil,
|
78
|
+
nil, nil, 50, nil, nil, nil, 94, nil, nil, nil,
|
79
|
+
95, 96, 76, 73, 77, nil, nil, nil, nil, nil,
|
73
80
|
nil, nil, nil, nil, nil, nil, nil, nil, nil, nil,
|
74
|
-
nil, nil, nil, nil, nil, nil, nil, nil, nil,
|
75
|
-
nil, 75 ]
|
81
|
+
nil, nil, nil, nil, nil, nil, nil, nil, nil, 89 ]
|
76
82
|
|
77
83
|
racc_goto_check = [
|
78
|
-
|
79
|
-
|
80
|
-
nil, nil, nil, nil, nil, nil, nil, nil, nil, nil,
|
81
|
-
nil, nil, nil, nil, nil, 7, 18, nil, nil, nil,
|
84
|
+
13, 19, 7, 22, 10, 12, 17, 1, 2, 3,
|
85
|
+
4, 5, 6, 9, 15, 16, 18, 17, 23, nil,
|
82
86
|
nil, nil, nil, nil, nil, nil, nil, nil, nil, nil,
|
87
|
+
nil, nil, 12, nil, nil, nil, 22, nil, nil, nil,
|
88
|
+
22, 22, 7, 19, 10, nil, nil, nil, nil, nil,
|
83
89
|
nil, nil, nil, nil, nil, nil, nil, nil, nil, nil,
|
84
|
-
nil,
|
90
|
+
nil, nil, nil, nil, nil, nil, nil, nil, nil, 13 ]
|
85
91
|
|
86
92
|
racc_goto_pointer = [
|
87
|
-
nil,
|
88
|
-
|
89
|
-
nil, nil, nil ]
|
93
|
+
nil, 7, 7, 8, 9, 10, 11, -7, nil, -13,
|
94
|
+
-5, nil, -6, -11, nil, -26, -36, -36, 15, 0,
|
95
|
+
nil, nil, -52, -69, nil, nil, nil ]
|
90
96
|
|
91
97
|
racc_goto_default = [
|
92
|
-
nil, nil, nil, nil, nil,
|
93
|
-
|
94
|
-
|
98
|
+
nil, nil, nil, nil, nil, 59, nil, nil, 26, nil,
|
99
|
+
nil, 11, nil, nil, 40, nil, nil, 87, nil, nil,
|
100
|
+
58, 55, nil, nil, 57, 60, 61 ]
|
95
101
|
|
96
102
|
racc_reduce_table = [
|
97
103
|
0, 0, :racc_error,
|
98
|
-
0,
|
99
|
-
2, 20, :_reduce_none,
|
100
|
-
1, 21, :_reduce_none,
|
101
|
-
1, 21, :_reduce_none,
|
102
|
-
1, 21, :_reduce_none,
|
103
|
-
2, 22, :_reduce_none,
|
104
|
-
2, 25, :_reduce_7,
|
105
|
-
1, 25, :_reduce_8,
|
106
|
-
2, 26, :_reduce_9,
|
107
|
-
1, 26, :_reduce_10,
|
108
|
-
2, 26, :_reduce_none,
|
109
|
-
2, 28, :_reduce_12,
|
110
|
-
1, 28, :_reduce_13,
|
111
|
-
2, 28, :_reduce_none,
|
112
|
-
1, 27, :_reduce_15,
|
113
|
-
1, 27, :_reduce_16,
|
114
|
-
1, 27, :_reduce_17,
|
115
|
-
1, 27, :_reduce_18,
|
116
|
-
1, 27, :_reduce_19,
|
117
|
-
1, 27, :_reduce_20,
|
104
|
+
0, 24, :_reduce_none,
|
118
105
|
2, 24, :_reduce_none,
|
119
|
-
|
120
|
-
1,
|
121
|
-
|
122
|
-
1,
|
123
|
-
|
124
|
-
|
106
|
+
2, 24, :_reduce_none,
|
107
|
+
1, 25, :_reduce_none,
|
108
|
+
1, 25, :_reduce_none,
|
109
|
+
1, 25, :_reduce_none,
|
110
|
+
1, 25, :_reduce_none,
|
111
|
+
3, 26, :_reduce_none,
|
112
|
+
3, 26, :_reduce_none,
|
113
|
+
2, 29, :_reduce_10,
|
114
|
+
1, 29, :_reduce_11,
|
115
|
+
2, 30, :_reduce_12,
|
116
|
+
1, 30, :_reduce_13,
|
117
|
+
2, 30, :_reduce_none,
|
118
|
+
2, 32, :_reduce_15,
|
119
|
+
1, 32, :_reduce_16,
|
125
120
|
2, 32, :_reduce_none,
|
126
|
-
3,
|
127
|
-
3,
|
128
|
-
|
129
|
-
|
130
|
-
|
131
|
-
|
132
|
-
|
133
|
-
1,
|
134
|
-
|
135
|
-
1,
|
121
|
+
3, 31, :_reduce_18,
|
122
|
+
3, 31, :_reduce_19,
|
123
|
+
1, 31, :_reduce_20,
|
124
|
+
1, 31, :_reduce_21,
|
125
|
+
1, 33, :_reduce_none,
|
126
|
+
1, 33, :_reduce_none,
|
127
|
+
1, 33, :_reduce_none,
|
128
|
+
1, 33, :_reduce_none,
|
129
|
+
1, 33, :_reduce_none,
|
130
|
+
1, 33, :_reduce_none,
|
131
|
+
1, 33, :_reduce_none,
|
132
|
+
2, 28, :_reduce_none,
|
133
|
+
3, 28, :_reduce_none,
|
134
|
+
1, 34, :_reduce_31,
|
135
|
+
1, 35, :_reduce_32,
|
136
|
+
2, 36, :_reduce_none,
|
137
|
+
3, 36, :_reduce_none,
|
138
|
+
2, 39, :_reduce_none,
|
139
|
+
3, 37, :_reduce_36,
|
140
|
+
1, 37, :_reduce_37,
|
136
141
|
2, 38, :_reduce_none,
|
137
|
-
|
138
|
-
|
139
|
-
|
140
|
-
|
141
|
-
1,
|
142
|
-
1,
|
143
|
-
|
144
|
-
1,
|
145
|
-
1,
|
146
|
-
1,
|
147
|
-
1,
|
148
|
-
1,
|
149
|
-
1,
|
150
|
-
|
151
|
-
1,
|
152
|
-
|
153
|
-
|
154
|
-
|
155
|
-
|
156
|
-
|
142
|
+
4, 27, :_reduce_39,
|
143
|
+
4, 27, :_reduce_40,
|
144
|
+
3, 41, :_reduce_41,
|
145
|
+
3, 41, :_reduce_42,
|
146
|
+
1, 41, :_reduce_43,
|
147
|
+
1, 41, :_reduce_44,
|
148
|
+
1, 42, :_reduce_none,
|
149
|
+
1, 42, :_reduce_none,
|
150
|
+
1, 42, :_reduce_none,
|
151
|
+
1, 42, :_reduce_none,
|
152
|
+
1, 42, :_reduce_none,
|
153
|
+
1, 42, :_reduce_none,
|
154
|
+
1, 42, :_reduce_none,
|
155
|
+
2, 43, :_reduce_none,
|
156
|
+
1, 45, :_reduce_53,
|
157
|
+
2, 45, :_reduce_none,
|
158
|
+
2, 45, :_reduce_none,
|
159
|
+
1, 46, :_reduce_56,
|
160
|
+
2, 46, :_reduce_none,
|
161
|
+
2, 46, :_reduce_none,
|
162
|
+
1, 44, :_reduce_59,
|
163
|
+
1, 40, :_reduce_60,
|
164
|
+
1, 40, :_reduce_none,
|
165
|
+
1, 40, :_reduce_none,
|
166
|
+
1, 47, :_reduce_none,
|
167
|
+
1, 47, :_reduce_none,
|
168
|
+
0, 49, :_reduce_none,
|
169
|
+
1, 49, :_reduce_66,
|
170
|
+
1, 49, :_reduce_67,
|
171
|
+
1, 49, :_reduce_68,
|
172
|
+
1, 49, :_reduce_69,
|
173
|
+
1, 49, :_reduce_70,
|
174
|
+
1, 49, :_reduce_71,
|
175
|
+
1, 49, :_reduce_72,
|
176
|
+
1, 48, :_reduce_73,
|
177
|
+
1, 48, :_reduce_74,
|
178
|
+
1, 48, :_reduce_75,
|
179
|
+
1, 48, :_reduce_76 ]
|
180
|
+
|
181
|
+
racc_reduce_n = 77
|
182
|
+
|
183
|
+
racc_shift_n = 97
|
157
184
|
|
158
185
|
racc_token_table = {
|
159
186
|
false => 0,
|
@@ -164,19 +191,23 @@ racc_token_table = {
|
|
164
191
|
:STRING_LITERAL_MULTI => 5,
|
165
192
|
:STRING_LITERAL => 6,
|
166
193
|
:DATETIME => 7,
|
167
|
-
:
|
168
|
-
:
|
169
|
-
:
|
170
|
-
:
|
171
|
-
|
172
|
-
|
173
|
-
|
174
|
-
|
175
|
-
"
|
176
|
-
"
|
177
|
-
"
|
178
|
-
|
179
|
-
|
194
|
+
:LOCAL_TIME => 8,
|
195
|
+
:INTEGER => 9,
|
196
|
+
:NON_DEC_INTEGER => 10,
|
197
|
+
:FLOAT => 11,
|
198
|
+
:FLOAT_KEYWORD => 12,
|
199
|
+
:BOOLEAN => 13,
|
200
|
+
:NEWLINE => 14,
|
201
|
+
:EOS => 15,
|
202
|
+
"[" => 16,
|
203
|
+
"]" => 17,
|
204
|
+
"." => 18,
|
205
|
+
"{" => 19,
|
206
|
+
"}" => 20,
|
207
|
+
"," => 21,
|
208
|
+
"=" => 22 }
|
209
|
+
|
210
|
+
racc_nt_base = 23
|
180
211
|
|
181
212
|
racc_use_result_var = true
|
182
213
|
|
@@ -205,10 +236,14 @@ Racc_token_to_s_table = [
|
|
205
236
|
"STRING_LITERAL_MULTI",
|
206
237
|
"STRING_LITERAL",
|
207
238
|
"DATETIME",
|
239
|
+
"LOCAL_TIME",
|
208
240
|
"INTEGER",
|
241
|
+
"NON_DEC_INTEGER",
|
209
242
|
"FLOAT",
|
210
|
-
"
|
211
|
-
"
|
243
|
+
"FLOAT_KEYWORD",
|
244
|
+
"BOOLEAN",
|
245
|
+
"NEWLINE",
|
246
|
+
"EOS",
|
212
247
|
"\"[\"",
|
213
248
|
"\"]\"",
|
214
249
|
"\".\"",
|
@@ -226,12 +261,16 @@ Racc_token_to_s_table = [
|
|
226
261
|
"table_continued",
|
227
262
|
"table_identifier",
|
228
263
|
"table_next",
|
264
|
+
"table_identifier_component",
|
229
265
|
"inline_table_start",
|
266
|
+
"inline_table_end",
|
230
267
|
"inline_continued",
|
231
268
|
"inline_assignment_key",
|
232
269
|
"inline_assignment_value",
|
233
270
|
"inline_next",
|
234
271
|
"value",
|
272
|
+
"assignment_key",
|
273
|
+
"assignment_key_component",
|
235
274
|
"array",
|
236
275
|
"start_array",
|
237
276
|
"array_continued",
|
@@ -258,278 +297,358 @@ Racc_debug_parser = false
|
|
258
297
|
|
259
298
|
# reduce 6 omitted
|
260
299
|
|
261
|
-
|
262
|
-
def _reduce_7(val, _values, result)
|
263
|
-
@handler.start_(:array_of_tables)
|
264
|
-
result
|
265
|
-
end
|
266
|
-
.,.,
|
300
|
+
# reduce 7 omitted
|
267
301
|
|
268
|
-
|
269
|
-
def _reduce_8(val, _values, result)
|
270
|
-
@handler.start_(:table)
|
271
|
-
result
|
272
|
-
end
|
273
|
-
.,.,
|
302
|
+
# reduce 8 omitted
|
274
303
|
|
275
|
-
|
276
|
-
|
277
|
-
|
304
|
+
# reduce 9 omitted
|
305
|
+
|
306
|
+
module_eval(<<'.,.,', 'parser.y', 18)
|
307
|
+
def _reduce_10(val, _values, result)
|
308
|
+
@handler.start_(:array_of_tables)
|
278
309
|
result
|
279
310
|
end
|
280
311
|
.,.,
|
281
312
|
|
282
|
-
module_eval(<<'.,.,', 'parser.y',
|
283
|
-
def
|
284
|
-
|
313
|
+
module_eval(<<'.,.,', 'parser.y', 19)
|
314
|
+
def _reduce_11(val, _values, result)
|
315
|
+
@handler.start_(:table)
|
285
316
|
result
|
286
317
|
end
|
287
318
|
.,.,
|
288
319
|
|
289
|
-
|
290
|
-
|
291
|
-
module_eval(<<'.,.,', 'parser.y', 24)
|
320
|
+
module_eval(<<'.,.,', 'parser.y', 22)
|
292
321
|
def _reduce_12(val, _values, result)
|
293
|
-
array = @handler.end_(:array_of_tables); @handler.set_context(array, is_array_of_tables: true)
|
322
|
+
array = @handler.end_(:array_of_tables); @handler.set_context(array, is_array_of_tables: true)
|
294
323
|
result
|
295
324
|
end
|
296
325
|
.,.,
|
297
326
|
|
298
|
-
module_eval(<<'.,.,', 'parser.y',
|
327
|
+
module_eval(<<'.,.,', 'parser.y', 23)
|
299
328
|
def _reduce_13(val, _values, result)
|
300
|
-
array = @handler.end_(:table); @handler.set_context(array)
|
329
|
+
array = @handler.end_(:table); @handler.set_context(array)
|
301
330
|
result
|
302
331
|
end
|
303
332
|
.,.,
|
304
333
|
|
305
334
|
# reduce 14 omitted
|
306
335
|
|
307
|
-
module_eval(<<'.,.,', 'parser.y',
|
336
|
+
module_eval(<<'.,.,', 'parser.y', 27)
|
308
337
|
def _reduce_15(val, _values, result)
|
309
|
-
@handler.
|
338
|
+
array = @handler.end_(:array_of_tables); @handler.set_context(array, is_array_of_tables: true)
|
310
339
|
result
|
311
340
|
end
|
312
341
|
.,.,
|
313
342
|
|
314
|
-
module_eval(<<'.,.,', 'parser.y',
|
343
|
+
module_eval(<<'.,.,', 'parser.y', 28)
|
315
344
|
def _reduce_16(val, _values, result)
|
316
|
-
@handler.
|
345
|
+
array = @handler.end_(:table); @handler.set_context(array)
|
317
346
|
result
|
318
347
|
end
|
319
348
|
.,.,
|
320
349
|
|
321
|
-
|
322
|
-
def _reduce_17(val, _values, result)
|
323
|
-
@handler.push(val[0])
|
324
|
-
result
|
325
|
-
end
|
326
|
-
.,.,
|
350
|
+
# reduce 17 omitted
|
327
351
|
|
328
352
|
module_eval(<<'.,.,', 'parser.y', 32)
|
329
353
|
def _reduce_18(val, _values, result)
|
330
|
-
@handler.push(val[
|
354
|
+
@handler.push(val[2])
|
331
355
|
result
|
332
356
|
end
|
333
357
|
.,.,
|
334
358
|
|
335
359
|
module_eval(<<'.,.,', 'parser.y', 33)
|
336
360
|
def _reduce_19(val, _values, result)
|
337
|
-
@handler.push(
|
361
|
+
val[2].split('.').each { |k| @handler.push(k) }
|
338
362
|
result
|
339
363
|
end
|
340
364
|
.,.,
|
341
365
|
|
342
|
-
module_eval(<<'.,.,', 'parser.y',
|
366
|
+
module_eval(<<'.,.,', 'parser.y', 35)
|
343
367
|
def _reduce_20(val, _values, result)
|
344
|
-
|
368
|
+
keys = val[0].split('.')
|
369
|
+
@handler.start_(:table)
|
370
|
+
keys.each { |key| @handler.push(key) }
|
371
|
+
|
345
372
|
result
|
346
373
|
end
|
347
374
|
.,.,
|
348
375
|
|
349
|
-
|
350
|
-
|
351
|
-
|
352
|
-
def _reduce_22(val, _values, result)
|
353
|
-
@handler.start_(:inline)
|
376
|
+
module_eval(<<'.,.,', 'parser.y', 39)
|
377
|
+
def _reduce_21(val, _values, result)
|
378
|
+
@handler.push(val[0])
|
354
379
|
result
|
355
380
|
end
|
356
381
|
.,.,
|
357
382
|
|
358
|
-
|
359
|
-
|
360
|
-
|
383
|
+
# reduce 22 omitted
|
384
|
+
|
385
|
+
# reduce 23 omitted
|
386
|
+
|
387
|
+
# reduce 24 omitted
|
388
|
+
|
389
|
+
# reduce 25 omitted
|
390
|
+
|
391
|
+
# reduce 26 omitted
|
392
|
+
|
393
|
+
# reduce 27 omitted
|
394
|
+
|
395
|
+
# reduce 28 omitted
|
396
|
+
|
397
|
+
# reduce 29 omitted
|
398
|
+
|
399
|
+
# reduce 30 omitted
|
400
|
+
|
401
|
+
module_eval(<<'.,.,', 'parser.y', 55)
|
402
|
+
def _reduce_31(val, _values, result)
|
403
|
+
@handler.start_(:inline)
|
361
404
|
result
|
362
405
|
end
|
363
406
|
.,.,
|
364
407
|
|
365
|
-
|
366
|
-
|
367
|
-
module_eval(<<'.,.,', 'parser.y', 48)
|
368
|
-
def _reduce_25(val, _values, result)
|
408
|
+
module_eval(<<'.,.,', 'parser.y', 59)
|
409
|
+
def _reduce_32(val, _values, result)
|
369
410
|
array = @handler.end_(:inline)
|
370
411
|
array.map!.with_index{ |n,i| i.even? ? n.to_sym : n } if @handler.symbolize_keys
|
371
412
|
@handler.push(Hash[*array])
|
372
|
-
|
413
|
+
|
373
414
|
result
|
374
415
|
end
|
375
416
|
.,.,
|
376
417
|
|
377
|
-
# reduce
|
418
|
+
# reduce 33 omitted
|
419
|
+
|
420
|
+
# reduce 34 omitted
|
421
|
+
|
422
|
+
# reduce 35 omitted
|
423
|
+
|
424
|
+
module_eval(<<'.,.,', 'parser.y', 73)
|
425
|
+
def _reduce_36(val, _values, result)
|
426
|
+
array = @handler.end_(:inline)
|
427
|
+
array.each { |key| @handler.push(key) }
|
428
|
+
@handler.start_(:inline)
|
429
|
+
@handler.push(val[2])
|
378
430
|
|
379
|
-
module_eval(<<'.,.,', 'parser.y', 55)
|
380
|
-
def _reduce_27(val, _values, result)
|
381
|
-
@handler.push(val[0])
|
382
431
|
result
|
383
432
|
end
|
384
433
|
.,.,
|
385
434
|
|
386
|
-
|
435
|
+
module_eval(<<'.,.,', 'parser.y', 78)
|
436
|
+
def _reduce_37(val, _values, result)
|
437
|
+
@handler.push(val[0])
|
438
|
+
result
|
439
|
+
end
|
440
|
+
.,.,
|
441
|
+
|
442
|
+
# reduce 38 omitted
|
443
|
+
|
444
|
+
module_eval(<<'.,.,', 'parser.y', 85)
|
445
|
+
def _reduce_39(val, _values, result)
|
446
|
+
keys = @handler.end_(:keys)
|
447
|
+
@handler.push(keys.pop)
|
448
|
+
@handler.assign(keys)
|
387
449
|
|
388
|
-
module_eval(<<'.,.,', 'parser.y', 61)
|
389
|
-
def _reduce_29(val, _values, result)
|
390
|
-
@handler.assign(val[0])
|
391
450
|
result
|
392
451
|
end
|
393
452
|
.,.,
|
394
453
|
|
395
|
-
module_eval(<<'.,.,', 'parser.y',
|
396
|
-
def
|
397
|
-
|
454
|
+
module_eval(<<'.,.,', 'parser.y', 90)
|
455
|
+
def _reduce_40(val, _values, result)
|
456
|
+
keys = @handler.end_(:keys)
|
457
|
+
@handler.push(keys.pop)
|
458
|
+
@handler.assign(keys)
|
459
|
+
|
398
460
|
result
|
399
461
|
end
|
400
462
|
.,.,
|
401
463
|
|
402
|
-
module_eval(<<'.,.,', 'parser.y',
|
403
|
-
def
|
404
|
-
@handler.
|
464
|
+
module_eval(<<'.,.,', 'parser.y', 96)
|
465
|
+
def _reduce_41(val, _values, result)
|
466
|
+
@handler.push(val[2])
|
405
467
|
result
|
406
468
|
end
|
407
469
|
.,.,
|
408
470
|
|
409
|
-
module_eval(<<'.,.,', 'parser.y',
|
410
|
-
def
|
411
|
-
@handler.
|
471
|
+
module_eval(<<'.,.,', 'parser.y', 97)
|
472
|
+
def _reduce_42(val, _values, result)
|
473
|
+
val[2].split('.').each { |k| @handler.push(k) }
|
412
474
|
result
|
413
475
|
end
|
414
476
|
.,.,
|
415
477
|
|
416
|
-
module_eval(<<'.,.,', 'parser.y',
|
417
|
-
def
|
418
|
-
|
478
|
+
module_eval(<<'.,.,', 'parser.y', 99)
|
479
|
+
def _reduce_43(val, _values, result)
|
480
|
+
keys = val[0].split('.')
|
481
|
+
@handler.start_(:keys)
|
482
|
+
keys.each { |key| @handler.push(key) }
|
483
|
+
|
419
484
|
result
|
420
485
|
end
|
421
486
|
.,.,
|
422
487
|
|
423
|
-
module_eval(<<'.,.,', 'parser.y',
|
424
|
-
def
|
425
|
-
@handler.
|
488
|
+
module_eval(<<'.,.,', 'parser.y', 103)
|
489
|
+
def _reduce_44(val, _values, result)
|
490
|
+
@handler.start_(:keys); @handler.push(val[0])
|
426
491
|
result
|
427
492
|
end
|
428
493
|
.,.,
|
429
494
|
|
430
|
-
# reduce
|
495
|
+
# reduce 45 omitted
|
431
496
|
|
432
|
-
|
433
|
-
|
434
|
-
|
497
|
+
# reduce 46 omitted
|
498
|
+
|
499
|
+
# reduce 47 omitted
|
500
|
+
|
501
|
+
# reduce 48 omitted
|
502
|
+
|
503
|
+
# reduce 49 omitted
|
504
|
+
|
505
|
+
# reduce 50 omitted
|
506
|
+
|
507
|
+
# reduce 51 omitted
|
508
|
+
|
509
|
+
# reduce 52 omitted
|
510
|
+
|
511
|
+
module_eval(<<'.,.,', 'parser.y', 118)
|
512
|
+
def _reduce_53(val, _values, result)
|
513
|
+
array = @handler.end_(:array); @handler.push(array)
|
435
514
|
result
|
436
515
|
end
|
437
516
|
.,.,
|
438
517
|
|
439
|
-
# reduce
|
518
|
+
# reduce 54 omitted
|
440
519
|
|
441
|
-
|
442
|
-
|
443
|
-
|
520
|
+
# reduce 55 omitted
|
521
|
+
|
522
|
+
module_eval(<<'.,.,', 'parser.y', 123)
|
523
|
+
def _reduce_56(val, _values, result)
|
524
|
+
array = @handler.end_(:array); @handler.push(array)
|
444
525
|
result
|
445
526
|
end
|
446
527
|
.,.,
|
447
528
|
|
448
|
-
# reduce
|
529
|
+
# reduce 57 omitted
|
449
530
|
|
450
|
-
|
451
|
-
|
452
|
-
|
531
|
+
# reduce 58 omitted
|
532
|
+
|
533
|
+
module_eval(<<'.,.,', 'parser.y', 128)
|
534
|
+
def _reduce_59(val, _values, result)
|
535
|
+
@handler.start_(:array)
|
453
536
|
result
|
454
537
|
end
|
455
538
|
.,.,
|
456
539
|
|
457
|
-
module_eval(<<'.,.,', 'parser.y',
|
458
|
-
def
|
459
|
-
@handler.push(val[0])
|
540
|
+
module_eval(<<'.,.,', 'parser.y', 131)
|
541
|
+
def _reduce_60(val, _values, result)
|
542
|
+
@handler.push(val[0])
|
460
543
|
result
|
461
544
|
end
|
462
545
|
.,.,
|
463
546
|
|
464
|
-
# reduce
|
547
|
+
# reduce 61 omitted
|
465
548
|
|
466
|
-
# reduce
|
549
|
+
# reduce 62 omitted
|
467
550
|
|
468
|
-
# reduce
|
551
|
+
# reduce 63 omitted
|
469
552
|
|
470
|
-
# reduce
|
553
|
+
# reduce 64 omitted
|
471
554
|
|
472
|
-
# reduce
|
555
|
+
# reduce 65 omitted
|
473
556
|
|
474
|
-
module_eval(<<'.,.,', 'parser.y',
|
475
|
-
def
|
476
|
-
result = val[0].to_f
|
557
|
+
module_eval(<<'.,.,', 'parser.y', 140)
|
558
|
+
def _reduce_66(val, _values, result)
|
559
|
+
result = val[0].to_f
|
477
560
|
result
|
478
561
|
end
|
479
562
|
.,.,
|
480
563
|
|
481
|
-
module_eval(<<'.,.,', 'parser.y',
|
482
|
-
def
|
483
|
-
|
564
|
+
module_eval(<<'.,.,', 'parser.y', 142)
|
565
|
+
def _reduce_67(val, _values, result)
|
566
|
+
v = val[0]
|
567
|
+
result = if v.end_with?('nan')
|
568
|
+
Float::NAN
|
569
|
+
else
|
570
|
+
(v[0] == '-' ? -1 : 1) * Float::INFINITY
|
571
|
+
end
|
572
|
+
|
484
573
|
result
|
485
574
|
end
|
486
575
|
.,.,
|
487
576
|
|
488
|
-
module_eval(<<'.,.,', 'parser.y',
|
489
|
-
def
|
490
|
-
result =
|
577
|
+
module_eval(<<'.,.,', 'parser.y', 149)
|
578
|
+
def _reduce_68(val, _values, result)
|
579
|
+
result = val[0].to_i
|
491
580
|
result
|
492
581
|
end
|
493
582
|
.,.,
|
494
583
|
|
495
|
-
module_eval(<<'.,.,', 'parser.y',
|
496
|
-
def
|
497
|
-
|
584
|
+
module_eval(<<'.,.,', 'parser.y', 151)
|
585
|
+
def _reduce_69(val, _values, result)
|
586
|
+
base = case val[0][1]
|
587
|
+
when "x" then 16
|
588
|
+
when "o" then 8
|
589
|
+
when "b" then 2
|
590
|
+
end
|
591
|
+
result = val[0].to_i(base)
|
592
|
+
|
498
593
|
result
|
499
594
|
end
|
500
595
|
.,.,
|
501
596
|
|
502
|
-
module_eval(<<'.,.,', 'parser.y',
|
503
|
-
def
|
504
|
-
result =
|
597
|
+
module_eval(<<'.,.,', 'parser.y', 158)
|
598
|
+
def _reduce_70(val, _values, result)
|
599
|
+
result = val[0] == 'true' ? true : false
|
505
600
|
result
|
506
601
|
end
|
507
602
|
.,.,
|
508
603
|
|
509
|
-
module_eval(<<'.,.,', 'parser.y',
|
510
|
-
def
|
511
|
-
|
604
|
+
module_eval(<<'.,.,', 'parser.y', 160)
|
605
|
+
def _reduce_71(val, _values, result)
|
606
|
+
v = val[0]
|
607
|
+
result = if v[6].nil?
|
608
|
+
if v[4].nil?
|
609
|
+
LocalDate.new(v[0], v[1], v[2])
|
610
|
+
else
|
611
|
+
LocalDateTime.new(v[0], v[1], v[2], v[3] || 0, v[4] || 0, v[5].to_f)
|
612
|
+
end
|
613
|
+
else
|
614
|
+
Time.new(v[0], v[1], v[2], v[3] || 0, v[4] || 0, v[5].to_f, v[6])
|
615
|
+
end
|
616
|
+
|
512
617
|
result
|
513
618
|
end
|
514
619
|
.,.,
|
515
620
|
|
516
|
-
module_eval(<<'.,.,', 'parser.y',
|
517
|
-
def
|
518
|
-
result =
|
621
|
+
module_eval(<<'.,.,', 'parser.y', 171)
|
622
|
+
def _reduce_72(val, _values, result)
|
623
|
+
result = LocalTime.new(*val[0])
|
624
|
+
result
|
625
|
+
end
|
626
|
+
.,.,
|
627
|
+
|
628
|
+
module_eval(<<'.,.,', 'parser.y', 174)
|
629
|
+
def _reduce_73(val, _values, result)
|
630
|
+
result = StringUtils.replace_escaped_chars(StringUtils.multiline_replacements(val[0]))
|
631
|
+
result
|
632
|
+
end
|
633
|
+
.,.,
|
634
|
+
|
635
|
+
module_eval(<<'.,.,', 'parser.y', 175)
|
636
|
+
def _reduce_74(val, _values, result)
|
637
|
+
result = StringUtils.replace_escaped_chars(val[0])
|
519
638
|
result
|
520
639
|
end
|
521
640
|
.,.,
|
522
641
|
|
523
|
-
module_eval(<<'.,.,', 'parser.y',
|
524
|
-
def
|
525
|
-
result = StringUtils.strip_spaces(val[0])
|
642
|
+
module_eval(<<'.,.,', 'parser.y', 176)
|
643
|
+
def _reduce_75(val, _values, result)
|
644
|
+
result = StringUtils.strip_spaces(val[0])
|
526
645
|
result
|
527
646
|
end
|
528
647
|
.,.,
|
529
648
|
|
530
|
-
module_eval(<<'.,.,', 'parser.y',
|
531
|
-
def
|
532
|
-
result = val[0]
|
649
|
+
module_eval(<<'.,.,', 'parser.y', 177)
|
650
|
+
def _reduce_76(val, _values, result)
|
651
|
+
result = val[0]
|
533
652
|
result
|
534
653
|
end
|
535
654
|
.,.,
|
@@ -539,4 +658,4 @@ def _reduce_none(val, _values, result)
|
|
539
658
|
end
|
540
659
|
|
541
660
|
end # class GeneratedParser
|
542
|
-
|
661
|
+
end # module Tomlrb
|