kdl 1.0.0 → 1.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +1 -0
- data/bin/kdl +8 -0
- data/lib/kdl/kdl.tab.rb +152 -137
- data/lib/kdl/kdl.yy +13 -12
- data/lib/kdl/node.rb +3 -5
- data/lib/kdl/tokenizer.rb +5 -19
- data/lib/kdl/version.rb +1 -1
- metadata +4 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e6560ca3f6df5d91a1a93832f8e5989f16d7e2ee100fa784dcc932e755425008
|
4
|
+
data.tar.gz: 76a907c6df892adf81898b03b204259284d08c43c4c9b2faff628d82d62c620d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 05bff4830aa073df4e14ea87d9eb947ef83009afb5fc2e39ead76d54efe53836e9025e020b4d4a9cd139d52fd1e45bde55005d999ad4f1c2afccfc74d10f5a45
|
7
|
+
data.tar.gz: 7bea0334e44f33d2022ed2dfc9b59815ba0d380d04d79763958192b4e4146afe622d2e134208899a629f7638528227e50614476076f4e5de620510d8cc7d8e7f
|
data/.gitignore
CHANGED
data/bin/kdl
ADDED
data/lib/kdl/kdl.tab.rb
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
#
|
2
2
|
# DO NOT MODIFY!!!!
|
3
|
-
# This file is automatically generated by Racc 1.
|
3
|
+
# This file is automatically generated by Racc 1.6.0
|
4
4
|
# from Racc grammar file "".
|
5
5
|
#
|
6
6
|
|
@@ -8,7 +8,7 @@ require 'racc/parser.rb'
|
|
8
8
|
module KDL
|
9
9
|
class Parser < Racc::Parser
|
10
10
|
|
11
|
-
module_eval(<<'...end kdl.yy/module_eval...', 'kdl.yy',
|
11
|
+
module_eval(<<'...end kdl.yy/module_eval...', 'kdl.yy', 70)
|
12
12
|
|
13
13
|
def parse(str, options = {})
|
14
14
|
if options.fetch(:parse_types, true)
|
@@ -29,92 +29,96 @@ module_eval(<<'...end kdl.yy/module_eval...', 'kdl.yy', 69)
|
|
29
29
|
##### State transition tables begin ###
|
30
30
|
|
31
31
|
racc_action_table = [
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
32
|
+
-49, 9, 18, 19, 20, 18, 19, 20, 5, 6,
|
33
|
+
24, -49, 60, -49, 17, 64, 7, 17, -49, 16,
|
34
|
+
63, 18, 49, 50, 54, 55, 58, 59, 57, 39,
|
35
|
+
39, 39, 63, 17, 18, 19, 20, 66, 45, 36,
|
36
|
+
36, 36, 5, 6, 39, -29, 17, 18, 19, 20,
|
37
|
+
7, 16, -30, 68, 36, 5, 6, 74, 78, 17,
|
38
|
+
18, 19, 20, 7, 16, nil, 35, 6, 18, 19,
|
39
|
+
20, 79, 17, 34, 7, 31, 36, 16, 18, 49,
|
40
|
+
50, 54, 55, 58, 59, 57, nil, nil, 60, 39,
|
41
|
+
17, 70, 71, 54, 55, 58, 59, 57, 31, 36,
|
42
|
+
5, 6, 17, 5, 6, 5, 6, 34, 7, nil,
|
43
|
+
34, 7, nil, 7, 5, 6, 5, 6, 5, 6,
|
44
|
+
nil, nil, 7, nil, 7, nil, 7, 70, 71, 54,
|
45
|
+
55, 58, 59, 57, 18, 19, 20 ]
|
45
46
|
|
46
47
|
racc_action_check = [
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
48
|
+
35, 1, 2, 2, 2, 38, 38, 38, 0, 0,
|
49
|
+
9, 35, 30, 35, 2, 36, 0, 38, 35, 2,
|
50
|
+
35, 29, 29, 29, 29, 29, 29, 29, 29, 29,
|
51
|
+
16, 31, 39, 29, 3, 3, 3, 41, 29, 29,
|
52
|
+
16, 31, 3, 3, 45, 49, 3, 72, 72, 72,
|
53
|
+
3, 3, 50, 51, 45, 72, 72, 63, 72, 72,
|
54
|
+
73, 73, 73, 72, 72, nil, 14, 14, 13, 13,
|
55
|
+
13, 73, 73, 14, 14, 14, 14, 73, 67, 67,
|
56
|
+
67, 67, 67, 67, 67, 67, nil, nil, 67, 47,
|
57
|
+
67, 68, 68, 68, 68, 68, 68, 68, 47, 47,
|
58
|
+
27, 27, 68, 28, 28, 32, 32, 27, 27, nil,
|
59
|
+
28, 28, nil, 32, 34, 34, 60, 60, 62, 62,
|
60
|
+
nil, nil, 34, nil, 60, nil, 62, 53, 53, 53,
|
61
|
+
53, 53, 53, 53, 17, 17, 17 ]
|
60
62
|
|
61
63
|
racc_action_pointer = [
|
62
|
-
-2, 1, 0,
|
63
|
-
|
64
|
-
nil, nil, nil, nil, nil, nil, nil,
|
65
|
-
|
66
|
-
nil, nil, nil,
|
67
|
-
nil,
|
68
|
-
|
69
|
-
|
64
|
+
-2, 1, 0, 32, nil, nil, nil, nil, nil, 10,
|
65
|
+
nil, nil, nil, 66, 56, nil, 20, 132, nil, nil,
|
66
|
+
nil, nil, nil, nil, nil, nil, nil, 90, 93, 19,
|
67
|
+
0, 21, 95, nil, 104, 0, 5, nil, 3, 12,
|
68
|
+
nil, 22, nil, nil, nil, 34, nil, 79, nil, 29,
|
69
|
+
36, 37, nil, 124, nil, nil, nil, nil, nil, nil,
|
70
|
+
106, nil, 108, 47, nil, nil, nil, 76, 88, nil,
|
71
|
+
nil, nil, 45, 58, nil, nil, nil, nil, nil, nil ]
|
70
72
|
|
71
73
|
racc_action_default = [
|
72
|
-
-
|
73
|
-
|
74
|
-
-
|
75
|
-
-
|
76
|
-
-11, -12, -14, -
|
77
|
-
-32, -
|
78
|
-
-
|
79
|
-
-
|
74
|
+
-54, -55, -1, -2, -3, -49, -50, -51, -52, -55,
|
75
|
+
-6, -7, -8, -55, -54, -13, -54, -55, -28, -29,
|
76
|
+
-30, -4, -5, -53, 80, -9, -10, -55, -55, -48,
|
77
|
+
-55, -54, -23, -24, -25, -42, -43, -47, -55, -42,
|
78
|
+
-48, -55, -11, -12, -14, -54, -16, -55, -22, -34,
|
79
|
+
-35, -55, -32, -55, -36, -37, -38, -39, -40, -41,
|
80
|
+
-54, -21, -26, -44, -45, -18, -27, -55, -55, -33,
|
81
|
+
-34, -35, -55, -55, -46, -15, -17, -31, -20, -19 ]
|
80
82
|
|
81
83
|
racc_goto_table = [
|
82
|
-
22, 23,
|
83
|
-
|
84
|
-
nil, nil, nil,
|
85
|
-
|
86
|
-
|
87
|
-
nil,
|
88
|
-
nil,
|
84
|
+
21, 22, 23, 2, 3, 4, 41, 53, 29, 44,
|
85
|
+
38, 46, 26, 1, 25, 27, 28, 69, 51, nil,
|
86
|
+
nil, nil, nil, 47, nil, 42, 43, nil, nil, nil,
|
87
|
+
nil, 23, nil, nil, nil, 65, nil, nil, 62, 67,
|
88
|
+
nil, 47, nil, nil, nil, 53, 53, 75, 77, 76,
|
89
|
+
nil, nil, nil, nil, nil, nil, 51, nil, nil, nil,
|
90
|
+
nil, 23, nil, 73, 72, 4, nil, nil, nil, 21,
|
91
|
+
22, 23 ]
|
89
92
|
|
90
93
|
racc_goto_check = [
|
91
|
-
|
92
|
-
16, 17,
|
93
|
-
nil, nil, nil,
|
94
|
-
21, nil, nil,
|
95
|
-
|
96
|
-
nil,
|
97
|
-
nil, 2, 3, 4,
|
94
|
+
5, 6, 21, 2, 3, 4, 13, 8, 14, 15,
|
95
|
+
16, 17, 10, 1, 7, 11, 12, 19, 13, nil,
|
96
|
+
nil, nil, nil, 14, nil, 10, 10, nil, nil, nil,
|
97
|
+
nil, 21, nil, nil, nil, 5, nil, nil, 3, 16,
|
98
|
+
nil, 14, nil, nil, nil, 8, 8, 15, 15, 17,
|
99
|
+
nil, nil, nil, nil, nil, nil, 13, nil, nil, nil,
|
100
|
+
nil, 21, nil, 2, 3, 4, nil, nil, nil, 5,
|
101
|
+
6, 21 ]
|
98
102
|
|
99
103
|
racc_goto_pointer = [
|
100
|
-
nil, 13, 3, 4, 5,
|
101
|
-
|
102
|
-
nil, -
|
104
|
+
nil, 13, 3, 4, 5, -3, -2, 1, -22, nil,
|
105
|
+
-2, 1, 2, -11, -6, -20, -6, -18, nil, -36,
|
106
|
+
nil, -1 ]
|
103
107
|
|
104
108
|
racc_goto_default = [
|
105
|
-
nil, nil, nil,
|
106
|
-
|
107
|
-
|
109
|
+
nil, nil, nil, 32, 37, 10, 11, 12, 13, 14,
|
110
|
+
nil, 61, 48, 15, 40, nil, 30, nil, 33, 52,
|
111
|
+
56, 8 ]
|
108
112
|
|
109
113
|
racc_reduce_table = [
|
110
114
|
0, 0, :racc_error,
|
111
|
-
1,
|
112
|
-
1,
|
113
|
-
1,
|
114
|
-
2,
|
115
|
-
2,
|
116
|
-
2,
|
117
|
-
2,
|
115
|
+
1, 22, :_reduce_1,
|
116
|
+
1, 22, :_reduce_2,
|
117
|
+
1, 23, :_reduce_3,
|
118
|
+
2, 23, :_reduce_4,
|
119
|
+
2, 23, :_reduce_5,
|
120
|
+
2, 23, :_reduce_6,
|
121
|
+
2, 23, :_reduce_7,
|
118
122
|
1, 26, :_reduce_8,
|
119
123
|
2, 26, :_reduce_9,
|
120
124
|
2, 28, :_reduce_10,
|
@@ -132,37 +136,40 @@ racc_reduce_table = [
|
|
132
136
|
2, 33, :_reduce_none,
|
133
137
|
1, 31, :_reduce_none,
|
134
138
|
1, 31, :_reduce_none,
|
135
|
-
1,
|
136
|
-
2,
|
139
|
+
1, 39, :_reduce_none,
|
140
|
+
2, 39, :_reduce_none,
|
137
141
|
3, 29, :_reduce_27,
|
138
142
|
1, 34, :_reduce_28,
|
139
143
|
1, 34, :_reduce_29,
|
140
144
|
1, 34, :_reduce_30,
|
141
|
-
3,
|
142
|
-
1, 35, :_reduce_none,
|
143
|
-
2, 35, :_reduce_33,
|
144
|
-
1, 39, :_reduce_34,
|
145
|
-
1, 39, :_reduce_35,
|
146
|
-
1, 39, :_reduce_36,
|
147
|
-
1, 39, :_reduce_37,
|
148
|
-
1, 39, :_reduce_38,
|
149
|
-
1, 39, :_reduce_39,
|
150
|
-
1, 40, :_reduce_40,
|
151
|
-
1, 40, :_reduce_41,
|
152
|
-
1, 36, :_reduce_none,
|
145
|
+
3, 38, :_reduce_31,
|
153
146
|
1, 36, :_reduce_none,
|
154
|
-
|
155
|
-
1,
|
156
|
-
1,
|
157
|
-
1,
|
158
|
-
|
159
|
-
1,
|
160
|
-
1,
|
161
|
-
|
162
|
-
|
163
|
-
|
164
|
-
|
165
|
-
|
147
|
+
2, 36, :_reduce_33,
|
148
|
+
1, 40, :_reduce_34,
|
149
|
+
1, 40, :_reduce_35,
|
150
|
+
1, 40, :_reduce_36,
|
151
|
+
1, 40, :_reduce_37,
|
152
|
+
1, 40, :_reduce_38,
|
153
|
+
1, 40, :_reduce_39,
|
154
|
+
1, 41, :_reduce_40,
|
155
|
+
1, 41, :_reduce_41,
|
156
|
+
1, 35, :_reduce_none,
|
157
|
+
1, 35, :_reduce_none,
|
158
|
+
2, 35, :_reduce_none,
|
159
|
+
2, 35, :_reduce_none,
|
160
|
+
3, 35, :_reduce_none,
|
161
|
+
1, 37, :_reduce_none,
|
162
|
+
1, 37, :_reduce_none,
|
163
|
+
1, 42, :_reduce_none,
|
164
|
+
1, 42, :_reduce_none,
|
165
|
+
1, 42, :_reduce_none,
|
166
|
+
1, 24, :_reduce_none,
|
167
|
+
2, 24, :_reduce_none,
|
168
|
+
0, 25, :_reduce_54 ]
|
169
|
+
|
170
|
+
racc_reduce_n = 55
|
171
|
+
|
172
|
+
racc_shift_n = 80
|
166
173
|
|
167
174
|
racc_token_table = {
|
168
175
|
false => 0,
|
@@ -184,9 +191,10 @@ racc_token_table = {
|
|
184
191
|
:EQUALS => 16,
|
185
192
|
:SEMICOLON => 17,
|
186
193
|
:EOF => 18,
|
187
|
-
:SLASHDASH => 19
|
194
|
+
:SLASHDASH => 19,
|
195
|
+
:ESCLINE => 20 }
|
188
196
|
|
189
|
-
racc_nt_base =
|
197
|
+
racc_nt_base = 21
|
190
198
|
|
191
199
|
racc_use_result_var = false
|
192
200
|
|
@@ -227,12 +235,12 @@ Racc_token_to_s_table = [
|
|
227
235
|
"SEMICOLON",
|
228
236
|
"EOF",
|
229
237
|
"SLASHDASH",
|
238
|
+
"ESCLINE",
|
230
239
|
"$start",
|
231
240
|
"document",
|
232
241
|
"nodes",
|
233
242
|
"linespaces",
|
234
243
|
"none",
|
235
|
-
"linespace_star",
|
236
244
|
"node",
|
237
245
|
"empty_node",
|
238
246
|
"untyped_node",
|
@@ -242,6 +250,7 @@ Racc_token_to_s_table = [
|
|
242
250
|
"node_children",
|
243
251
|
"empty_children",
|
244
252
|
"identifier",
|
253
|
+
"ws",
|
245
254
|
"value",
|
246
255
|
"ws_star",
|
247
256
|
"property",
|
@@ -256,103 +265,103 @@ Racc_debug_parser = false
|
|
256
265
|
|
257
266
|
# reduce 0 omitted
|
258
267
|
|
259
|
-
module_eval(<<'.,.,', 'kdl.yy',
|
268
|
+
module_eval(<<'.,.,', 'kdl.yy', 14)
|
260
269
|
def _reduce_1(val, _values)
|
261
270
|
KDL::Document.new(val[0])
|
262
271
|
end
|
263
272
|
.,.,
|
264
273
|
|
265
|
-
module_eval(<<'.,.,', 'kdl.yy',
|
274
|
+
module_eval(<<'.,.,', 'kdl.yy', 15)
|
266
275
|
def _reduce_2(val, _values)
|
267
276
|
KDL::Document.new([])
|
268
277
|
end
|
269
278
|
.,.,
|
270
279
|
|
271
|
-
module_eval(<<'.,.,', 'kdl.yy',
|
280
|
+
module_eval(<<'.,.,', 'kdl.yy', 17)
|
272
281
|
def _reduce_3(val, _values)
|
273
282
|
[]
|
274
283
|
end
|
275
284
|
.,.,
|
276
285
|
|
277
|
-
module_eval(<<'.,.,', 'kdl.yy',
|
286
|
+
module_eval(<<'.,.,', 'kdl.yy', 18)
|
278
287
|
def _reduce_4(val, _values)
|
279
288
|
[val[1]]
|
280
289
|
end
|
281
290
|
.,.,
|
282
291
|
|
283
|
-
module_eval(<<'.,.,', 'kdl.yy',
|
292
|
+
module_eval(<<'.,.,', 'kdl.yy', 19)
|
284
293
|
def _reduce_5(val, _values)
|
285
294
|
[]
|
286
295
|
end
|
287
296
|
.,.,
|
288
297
|
|
289
|
-
module_eval(<<'.,.,', 'kdl.yy',
|
298
|
+
module_eval(<<'.,.,', 'kdl.yy', 20)
|
290
299
|
def _reduce_6(val, _values)
|
291
300
|
[*val[0], val[1]]
|
292
301
|
end
|
293
302
|
.,.,
|
294
303
|
|
295
|
-
module_eval(<<'.,.,', 'kdl.yy',
|
304
|
+
module_eval(<<'.,.,', 'kdl.yy', 21)
|
296
305
|
def _reduce_7(val, _values)
|
297
306
|
val[0]
|
298
307
|
end
|
299
308
|
.,.,
|
300
309
|
|
301
|
-
module_eval(<<'.,.,', 'kdl.yy',
|
310
|
+
module_eval(<<'.,.,', 'kdl.yy', 22)
|
302
311
|
def _reduce_8(val, _values)
|
303
312
|
val[0]
|
304
313
|
end
|
305
314
|
.,.,
|
306
315
|
|
307
|
-
module_eval(<<'.,.,', 'kdl.yy',
|
316
|
+
module_eval(<<'.,.,', 'kdl.yy', 23)
|
308
317
|
def _reduce_9(val, _values)
|
309
318
|
val[1].as_type(val[0], @type_parsers.fetch(val[0], nil))
|
310
319
|
end
|
311
320
|
.,.,
|
312
321
|
|
313
|
-
module_eval(<<'.,.,', 'kdl.yy',
|
322
|
+
module_eval(<<'.,.,', 'kdl.yy', 24)
|
314
323
|
def _reduce_10(val, _values)
|
315
|
-
val[0].tap { |x| x.children =
|
324
|
+
val[0].tap { |x| x.children = [] }
|
316
325
|
end
|
317
326
|
.,.,
|
318
327
|
|
319
|
-
module_eval(<<'.,.,', 'kdl.yy',
|
328
|
+
module_eval(<<'.,.,', 'kdl.yy', 25)
|
320
329
|
def _reduce_11(val, _values)
|
321
330
|
val[0].tap { |x| x.children = val[1] }
|
322
331
|
end
|
323
332
|
.,.,
|
324
333
|
|
325
|
-
module_eval(<<'.,.,', 'kdl.yy',
|
334
|
+
module_eval(<<'.,.,', 'kdl.yy', 26)
|
326
335
|
def _reduce_12(val, _values)
|
327
|
-
val[0].tap { |x| x.children =
|
336
|
+
val[0].tap { |x| x.children = [] }
|
328
337
|
end
|
329
338
|
.,.,
|
330
339
|
|
331
|
-
module_eval(<<'.,.,', 'kdl.yy',
|
340
|
+
module_eval(<<'.,.,', 'kdl.yy', 27)
|
332
341
|
def _reduce_13(val, _values)
|
333
342
|
KDL::Node.new(val[0])
|
334
343
|
end
|
335
344
|
.,.,
|
336
345
|
|
337
|
-
module_eval(<<'.,.,', 'kdl.yy',
|
346
|
+
module_eval(<<'.,.,', 'kdl.yy', 28)
|
338
347
|
def _reduce_14(val, _values)
|
339
348
|
val[0].tap { |x| x.arguments << val[2] }
|
340
349
|
end
|
341
350
|
.,.,
|
342
351
|
|
343
|
-
module_eval(<<'.,.,', 'kdl.yy',
|
352
|
+
module_eval(<<'.,.,', 'kdl.yy', 29)
|
344
353
|
def _reduce_15(val, _values)
|
345
354
|
val[0]
|
346
355
|
end
|
347
356
|
.,.,
|
348
357
|
|
349
|
-
module_eval(<<'.,.,', 'kdl.yy',
|
358
|
+
module_eval(<<'.,.,', 'kdl.yy', 30)
|
350
359
|
def _reduce_16(val, _values)
|
351
360
|
val[0].tap { |x| x.properties[val[2][0]] = val[2][1] }
|
352
361
|
end
|
353
362
|
.,.,
|
354
363
|
|
355
|
-
module_eval(<<'.,.,', 'kdl.yy',
|
364
|
+
module_eval(<<'.,.,', 'kdl.yy', 31)
|
356
365
|
def _reduce_17(val, _values)
|
357
366
|
val[0]
|
358
367
|
end
|
@@ -360,13 +369,13 @@ module_eval(<<'.,.,', 'kdl.yy', 30)
|
|
360
369
|
|
361
370
|
# reduce 18 omitted
|
362
371
|
|
363
|
-
module_eval(<<'.,.,', 'kdl.yy',
|
372
|
+
module_eval(<<'.,.,', 'kdl.yy', 33)
|
364
373
|
def _reduce_19(val, _values)
|
365
374
|
val[2]
|
366
375
|
end
|
367
376
|
.,.,
|
368
377
|
|
369
|
-
module_eval(<<'.,.,', 'kdl.yy',
|
378
|
+
module_eval(<<'.,.,', 'kdl.yy', 34)
|
370
379
|
def _reduce_20(val, _values)
|
371
380
|
[]
|
372
381
|
end
|
@@ -384,31 +393,31 @@ module_eval(<<'.,.,', 'kdl.yy', 33)
|
|
384
393
|
|
385
394
|
# reduce 26 omitted
|
386
395
|
|
387
|
-
module_eval(<<'.,.,', 'kdl.yy',
|
396
|
+
module_eval(<<'.,.,', 'kdl.yy', 40)
|
388
397
|
def _reduce_27(val, _values)
|
389
398
|
val[1]
|
390
399
|
end
|
391
400
|
.,.,
|
392
401
|
|
393
|
-
module_eval(<<'.,.,', 'kdl.yy',
|
402
|
+
module_eval(<<'.,.,', 'kdl.yy', 42)
|
394
403
|
def _reduce_28(val, _values)
|
395
404
|
val[0].value
|
396
405
|
end
|
397
406
|
.,.,
|
398
407
|
|
399
|
-
module_eval(<<'.,.,', 'kdl.yy',
|
408
|
+
module_eval(<<'.,.,', 'kdl.yy', 43)
|
400
409
|
def _reduce_29(val, _values)
|
401
410
|
val[0].value
|
402
411
|
end
|
403
412
|
.,.,
|
404
413
|
|
405
|
-
module_eval(<<'.,.,', 'kdl.yy',
|
414
|
+
module_eval(<<'.,.,', 'kdl.yy', 44)
|
406
415
|
def _reduce_30(val, _values)
|
407
416
|
val[0].value
|
408
417
|
end
|
409
418
|
.,.,
|
410
419
|
|
411
|
-
module_eval(<<'.,.,', 'kdl.yy',
|
420
|
+
module_eval(<<'.,.,', 'kdl.yy', 46)
|
412
421
|
def _reduce_31(val, _values)
|
413
422
|
[val[0], val[2]]
|
414
423
|
end
|
@@ -416,55 +425,55 @@ module_eval(<<'.,.,', 'kdl.yy', 45)
|
|
416
425
|
|
417
426
|
# reduce 32 omitted
|
418
427
|
|
419
|
-
module_eval(<<'.,.,', 'kdl.yy',
|
428
|
+
module_eval(<<'.,.,', 'kdl.yy', 49)
|
420
429
|
def _reduce_33(val, _values)
|
421
430
|
val[1].as_type(val[0], @type_parsers.fetch(val[0], nil))
|
422
431
|
end
|
423
432
|
.,.,
|
424
433
|
|
425
|
-
module_eval(<<'.,.,', 'kdl.yy',
|
434
|
+
module_eval(<<'.,.,', 'kdl.yy', 51)
|
426
435
|
def _reduce_34(val, _values)
|
427
436
|
KDL::Value::String.new(val[0].value)
|
428
437
|
end
|
429
438
|
.,.,
|
430
439
|
|
431
|
-
module_eval(<<'.,.,', 'kdl.yy',
|
440
|
+
module_eval(<<'.,.,', 'kdl.yy', 52)
|
432
441
|
def _reduce_35(val, _values)
|
433
442
|
KDL::Value::String.new(val[0].value)
|
434
443
|
end
|
435
444
|
.,.,
|
436
445
|
|
437
|
-
module_eval(<<'.,.,', 'kdl.yy',
|
446
|
+
module_eval(<<'.,.,', 'kdl.yy', 53)
|
438
447
|
def _reduce_36(val, _values)
|
439
448
|
KDL::Value::Int.new(val[0].value)
|
440
449
|
end
|
441
450
|
.,.,
|
442
451
|
|
443
|
-
module_eval(<<'.,.,', 'kdl.yy',
|
452
|
+
module_eval(<<'.,.,', 'kdl.yy', 54)
|
444
453
|
def _reduce_37(val, _values)
|
445
454
|
KDL::Value::Float.new(val[0].value, format: val[0].meta[:format])
|
446
455
|
end
|
447
456
|
.,.,
|
448
457
|
|
449
|
-
module_eval(<<'.,.,', 'kdl.yy',
|
458
|
+
module_eval(<<'.,.,', 'kdl.yy', 55)
|
450
459
|
def _reduce_38(val, _values)
|
451
460
|
KDL::Value::Boolean.new(val[0])
|
452
461
|
end
|
453
462
|
.,.,
|
454
463
|
|
455
|
-
module_eval(<<'.,.,', 'kdl.yy',
|
464
|
+
module_eval(<<'.,.,', 'kdl.yy', 56)
|
456
465
|
def _reduce_39(val, _values)
|
457
466
|
KDL::Value::Null
|
458
467
|
end
|
459
468
|
.,.,
|
460
469
|
|
461
|
-
module_eval(<<'.,.,', 'kdl.yy',
|
470
|
+
module_eval(<<'.,.,', 'kdl.yy', 58)
|
462
471
|
def _reduce_40(val, _values)
|
463
472
|
true
|
464
473
|
end
|
465
474
|
.,.,
|
466
475
|
|
467
|
-
module_eval(<<'.,.,', 'kdl.yy',
|
476
|
+
module_eval(<<'.,.,', 'kdl.yy', 59)
|
468
477
|
def _reduce_41(val, _values)
|
469
478
|
false
|
470
479
|
end
|
@@ -488,8 +497,14 @@ module_eval(<<'.,.,', 'kdl.yy', 58)
|
|
488
497
|
|
489
498
|
# reduce 50 omitted
|
490
499
|
|
491
|
-
|
492
|
-
|
500
|
+
# reduce 51 omitted
|
501
|
+
|
502
|
+
# reduce 52 omitted
|
503
|
+
|
504
|
+
# reduce 53 omitted
|
505
|
+
|
506
|
+
module_eval(<<'.,.,', 'kdl.yy', 66)
|
507
|
+
def _reduce_54(val, _values)
|
493
508
|
nil
|
494
509
|
end
|
495
510
|
.,.,
|
data/lib/kdl/kdl.yy
CHANGED
@@ -10,30 +10,31 @@ class KDL::Parser
|
|
10
10
|
SEMICOLON
|
11
11
|
EOF
|
12
12
|
SLASHDASH
|
13
|
+
ESCLINE
|
13
14
|
rule
|
14
15
|
document : nodes { KDL::Document.new(val[0]) }
|
15
16
|
| linespaces { KDL::Document.new([])}
|
16
17
|
|
17
18
|
nodes : none { [] }
|
18
|
-
|
|
19
|
-
|
|
19
|
+
| linespaces node { [val[1]] }
|
20
|
+
| linespaces empty_node { [] }
|
20
21
|
| nodes node { [*val[0], val[1]] }
|
21
22
|
| nodes empty_node { val[0] }
|
22
23
|
node : untyped_node { val[0] }
|
23
24
|
| type untyped_node { val[1].as_type(val[0], @type_parsers.fetch(val[0], nil)) }
|
24
|
-
untyped_node : node_decl node_term { val[0].tap { |x| x.children =
|
25
|
+
untyped_node : node_decl node_term { val[0].tap { |x| x.children = [] } }
|
25
26
|
| node_decl node_children node_term { val[0].tap { |x| x.children = val[1] } }
|
26
|
-
| node_decl empty_children node_term { val[0].tap { |x| x.children =
|
27
|
+
| node_decl empty_children node_term { val[0].tap { |x| x.children = [] } }
|
27
28
|
node_decl : identifier { KDL::Node.new(val[0]) }
|
28
|
-
| node_decl
|
29
|
-
| node_decl
|
30
|
-
| node_decl
|
31
|
-
| node_decl
|
29
|
+
| node_decl ws value { val[0].tap { |x| x.arguments << val[2] } }
|
30
|
+
| node_decl ws SLASHDASH ws_star value { val[0] }
|
31
|
+
| node_decl ws property { val[0].tap { |x| x.properties[val[2][0]] = val[2][1] } }
|
32
|
+
| node_decl ws SLASHDASH ws_star property { val[0] }
|
32
33
|
empty_node : SLASHDASH ws_star node
|
33
34
|
node_children : ws_star LBRACE nodes RBRACE { val[2] }
|
34
|
-
| ws_star LBRACE
|
35
|
+
| ws_star LBRACE linespaces RBRACE { [] }
|
35
36
|
empty_children: SLASHDASH node_children
|
36
|
-
|
|
37
|
+
| ws empty_children
|
37
38
|
node_term: linespaces | semicolon_term
|
38
39
|
semicolon_term: SEMICOLON | SEMICOLON linespaces
|
39
40
|
|
@@ -58,10 +59,10 @@ nodes : none { [] }
|
|
58
59
|
boolean : TRUE { true }
|
59
60
|
| FALSE { false }
|
60
61
|
|
61
|
-
|
62
|
+
ws: WS | ESCLINE | WS ESCLINE | ESCLINE WS | WS ESCLINE WS
|
63
|
+
ws_star: none | ws
|
62
64
|
linespace: WS | NEWLINE | EOF
|
63
65
|
linespaces: linespace | linespaces linespace
|
64
|
-
linespace_star: none | linespaces
|
65
66
|
|
66
67
|
none: { nil }
|
67
68
|
|
data/lib/kdl/node.rb
CHANGED
@@ -2,7 +2,7 @@ module KDL
|
|
2
2
|
class Node
|
3
3
|
attr_accessor :name, :arguments, :properties, :children, :type
|
4
4
|
|
5
|
-
def initialize(name, arguments = [], properties = {}, children =
|
5
|
+
def initialize(name, arguments = [], properties = {}, children = [], type: nil)
|
6
6
|
@name = name
|
7
7
|
@arguments = arguments
|
8
8
|
@properties = properties
|
@@ -19,11 +19,9 @@ module KDL
|
|
19
19
|
unless properties.empty?
|
20
20
|
s += " #{properties.map { |k, v| "#{id_to_s k}=#{v}" }.join(' ')}"
|
21
21
|
end
|
22
|
-
unless children.
|
22
|
+
unless children.empty?
|
23
23
|
s += " {\n"
|
24
|
-
|
25
|
-
s += children.map { |c| "#{c.to_s(level + 1)}\n" }.join("\n")
|
26
|
-
end
|
24
|
+
s += children.map { |c| "#{c.to_s(level + 1)}\n" }.join("\n")
|
27
25
|
s += "#{indent}}"
|
28
26
|
end
|
29
27
|
s
|
data/lib/kdl/tokenizer.rb
CHANGED
@@ -125,15 +125,13 @@ module KDL
|
|
125
125
|
end
|
126
126
|
when '\\'
|
127
127
|
t = Tokenizer.new(@str, @index + 1)
|
128
|
-
la = t.next_token
|
129
|
-
if la == :NEWLINE
|
130
|
-
@index = t.index
|
131
|
-
new_line
|
132
|
-
elsif la == :WS && (lan = t.next_token[0]) == :NEWLINE
|
128
|
+
la = t.next_token
|
129
|
+
if la[0] == :NEWLINE || la[0] == :EOF || (la[0] == :WS && (lan = t.next_token[0]) == :NEWLINE || lan == :EOF)
|
133
130
|
@index = t.index
|
134
131
|
new_line
|
132
|
+
return token(:ESCLINE, "\\#{la[1].value}")
|
135
133
|
else
|
136
|
-
raise_error "Unexpected '\\'"
|
134
|
+
raise_error "Unexpected '\\' (#{la[0]})"
|
137
135
|
end
|
138
136
|
when *SYMBOLS.keys
|
139
137
|
return token(SYMBOLS[c], c).tap { traverse(1) }
|
@@ -293,18 +291,6 @@ module KDL
|
|
293
291
|
if WHITEPACE.include?(c)
|
294
292
|
traverse(1)
|
295
293
|
@buffer += c
|
296
|
-
elsif c == "\\"
|
297
|
-
t = Tokenizer.new(@str, @index + 1)
|
298
|
-
la = t.next_token[0]
|
299
|
-
if la == :NEWLINE
|
300
|
-
@index = t.index
|
301
|
-
new_line
|
302
|
-
elsif (la == :WS && (lan = t.next_token[0]) == :NEWLINE)
|
303
|
-
@index = t.index
|
304
|
-
new_line
|
305
|
-
else
|
306
|
-
raise_error "Unexpected '\\'"
|
307
|
-
end
|
308
294
|
elsif c == "/" && @str[@index + 1] == '*'
|
309
295
|
self.context = :multi_line_comment
|
310
296
|
@comment_nesting = 1
|
@@ -358,7 +344,7 @@ module KDL
|
|
358
344
|
end
|
359
345
|
|
360
346
|
def parse_float(s)
|
361
|
-
match, _, fraction, exponent = *s.match(/^([-+]?[\d_]+)(?:\.(\
|
347
|
+
match, _, fraction, exponent = *s.match(/^([-+]?[\d_]+)(?:\.([\d_]+))?(?:[eE]([-+]?[\d_]+))?$/)
|
362
348
|
raise_error "Invalid floating point value #{s}" if match.nil?
|
363
349
|
|
364
350
|
s = munch_underscores(s)
|
data/lib/kdl/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: kdl
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Danielle Smith
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2021-12-
|
11
|
+
date: 2021-12-13 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: racc
|
@@ -54,6 +54,7 @@ files:
|
|
54
54
|
- README.md
|
55
55
|
- Rakefile
|
56
56
|
- bin/console
|
57
|
+
- bin/kdl
|
57
58
|
- bin/racc
|
58
59
|
- bin/rake
|
59
60
|
- bin/setup
|
@@ -111,7 +112,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
111
112
|
- !ruby/object:Gem::Version
|
112
113
|
version: '0'
|
113
114
|
requirements: []
|
114
|
-
rubygems_version: 3.2.
|
115
|
+
rubygems_version: 3.2.32
|
115
116
|
signing_key:
|
116
117
|
specification_version: 4
|
117
118
|
summary: KDL Document Language
|