tomlrb 2.0.0 → 2.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 14e652fc5bed850a8eeca40457bf6e41239de4bb2680e82e02c962bfd69ec7ba
4
- data.tar.gz: ffce44339d664c830873b002d0f236ee271e297b7a6f41dcefdce292ad872f72
3
+ metadata.gz: 629b0c5e56e0d5978b6038fba1e1ac597cfd2932b6379fe84d09508defe7ce65
4
+ data.tar.gz: 5a018444a9506276d874c43d3a2b9a234f54350fb732dd5ec5c4fac901917757
5
5
  SHA512:
6
- metadata.gz: d536f0eac4b0a13628368bf6b76bdb8a8e701807e9f4712b2dcb6805298a63c77d7774d1e9af5933404fbb5858b936bd4ed99dc55b0b0e0f4b519142f6dd5b0d
7
- data.tar.gz: 97284454aa9099242a5050364b8fd8b95bdcde050ffcca5653dc02873e182066b6bfa6bfad643d6ca751365ebb788f600be42ef6f11736689aab3a4282c1ac24
6
+ metadata.gz: 8960f08241d02b8a36d600587d148d034a229588dbb96e4738aab0c30355def92bcbf4280da4ad9966e0e3a676aff01dd8faeb0c62f16c595c4bccc32c9d3e77
7
+ data.tar.gz: 4e4179cbf1c9f88ff86ecbf15f23e2a964cd7cc3449bf420f7e8242aa125de08b7b0be9658c55d4a8c7d5c805654926144d0a30ed7d03b0d328fdb1db6a456b6
@@ -10,215 +10,177 @@ module Tomlrb
10
10
  ##### State transition tables begin ###
11
11
 
12
12
  racc_action_table = [
13
- 2, 51, 16, 49, 17, 50, 18, 54, 55, 96,
14
- 95, 19, 20, 21, 22, 14, 23, 24, 25, 26,
15
- 8, 4, 10, 27, 44, 12, 52, 47, 81, 82,
16
- 83, 84, 77, 78, 79, 80, 71, 72, 73, 74,
17
- 68, 69, 70, 75, 76, 58, 47, 62, 87, 59,
18
- 12, 81, 82, 83, 84, 77, 78, 79, 80, 71,
19
- 72, 73, 74, 68, 69, 70, 75, 76, 92, 93,
20
- 62, 49, nil, 12, 81, 82, 83, 84, 77, 78,
21
- 79, 80, 71, 72, 73, 74, 68, 69, 70, 75,
22
- 76, 100, nil, 62, 98, nil, 12, 81, 82, 83,
23
- 84, 77, 78, 79, 80, 71, 72, 73, 74, 68,
24
- 69, 70, 75, 76, 100, nil, 62, 98, nil, 12,
25
- 81, 82, 83, 84, 77, 78, 79, 80, 71, 72,
26
- 73, 74, 68, 69, 70, 75, 76, 107, nil, 62,
27
- 98, nil, 12, 81, 82, 83, 84, 77, 78, 79,
28
- 80, 71, 72, 73, 74, 68, 69, 70, 75, 76,
29
- 100, nil, 62, 98, nil, 12, 81, 82, 83, 84,
30
- 77, 78, 79, 80, 71, 72, 73, 74, 68, 69,
31
- 70, 75, 76, 100, nil, 62, 98, 33, 12, 34,
32
- nil, 35, nil, nil, nil, nil, 36, 37, 38, 39,
33
- 31, 40, 41, 42, 43, 33, nil, 34, 29, 35,
34
- nil, nil, nil, nil, 36, 37, 38, 39, 90, 40,
35
- 41, 42, 43, 16, nil, 17, 29, 18, nil, nil,
36
- nil, nil, 19, 20, 21, 22, 86, 23, 24, 25,
37
- 26, 105, nil, nil, 103, nil, nil, nil, 104 ]
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 ]
38
30
 
39
31
  racc_action_check = [
40
- 1, 13, 1, 11, 1, 13, 1, 30, 30, 60,
41
- 60, 1, 1, 1, 1, 1, 1, 1, 1, 1,
42
- 1, 1, 1, 2, 10, 1, 29, 11, 50, 50,
43
- 50, 50, 50, 50, 50, 50, 50, 50, 50, 50,
44
- 50, 50, 50, 50, 50, 48, 46, 50, 54, 48,
45
- 50, 59, 59, 59, 59, 59, 59, 59, 59, 59,
46
- 59, 59, 59, 59, 59, 59, 59, 59, 57, 58,
47
- 59, 92, nil, 59, 61, 61, 61, 61, 61, 61,
48
- 61, 61, 61, 61, 61, 61, 61, 61, 61, 61,
49
- 61, 61, nil, 61, 61, nil, 61, 100, 100, 100,
50
- 100, 100, 100, 100, 100, 100, 100, 100, 100, 100,
51
- 100, 100, 100, 100, 100, nil, 100, 100, nil, 100,
52
- 104, 104, 104, 104, 104, 104, 104, 104, 104, 104,
53
- 104, 104, 104, 104, 104, 104, 104, 104, nil, 104,
54
- 104, nil, 104, 105, 105, 105, 105, 105, 105, 105,
55
- 105, 105, 105, 105, 105, 105, 105, 105, 105, 105,
56
- 105, nil, 105, 105, nil, 105, 107, 107, 107, 107,
57
- 107, 107, 107, 107, 107, 107, 107, 107, 107, 107,
58
- 107, 107, 107, 107, nil, 107, 107, 9, 107, 9,
59
- nil, 9, nil, nil, nil, nil, 9, 9, 9, 9,
60
- 9, 9, 9, 9, 9, 55, nil, 55, 9, 55,
61
- nil, nil, nil, nil, 55, 55, 55, 55, 55, 55,
62
- 55, 55, 55, 51, nil, 51, 55, 51, nil, nil,
63
- nil, nil, 51, 51, 51, 51, 51, 51, 51, 51,
64
- 51, 99, nil, nil, 99, nil, nil, nil, 99 ]
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 ]
65
49
 
66
50
  racc_action_pointer = [
67
- nil, 0, 23, nil, nil, nil, nil, nil, nil, 185,
68
- 2, 1, nil, -23, nil, nil, nil, nil, nil, nil,
69
- nil, nil, nil, nil, nil, nil, nil, nil, nil, 3,
70
- -16, nil, nil, nil, nil, nil, nil, nil, nil, nil,
71
- nil, nil, nil, nil, nil, nil, 20, nil, 21, nil,
72
- 25, 221, nil, nil, 25, 203, nil, 41, 67, 48,
73
- -11, 71, nil, nil, nil, nil, nil, nil, nil, nil,
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,
74
57
  nil, nil, nil, nil, nil, nil, nil, nil, nil, nil,
75
58
  nil, nil, nil, nil, nil, nil, nil, nil, nil, nil,
76
- nil, nil, 69, nil, nil, nil, nil, nil, nil, 221,
77
- 94, nil, nil, nil, 117, 140, nil, 163, nil, nil,
78
- nil ]
59
+ 83, nil, nil, nil, nil, nil, nil, 144, 70, nil,
60
+ nil, nil, 87, 104, nil, nil, nil ]
79
61
 
80
62
  racc_action_default = [
81
- -1, -91, -91, -2, -3, -4, -5, -6, -7, -91,
82
- -10, -91, -34, -91, -46, -47, -48, -49, -50, -51,
83
- -52, -53, -54, -55, -56, -57, -58, 111, -8, -12,
84
- -91, -19, -20, -21, -22, -23, -24, -25, -26, -27,
85
- -28, -29, -30, -31, -9, -32, -91, -35, -91, -40,
86
- -73, -91, -11, -13, -15, -91, -33, -36, -91, -73,
87
- -91, -73, -67, -68, -69, -70, -71, -72, -74, -75,
88
- -76, -77, -78, -79, -80, -81, -82, -83, -84, -85,
89
- -86, -87, -88, -89, -90, -44, -45, -14, -16, -17,
90
- -18, -37, -91, -39, -41, -42, -43, -59, -60, -91,
91
- -73, -38, -61, -63, -73, -73, -62, -73, -64, -65,
92
- -62 ]
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 ]
93
73
 
94
74
  racc_goto_table = [
95
- 46, 15, 28, 32, 45, 60, 1, 3, 5, 6,
96
- 7, 97, 9, 53, 94, 57, 91, 13, 102, nil,
75
+ 38, 15, 24, 85, 28, 37, 54, 1, 3, 5,
76
+ 6, 7, 9, 47, 51, 79, 13, 82, 90, nil,
97
77
  nil, nil, nil, nil, nil, nil, nil, nil, nil, nil,
98
- nil, nil, nil, nil, nil, nil, nil, nil, nil, 56,
99
- nil, nil, nil, nil, nil, nil, nil, nil, 88, 89,
100
- 106, 85, nil, nil, 108, 109, nil, 110, nil, nil,
78
+ nil, nil, 50, nil, nil, nil, 94, nil, nil, nil,
79
+ 95, 96, 76, 73, 77, nil, nil, nil, nil, nil,
101
80
  nil, nil, nil, nil, nil, nil, nil, nil, nil, nil,
102
- nil, nil, nil, nil, nil, nil, nil, nil, nil, nil,
103
- nil, 101 ]
81
+ nil, nil, nil, nil, nil, nil, nil, nil, nil, 89 ]
104
82
 
105
83
  racc_goto_check = [
106
- 13, 19, 7, 10, 12, 17, 1, 2, 3, 4,
107
- 5, 22, 6, 9, 17, 15, 16, 18, 23, nil,
108
- nil, nil, nil, nil, nil, nil, nil, nil, nil, nil,
109
- nil, nil, nil, nil, nil, nil, nil, nil, nil, 12,
110
- nil, nil, nil, nil, nil, nil, nil, nil, 7, 10,
111
- 22, 19, nil, nil, 22, 22, nil, 22, nil, nil,
84
+ 13, 19, 7, 22, 10, 12, 17, 1, 2, 3,
85
+ 4, 5, 6, 9, 15, 16, 18, 17, 23, nil,
112
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,
113
89
  nil, nil, nil, nil, nil, nil, nil, nil, nil, nil,
114
- nil, 13 ]
90
+ nil, nil, nil, nil, nil, nil, nil, nil, nil, 13 ]
115
91
 
116
92
  racc_goto_pointer = [
117
- nil, 6, 6, 7, 8, 9, 11, -7, nil, -17,
118
- -6, nil, -7, -11, nil, -33, -41, -45, 16, 0,
119
- nil, nil, -50, -81, 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 ]
120
96
 
121
97
  racc_goto_default = [
122
- nil, nil, nil, nil, nil, 65, nil, nil, 30, nil,
123
- nil, 11, nil, nil, 48, nil, nil, 99, nil, nil,
124
- 64, 61, nil, nil, 63, 66, 67 ]
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 ]
125
101
 
126
102
  racc_reduce_table = [
127
103
  0, 0, :racc_error,
128
- 0, 30, :_reduce_none,
104
+ 0, 24, :_reduce_none,
105
+ 2, 24, :_reduce_none,
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,
129
117
  2, 30, :_reduce_none,
130
- 2, 30, :_reduce_none,
131
- 1, 31, :_reduce_none,
132
- 1, 31, :_reduce_none,
133
- 1, 31, :_reduce_none,
134
- 1, 31, :_reduce_none,
118
+ 2, 32, :_reduce_15,
119
+ 1, 32, :_reduce_16,
135
120
  2, 32, :_reduce_none,
136
- 2, 35, :_reduce_9,
137
- 1, 35, :_reduce_10,
138
- 2, 36, :_reduce_11,
139
- 1, 36, :_reduce_12,
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,
140
136
  2, 36, :_reduce_none,
141
- 2, 38, :_reduce_14,
142
- 1, 38, :_reduce_15,
137
+ 3, 36, :_reduce_none,
138
+ 2, 39, :_reduce_none,
139
+ 3, 37, :_reduce_36,
140
+ 1, 37, :_reduce_37,
143
141
  2, 38, :_reduce_none,
144
- 3, 37, :_reduce_17,
145
- 3, 37, :_reduce_18,
146
- 1, 37, :_reduce_19,
147
- 1, 37, :_reduce_20,
148
- 1, 39, :_reduce_none,
149
- 1, 39, :_reduce_none,
150
- 1, 39, :_reduce_none,
151
- 1, 39, :_reduce_none,
152
- 1, 39, :_reduce_none,
153
- 1, 39, :_reduce_none,
154
- 1, 39, :_reduce_none,
155
- 1, 39, :_reduce_none,
156
- 1, 39, :_reduce_none,
157
- 1, 39, :_reduce_none,
158
- 1, 39, :_reduce_none,
159
- 2, 34, :_reduce_none,
160
- 3, 34, :_reduce_none,
161
- 1, 40, :_reduce_34,
162
- 1, 41, :_reduce_35,
163
- 2, 42, :_reduce_none,
164
- 3, 42, :_reduce_none,
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,
165
158
  2, 45, :_reduce_none,
166
- 3, 43, :_reduce_39,
167
- 1, 43, :_reduce_40,
168
- 2, 44, :_reduce_none,
169
- 4, 33, :_reduce_42,
170
- 4, 33, :_reduce_43,
171
- 3, 47, :_reduce_44,
172
- 3, 47, :_reduce_45,
173
- 1, 47, :_reduce_46,
174
- 1, 47, :_reduce_47,
175
- 1, 48, :_reduce_none,
176
- 1, 48, :_reduce_none,
177
- 1, 48, :_reduce_none,
178
- 1, 48, :_reduce_none,
179
- 1, 48, :_reduce_none,
180
- 1, 48, :_reduce_none,
181
- 1, 48, :_reduce_none,
182
- 1, 48, :_reduce_none,
183
- 1, 48, :_reduce_none,
184
- 1, 48, :_reduce_none,
185
- 1, 48, :_reduce_none,
186
- 2, 49, :_reduce_none,
187
- 1, 51, :_reduce_60,
188
- 2, 51, :_reduce_none,
189
- 2, 51, :_reduce_none,
190
- 1, 52, :_reduce_63,
191
- 2, 52, :_reduce_none,
192
- 2, 52, :_reduce_none,
193
- 3, 52, :_reduce_none,
194
- 1, 50, :_reduce_67,
195
- 1, 46, :_reduce_68,
196
- 1, 46, :_reduce_none,
197
- 1, 46, :_reduce_none,
198
- 1, 53, :_reduce_none,
199
- 1, 53, :_reduce_none,
200
- 0, 55, :_reduce_none,
201
- 1, 55, :_reduce_74,
202
- 1, 55, :_reduce_75,
203
- 1, 55, :_reduce_76,
204
- 1, 55, :_reduce_77,
205
- 1, 55, :_reduce_78,
206
- 1, 55, :_reduce_79,
207
- 1, 55, :_reduce_80,
208
- 1, 55, :_reduce_81,
209
- 1, 55, :_reduce_82,
210
- 1, 55, :_reduce_83,
211
- 1, 55, :_reduce_84,
212
- 1, 55, :_reduce_85,
213
- 1, 55, :_reduce_86,
214
- 1, 54, :_reduce_87,
215
- 1, 54, :_reduce_88,
216
- 1, 54, :_reduce_89,
217
- 1, 54, :_reduce_90 ]
218
-
219
- racc_reduce_n = 91
220
-
221
- racc_shift_n = 111
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
222
184
 
223
185
  racc_token_table = {
224
186
  false => 0,
@@ -229,29 +191,23 @@ racc_token_table = {
229
191
  :STRING_LITERAL_MULTI => 5,
230
192
  :STRING_LITERAL => 6,
231
193
  :DATETIME => 7,
232
- :LOCAL_DATETIME => 8,
233
- :LOCAL_DATE => 9,
234
- :LOCAL_TIME => 10,
235
- :INTEGER => 11,
236
- :HEX_INTEGER => 12,
237
- :OCT_INTEGER => 13,
238
- :BIN_INTEGER => 14,
239
- :FLOAT => 15,
240
- :FLOAT_INF => 16,
241
- :FLOAT_NAN => 17,
242
- :TRUE => 18,
243
- :FALSE => 19,
244
- :NEWLINE => 20,
245
- :EOS => 21,
246
- "[" => 22,
247
- "]" => 23,
248
- "." => 24,
249
- "{" => 25,
250
- "}" => 26,
251
- "," => 27,
252
- "=" => 28 }
253
-
254
- racc_nt_base = 29
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
255
211
 
256
212
  racc_use_result_var = true
257
213
 
@@ -280,18 +236,12 @@ Racc_token_to_s_table = [
280
236
  "STRING_LITERAL_MULTI",
281
237
  "STRING_LITERAL",
282
238
  "DATETIME",
283
- "LOCAL_DATETIME",
284
- "LOCAL_DATE",
285
239
  "LOCAL_TIME",
286
240
  "INTEGER",
287
- "HEX_INTEGER",
288
- "OCT_INTEGER",
289
- "BIN_INTEGER",
241
+ "NON_DEC_INTEGER",
290
242
  "FLOAT",
291
- "FLOAT_INF",
292
- "FLOAT_NAN",
293
- "TRUE",
294
- "FALSE",
243
+ "FLOAT_KEYWORD",
244
+ "BOOLEAN",
295
245
  "NEWLINE",
296
246
  "EOS",
297
247
  "\"[\"",
@@ -351,68 +301,70 @@ Racc_debug_parser = false
351
301
 
352
302
  # reduce 8 omitted
353
303
 
354
- module_eval(<<'.,.,', 'parser.y', 17)
355
- def _reduce_9(val, _values, result)
304
+ # reduce 9 omitted
305
+
306
+ module_eval(<<'.,.,', 'parser.y', 18)
307
+ def _reduce_10(val, _values, result)
356
308
  @handler.start_(:array_of_tables)
357
309
  result
358
310
  end
359
311
  .,.,
360
312
 
361
- module_eval(<<'.,.,', 'parser.y', 18)
362
- def _reduce_10(val, _values, result)
313
+ module_eval(<<'.,.,', 'parser.y', 19)
314
+ def _reduce_11(val, _values, result)
363
315
  @handler.start_(:table)
364
316
  result
365
317
  end
366
318
  .,.,
367
319
 
368
- module_eval(<<'.,.,', 'parser.y', 21)
369
- def _reduce_11(val, _values, result)
320
+ module_eval(<<'.,.,', 'parser.y', 22)
321
+ def _reduce_12(val, _values, result)
370
322
  array = @handler.end_(:array_of_tables); @handler.set_context(array, is_array_of_tables: true)
371
323
  result
372
324
  end
373
325
  .,.,
374
326
 
375
- module_eval(<<'.,.,', 'parser.y', 22)
376
- def _reduce_12(val, _values, result)
327
+ module_eval(<<'.,.,', 'parser.y', 23)
328
+ def _reduce_13(val, _values, result)
377
329
  array = @handler.end_(:table); @handler.set_context(array)
378
330
  result
379
331
  end
380
332
  .,.,
381
333
 
382
- # reduce 13 omitted
334
+ # reduce 14 omitted
383
335
 
384
- module_eval(<<'.,.,', 'parser.y', 26)
385
- def _reduce_14(val, _values, result)
336
+ module_eval(<<'.,.,', 'parser.y', 27)
337
+ def _reduce_15(val, _values, result)
386
338
  array = @handler.end_(:array_of_tables); @handler.set_context(array, is_array_of_tables: true)
387
339
  result
388
340
  end
389
341
  .,.,
390
342
 
391
- module_eval(<<'.,.,', 'parser.y', 27)
392
- def _reduce_15(val, _values, result)
343
+ module_eval(<<'.,.,', 'parser.y', 28)
344
+ def _reduce_16(val, _values, result)
393
345
  array = @handler.end_(:table); @handler.set_context(array)
394
346
  result
395
347
  end
396
348
  .,.,
397
349
 
398
- # reduce 16 omitted
350
+ # reduce 17 omitted
399
351
 
400
- module_eval(<<'.,.,', 'parser.y', 31)
401
- def _reduce_17(val, _values, result)
352
+ module_eval(<<'.,.,', 'parser.y', 32)
353
+ def _reduce_18(val, _values, result)
402
354
  @handler.push(val[2])
403
355
  result
404
356
  end
405
357
  .,.,
406
358
 
407
- module_eval(<<'.,.,', 'parser.y', 32)
408
- def _reduce_18(val, _values, result)
359
+ module_eval(<<'.,.,', 'parser.y', 33)
360
+ def _reduce_19(val, _values, result)
409
361
  val[2].split('.').each { |k| @handler.push(k) }
410
362
  result
411
363
  end
412
364
  .,.,
413
365
 
414
- module_eval(<<'.,.,', 'parser.y', 34)
415
- def _reduce_19(val, _values, result)
366
+ module_eval(<<'.,.,', 'parser.y', 35)
367
+ def _reduce_20(val, _values, result)
416
368
  keys = val[0].split('.')
417
369
  @handler.start_(:table)
418
370
  keys.each { |key| @handler.push(key) }
@@ -421,15 +373,13 @@ module_eval(<<'.,.,', 'parser.y', 34)
421
373
  end
422
374
  .,.,
423
375
 
424
- module_eval(<<'.,.,', 'parser.y', 38)
425
- def _reduce_20(val, _values, result)
376
+ module_eval(<<'.,.,', 'parser.y', 39)
377
+ def _reduce_21(val, _values, result)
426
378
  @handler.push(val[0])
427
379
  result
428
380
  end
429
381
  .,.,
430
382
 
431
- # reduce 21 omitted
432
-
433
383
  # reduce 22 omitted
434
384
 
435
385
  # reduce 23 omitted
@@ -448,21 +398,15 @@ module_eval(<<'.,.,', 'parser.y', 38)
448
398
 
449
399
  # reduce 30 omitted
450
400
 
451
- # reduce 31 omitted
452
-
453
- # reduce 32 omitted
454
-
455
- # reduce 33 omitted
456
-
457
- module_eval(<<'.,.,', 'parser.y', 58)
458
- def _reduce_34(val, _values, result)
401
+ module_eval(<<'.,.,', 'parser.y', 55)
402
+ def _reduce_31(val, _values, result)
459
403
  @handler.start_(:inline)
460
404
  result
461
405
  end
462
406
  .,.,
463
407
 
464
- module_eval(<<'.,.,', 'parser.y', 62)
465
- def _reduce_35(val, _values, result)
408
+ module_eval(<<'.,.,', 'parser.y', 59)
409
+ def _reduce_32(val, _values, result)
466
410
  array = @handler.end_(:inline)
467
411
  array.map!.with_index{ |n,i| i.even? ? n.to_sym : n } if @handler.symbolize_keys
468
412
  @handler.push(Hash[*array])
@@ -471,14 +415,14 @@ module_eval(<<'.,.,', 'parser.y', 62)
471
415
  end
472
416
  .,.,
473
417
 
474
- # reduce 36 omitted
418
+ # reduce 33 omitted
475
419
 
476
- # reduce 37 omitted
420
+ # reduce 34 omitted
477
421
 
478
- # reduce 38 omitted
422
+ # reduce 35 omitted
479
423
 
480
- module_eval(<<'.,.,', 'parser.y', 76)
481
- def _reduce_39(val, _values, result)
424
+ module_eval(<<'.,.,', 'parser.y', 73)
425
+ def _reduce_36(val, _values, result)
482
426
  array = @handler.end_(:inline)
483
427
  array.each { |key| @handler.push(key) }
484
428
  @handler.start_(:inline)
@@ -488,17 +432,17 @@ module_eval(<<'.,.,', 'parser.y', 76)
488
432
  end
489
433
  .,.,
490
434
 
491
- module_eval(<<'.,.,', 'parser.y', 81)
492
- def _reduce_40(val, _values, result)
435
+ module_eval(<<'.,.,', 'parser.y', 78)
436
+ def _reduce_37(val, _values, result)
493
437
  @handler.push(val[0])
494
438
  result
495
439
  end
496
440
  .,.,
497
441
 
498
- # reduce 41 omitted
442
+ # reduce 38 omitted
499
443
 
500
- module_eval(<<'.,.,', 'parser.y', 88)
501
- def _reduce_42(val, _values, result)
444
+ module_eval(<<'.,.,', 'parser.y', 85)
445
+ def _reduce_39(val, _values, result)
502
446
  keys = @handler.end_(:keys)
503
447
  @handler.push(keys.pop)
504
448
  @handler.assign(keys)
@@ -507,8 +451,8 @@ module_eval(<<'.,.,', 'parser.y', 88)
507
451
  end
508
452
  .,.,
509
453
 
510
- module_eval(<<'.,.,', 'parser.y', 93)
511
- def _reduce_43(val, _values, result)
454
+ module_eval(<<'.,.,', 'parser.y', 90)
455
+ def _reduce_40(val, _values, result)
512
456
  keys = @handler.end_(:keys)
513
457
  @handler.push(keys.pop)
514
458
  @handler.assign(keys)
@@ -517,22 +461,22 @@ module_eval(<<'.,.,', 'parser.y', 93)
517
461
  end
518
462
  .,.,
519
463
 
520
- module_eval(<<'.,.,', 'parser.y', 99)
521
- def _reduce_44(val, _values, result)
464
+ module_eval(<<'.,.,', 'parser.y', 96)
465
+ def _reduce_41(val, _values, result)
522
466
  @handler.push(val[2])
523
467
  result
524
468
  end
525
469
  .,.,
526
470
 
527
- module_eval(<<'.,.,', 'parser.y', 100)
528
- def _reduce_45(val, _values, result)
471
+ module_eval(<<'.,.,', 'parser.y', 97)
472
+ def _reduce_42(val, _values, result)
529
473
  val[2].split('.').each { |k| @handler.push(k) }
530
474
  result
531
475
  end
532
476
  .,.,
533
477
 
534
- module_eval(<<'.,.,', 'parser.y', 102)
535
- def _reduce_46(val, _values, result)
478
+ module_eval(<<'.,.,', 'parser.y', 99)
479
+ def _reduce_43(val, _values, result)
536
480
  keys = val[0].split('.')
537
481
  @handler.start_(:keys)
538
482
  keys.each { |key| @handler.push(key) }
@@ -541,13 +485,19 @@ module_eval(<<'.,.,', 'parser.y', 102)
541
485
  end
542
486
  .,.,
543
487
 
544
- module_eval(<<'.,.,', 'parser.y', 106)
545
- def _reduce_47(val, _values, result)
488
+ module_eval(<<'.,.,', 'parser.y', 103)
489
+ def _reduce_44(val, _values, result)
546
490
  @handler.start_(:keys); @handler.push(val[0])
547
491
  result
548
492
  end
549
493
  .,.,
550
494
 
495
+ # reduce 45 omitted
496
+
497
+ # reduce 46 omitted
498
+
499
+ # reduce 47 omitted
500
+
551
501
  # reduce 48 omitted
552
502
 
553
503
  # reduce 49 omitted
@@ -558,182 +508,146 @@ module_eval(<<'.,.,', 'parser.y', 106)
558
508
 
559
509
  # reduce 52 omitted
560
510
 
561
- # reduce 53 omitted
562
-
563
- # reduce 54 omitted
564
-
565
- # reduce 55 omitted
566
-
567
- # reduce 56 omitted
568
-
569
- # reduce 57 omitted
570
-
571
- # reduce 58 omitted
572
-
573
- # reduce 59 omitted
574
-
575
- module_eval(<<'.,.,', 'parser.y', 125)
576
- def _reduce_60(val, _values, result)
511
+ module_eval(<<'.,.,', 'parser.y', 118)
512
+ def _reduce_53(val, _values, result)
577
513
  array = @handler.end_(:array); @handler.push(array)
578
514
  result
579
515
  end
580
516
  .,.,
581
517
 
582
- # reduce 61 omitted
518
+ # reduce 54 omitted
583
519
 
584
- # reduce 62 omitted
520
+ # reduce 55 omitted
585
521
 
586
- module_eval(<<'.,.,', 'parser.y', 130)
587
- def _reduce_63(val, _values, result)
522
+ module_eval(<<'.,.,', 'parser.y', 123)
523
+ def _reduce_56(val, _values, result)
588
524
  array = @handler.end_(:array); @handler.push(array)
589
525
  result
590
526
  end
591
527
  .,.,
592
528
 
593
- # reduce 64 omitted
594
-
595
- # reduce 65 omitted
529
+ # reduce 57 omitted
596
530
 
597
- # reduce 66 omitted
531
+ # reduce 58 omitted
598
532
 
599
- module_eval(<<'.,.,', 'parser.y', 136)
600
- def _reduce_67(val, _values, result)
533
+ module_eval(<<'.,.,', 'parser.y', 128)
534
+ def _reduce_59(val, _values, result)
601
535
  @handler.start_(:array)
602
536
  result
603
537
  end
604
538
  .,.,
605
539
 
606
- module_eval(<<'.,.,', 'parser.y', 139)
607
- def _reduce_68(val, _values, result)
540
+ module_eval(<<'.,.,', 'parser.y', 131)
541
+ def _reduce_60(val, _values, result)
608
542
  @handler.push(val[0])
609
543
  result
610
544
  end
611
545
  .,.,
612
546
 
613
- # reduce 69 omitted
547
+ # reduce 61 omitted
614
548
 
615
- # reduce 70 omitted
549
+ # reduce 62 omitted
616
550
 
617
- # reduce 71 omitted
551
+ # reduce 63 omitted
618
552
 
619
- # reduce 72 omitted
553
+ # reduce 64 omitted
620
554
 
621
- # reduce 73 omitted
555
+ # reduce 65 omitted
622
556
 
623
- module_eval(<<'.,.,', 'parser.y', 148)
624
- def _reduce_74(val, _values, result)
557
+ module_eval(<<'.,.,', 'parser.y', 140)
558
+ def _reduce_66(val, _values, result)
625
559
  result = val[0].to_f
626
560
  result
627
561
  end
628
562
  .,.,
629
563
 
630
- module_eval(<<'.,.,', 'parser.y', 149)
631
- def _reduce_75(val, _values, result)
632
- result = (val[0][0] == '-' ? -1 : 1) * Float::INFINITY
633
- result
634
- end
635
- .,.,
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
636
572
 
637
- module_eval(<<'.,.,', 'parser.y', 150)
638
- def _reduce_76(val, _values, result)
639
- result = Float::NAN
640
573
  result
641
574
  end
642
575
  .,.,
643
576
 
644
- module_eval(<<'.,.,', 'parser.y', 151)
645
- def _reduce_77(val, _values, result)
577
+ module_eval(<<'.,.,', 'parser.y', 149)
578
+ def _reduce_68(val, _values, result)
646
579
  result = val[0].to_i
647
580
  result
648
581
  end
649
582
  .,.,
650
583
 
651
- module_eval(<<'.,.,', 'parser.y', 152)
652
- def _reduce_78(val, _values, result)
653
- result = val[0].to_i(16)
654
- result
655
- end
656
- .,.,
657
-
658
- module_eval(<<'.,.,', 'parser.y', 153)
659
- def _reduce_79(val, _values, result)
660
- result = val[0].to_i(8)
661
- result
662
- end
663
- .,.,
664
-
665
- module_eval(<<'.,.,', 'parser.y', 154)
666
- def _reduce_80(val, _values, result)
667
- result = val[0].to_i(2)
668
- result
669
- end
670
- .,.,
671
-
672
- module_eval(<<'.,.,', 'parser.y', 155)
673
- def _reduce_81(val, _values, result)
674
- result = true
675
- result
676
- end
677
- .,.,
678
-
679
- module_eval(<<'.,.,', 'parser.y', 156)
680
- def _reduce_82(val, _values, result)
681
- result = false
682
- result
683
- end
684
- .,.,
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)
685
592
 
686
- module_eval(<<'.,.,', 'parser.y', 157)
687
- def _reduce_83(val, _values, result)
688
- result = Time.new(*val[0])
689
593
  result
690
594
  end
691
595
  .,.,
692
596
 
693
597
  module_eval(<<'.,.,', 'parser.y', 158)
694
- def _reduce_84(val, _values, result)
695
- result = LocalDateTime.new(*val[0])
598
+ def _reduce_70(val, _values, result)
599
+ result = val[0] == 'true' ? true : false
696
600
  result
697
601
  end
698
602
  .,.,
699
603
 
700
- module_eval(<<'.,.,', 'parser.y', 159)
701
- def _reduce_85(val, _values, result)
702
- result = LocalDate.new(*val[0])
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
+
703
617
  result
704
618
  end
705
619
  .,.,
706
620
 
707
- module_eval(<<'.,.,', 'parser.y', 160)
708
- def _reduce_86(val, _values, result)
621
+ module_eval(<<'.,.,', 'parser.y', 171)
622
+ def _reduce_72(val, _values, result)
709
623
  result = LocalTime.new(*val[0])
710
624
  result
711
625
  end
712
626
  .,.,
713
627
 
714
- module_eval(<<'.,.,', 'parser.y', 163)
715
- def _reduce_87(val, _values, result)
628
+ module_eval(<<'.,.,', 'parser.y', 174)
629
+ def _reduce_73(val, _values, result)
716
630
  result = StringUtils.replace_escaped_chars(StringUtils.multiline_replacements(val[0]))
717
631
  result
718
632
  end
719
633
  .,.,
720
634
 
721
- module_eval(<<'.,.,', 'parser.y', 164)
722
- def _reduce_88(val, _values, result)
635
+ module_eval(<<'.,.,', 'parser.y', 175)
636
+ def _reduce_74(val, _values, result)
723
637
  result = StringUtils.replace_escaped_chars(val[0])
724
638
  result
725
639
  end
726
640
  .,.,
727
641
 
728
- module_eval(<<'.,.,', 'parser.y', 165)
729
- def _reduce_89(val, _values, result)
642
+ module_eval(<<'.,.,', 'parser.y', 176)
643
+ def _reduce_75(val, _values, result)
730
644
  result = StringUtils.strip_spaces(val[0])
731
645
  result
732
646
  end
733
647
  .,.,
734
648
 
735
- module_eval(<<'.,.,', 'parser.y', 166)
736
- def _reduce_90(val, _values, result)
649
+ module_eval(<<'.,.,', 'parser.y', 177)
650
+ def _reduce_76(val, _values, result)
737
651
  result = val[0]
738
652
  result
739
653
  end
@@ -125,6 +125,7 @@ module Tomlrb
125
125
  end
126
126
  end
127
127
 
128
+ current.clear_children if is_array_of_tables
128
129
  current
129
130
  end
130
131
 
@@ -191,6 +192,10 @@ module Tomlrb
191
192
  @children[key] = existed || self.class.new(key, type, declared)
192
193
  end
193
194
 
195
+ def clear_children
196
+ @children.clear
197
+ end
198
+
194
199
  private
195
200
 
196
201
  def validate_already_declared_as_different_key(type, declared, existed)
@@ -22,7 +22,7 @@ module Tomlrb
22
22
  end
23
23
 
24
24
  def ==(other)
25
- other.respond_to?(:to_time) &&
25
+ other.kind_of?(self.class) &&
26
26
  to_time == other.to_time
27
27
  end
28
28
 
@@ -29,7 +29,7 @@ module Tomlrb
29
29
  end
30
30
 
31
31
  def ==(other)
32
- other.respond_to?(:to_time) &&
32
+ other.kind_of?(self.class) &&
33
33
  to_time == other.to_time
34
34
  end
35
35
 
@@ -27,7 +27,7 @@ module Tomlrb
27
27
  end
28
28
 
29
29
  def ==(other)
30
- other.respond_to?(:to_time) &&
30
+ other.kind_of?(self.class) &&
31
31
  @time == other.to_time(0, 1, 1)
32
32
  end
33
33
 
@@ -1,5 +1,5 @@
1
1
  class Tomlrb::GeneratedParser
2
- token IDENTIFIER STRING_MULTI STRING_BASIC STRING_LITERAL_MULTI STRING_LITERAL DATETIME LOCAL_DATETIME LOCAL_DATE LOCAL_TIME INTEGER HEX_INTEGER OCT_INTEGER BIN_INTEGER FLOAT FLOAT_INF FLOAT_NAN TRUE FALSE NEWLINE EOS
2
+ token IDENTIFIER STRING_MULTI STRING_BASIC STRING_LITERAL_MULTI STRING_LITERAL DATETIME LOCAL_TIME INTEGER NON_DEC_INTEGER FLOAT FLOAT_KEYWORD BOOLEAN NEWLINE EOS
3
3
  rule
4
4
  expressions
5
5
  | expressions expression
@@ -12,7 +12,8 @@ rule
12
12
  | NEWLINE
13
13
  ;
14
14
  table
15
- : table_start table_continued
15
+ : table_start table_continued NEWLINE
16
+ | table_start table_continued EOS
16
17
  ;
17
18
  table_start
18
19
  : '[' '[' { @handler.start_(:array_of_tables) }
@@ -43,13 +44,9 @@ rule
43
44
  | STRING_BASIC
44
45
  | STRING_LITERAL
45
46
  | INTEGER
46
- | HEX_INTEGER
47
- | OCT_INTEGER
48
- | BIN_INTEGER
49
- | FLOAT_INF
50
- | FLOAT_NAN
51
- | TRUE
52
- | FALSE
47
+ | NON_DEC_INTEGER
48
+ | FLOAT_KEYWORD
49
+ | BOOLEAN
53
50
  ;
54
51
  inline_table
55
52
  : inline_table_start inline_table_end
@@ -111,13 +108,9 @@ rule
111
108
  | STRING_BASIC
112
109
  | STRING_LITERAL
113
110
  | INTEGER
114
- | HEX_INTEGER
115
- | OCT_INTEGER
116
- | BIN_INTEGER
117
- | FLOAT_INF
118
- | FLOAT_NAN
119
- | TRUE
120
- | FALSE
111
+ | NON_DEC_INTEGER
112
+ | FLOAT_KEYWORD
113
+ | BOOLEAN
121
114
  ;
122
115
  array
123
116
  : start_array array_continued
@@ -131,7 +124,6 @@ rule
131
124
  : ']' { array = @handler.end_(:array); @handler.push(array) }
132
125
  | ',' array_continued
133
126
  | NEWLINE array_continued
134
- | ',' NEWLINE array_continued
135
127
  ;
136
128
  start_array
137
129
  : '[' { @handler.start_(:array) }
@@ -147,17 +139,36 @@ rule
147
139
  ;
148
140
  literal
149
141
  | FLOAT { result = val[0].to_f }
150
- | FLOAT_INF { result = (val[0][0] == '-' ? -1 : 1) * Float::INFINITY }
151
- | FLOAT_NAN { result = Float::NAN }
142
+ | FLOAT_KEYWORD {
143
+ v = val[0]
144
+ result = if v.end_with?('nan')
145
+ Float::NAN
146
+ else
147
+ (v[0] == '-' ? -1 : 1) * Float::INFINITY
148
+ end
149
+ }
152
150
  | INTEGER { result = val[0].to_i }
153
- | HEX_INTEGER { result = val[0].to_i(16) }
154
- | OCT_INTEGER { result = val[0].to_i(8) }
155
- | BIN_INTEGER { result = val[0].to_i(2) }
156
- | TRUE { result = true }
157
- | FALSE { result = false }
158
- | DATETIME { result = Time.new(*val[0])}
159
- | LOCAL_DATETIME { result = LocalDateTime.new(*val[0]) }
160
- | LOCAL_DATE { result = LocalDate.new(*val[0]) }
151
+ | NON_DEC_INTEGER {
152
+ base = case val[0][1]
153
+ when "x" then 16
154
+ when "o" then 8
155
+ when "b" then 2
156
+ end
157
+ result = val[0].to_i(base)
158
+ }
159
+ | BOOLEAN { result = val[0] == 'true' ? true : false }
160
+ | DATETIME {
161
+ v = val[0]
162
+ result = if v[6].nil?
163
+ if v[4].nil?
164
+ LocalDate.new(v[0], v[1], v[2])
165
+ else
166
+ LocalDateTime.new(v[0], v[1], v[2], v[3] || 0, v[4] || 0, v[5].to_f)
167
+ end
168
+ else
169
+ Time.new(v[0], v[1], v[2], v[3] || 0, v[4] || 0, v[5].to_f, v[6])
170
+ end
171
+ }
161
172
  | LOCAL_TIME { result = LocalTime.new(*val[0]) }
162
173
  ;
163
174
  string
@@ -5,24 +5,18 @@ module Tomlrb
5
5
  COMMENT = /#[^\u0000-\u0008\u000A-\u001F\u007F]*/
6
6
  IDENTIFIER = /[A-Za-z0-9_-]+/
7
7
  SPACE = /[ \t]/
8
- NEWLINE = /(\r?\n)/
8
+ NEWLINE = /(?:[ \t]*(?:\r?\n)[ \t]*)+/
9
9
  STRING_BASIC = /(["])(?:\\?[^\u0000-\u0008\u000A-\u001F\u007F])*?\1/
10
10
  STRING_MULTI = /"{3}([^\u0000-\u0008\u000B\u000C\u000E-\u001F\u007F]*?(?<!\\)"{3,5})/m
11
11
  STRING_LITERAL = /(['])(?:\\?[^\u0000-\u0008\u000A-\u001F\u007F])*?\1/
12
12
  STRING_LITERAL_MULTI = /'{3}([^\u0000-\u0008\u000B\u000C\u000E-\u001F\u007F]*?'{3,5})/m
13
- DATETIME = /(-?\d{4})-(\d{2})-(\d{2})(?:(?:t|\s)(\d{2}):(\d{2}):(\d{2}(?:\.\d+)?))?(z|[-+]\d{2}:\d{2})/i
14
- LOCAL_DATETIME = /(-?\d{4})-(\d{2})-(\d{2})(?:t|\s)(\d{2}):(\d{2}):(\d{2}(?:\.\d+)?)/i
15
- LOCAL_DATE = /(-?\d{4})-(\d{2})-(\d{2})/
13
+ DATETIME = /(-?\d{4})-(\d{2})-(\d{2})(?:(?:t|\s)(\d{2}):(\d{2}):(\d{2}(?:\.\d+)?))?(z|[-+]\d{2}:\d{2})?/i
16
14
  LOCAL_TIME = /(\d{2}):(\d{2}):(\d{2}(?:\.\d+)?)/
17
15
  FLOAT = /[+-]?(?:(?:\d|[1-9](?:_?\d)*)\.\d(?:_?\d)*|\d+(?=[eE]))(?:[eE][+-]?[0-9_]+)?(?!\w)/
18
- FLOAT_INF = /[+-]?inf\b/
19
- FLOAT_NAN = /[+-]?nan\b/
16
+ FLOAT_KEYWORD = /[+-]?(?:inf|nan)\b/
20
17
  INTEGER = /[+-]?([1-9](_?\d)*|0)(?![A-Za-z0-9_-]+)/
21
- HEX_INTEGER = /0x[0-9A-Fa-f][0-9A-Fa-f_]*/
22
- OCT_INTEGER = /0o[0-7][0-7_]*/
23
- BIN_INTEGER = /0b[01][01_]*/
24
- TRUE = /true/
25
- FALSE = /false/
18
+ NON_DEC_INTEGER = /0(?:x[0-9A-Fa-f][0-9A-Fa-f_]*|o[0-7][0-7_]*|b[01][01_]*)/
19
+ BOOLEAN = /true|false/
26
20
 
27
21
  def initialize(io)
28
22
  @ss = StringScanner.new(io.read)
@@ -31,52 +25,34 @@ module Tomlrb
31
25
 
32
26
  def next_token
33
27
  case
34
- when @ss.eos? then process_eos
28
+ when @ss.scan(NEWLINE) then [:NEWLINE, nil]
35
29
  when @ss.scan(SPACE) then next_token
36
30
  when @ss.scan(COMMENT) then next_token
37
31
  when @ss.scan(DATETIME) then process_datetime
38
- when @ss.scan(LOCAL_DATETIME) then process_local_datetime
39
- when @ss.scan(LOCAL_DATE) then process_local_date
40
32
  when @ss.scan(LOCAL_TIME) then process_local_time
41
33
  when text = @ss.scan(STRING_MULTI) then [:STRING_MULTI, text[3..-4]]
42
34
  when text = @ss.scan(STRING_BASIC) then [:STRING_BASIC, text[1..-2]]
43
35
  when text = @ss.scan(STRING_LITERAL_MULTI) then [:STRING_LITERAL_MULTI, text[3..-4]]
44
36
  when text = @ss.scan(STRING_LITERAL) then [:STRING_LITERAL, text[1..-2]]
45
37
  when text = @ss.scan(FLOAT) then [:FLOAT, text]
46
- when text = @ss.scan(FLOAT_INF) then [:FLOAT_INF, text]
47
- when text = @ss.scan(FLOAT_NAN) then [:FLOAT_NAN, text]
38
+ when text = @ss.scan(FLOAT_KEYWORD) then [:FLOAT_KEYWORD, text]
48
39
  when text = @ss.scan(INTEGER) then [:INTEGER, text]
49
- when text = @ss.scan(HEX_INTEGER) then [:HEX_INTEGER, text]
50
- when text = @ss.scan(OCT_INTEGER) then [:OCT_INTEGER, text]
51
- when text = @ss.scan(BIN_INTEGER) then [:BIN_INTEGER, text]
52
- when text = @ss.scan(TRUE) then [:TRUE, text]
53
- when text = @ss.scan(FALSE) then [:FALSE, text]
54
- when text = @ss.scan(NEWLINE) then [:NEWLINE, text]
40
+ when text = @ss.scan(NON_DEC_INTEGER) then [:NON_DEC_INTEGER, text]
41
+ when text = @ss.scan(BOOLEAN) then [:BOOLEAN, text]
55
42
  when text = @ss.scan(IDENTIFIER) then [:IDENTIFIER, text]
43
+ when @ss.eos? then process_eos
56
44
  else x = @ss.getch; [x, x]
57
45
  end
58
46
  end
59
47
 
60
48
  def process_datetime
61
- if @ss[7].nil?
62
- offset = '+00:00'
63
- else
49
+ if @ss[7]
64
50
  offset = @ss[7].gsub('Z', '+00:00')
65
51
  end
66
- args = [@ss[1], @ss[2], @ss[3], @ss[4] || 0, @ss[5] || 0, @ss[6].to_f, offset]
52
+ args = [@ss[1], @ss[2], @ss[3], @ss[4], @ss[5], @ss[6], offset]
67
53
  [:DATETIME, args]
68
54
  end
69
55
 
70
- def process_local_datetime
71
- args = [@ss[1], @ss[2], @ss[3], @ss[4] || 0, @ss[5] || 0, @ss[6].to_f]
72
- [:LOCAL_DATETIME, args]
73
- end
74
-
75
- def process_local_date
76
- args = [@ss[1], @ss[2], @ss[3]]
77
- [:LOCAL_DATE, args]
78
- end
79
-
80
56
  def process_local_time
81
57
  args = [@ss[1], @ss[2], @ss[3].to_f]
82
58
  [:LOCAL_TIME, args]
@@ -1,3 +1,3 @@
1
1
  module Tomlrb
2
- VERSION = '2.0.0'.freeze
2
+ VERSION = '2.0.1'.freeze
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: tomlrb
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.0.0
4
+ version: 2.0.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Francois Bernier
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-11-25 00:00:00.000000000 Z
11
+ date: 2020-12-20 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description: A racc based toml parser
14
14
  email: