edn-abnf 0.5.40 → 0.5.41
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 +4 -4
- data/edn-abnf.gemspec +1 -1
- data/lib/parser/edngrammar.rb +358 -779
- metadata +1 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 0fdf950deb0a96865e863046f39d4071d3856ce24fc476c1f96077457002b8d8
|
|
4
|
+
data.tar.gz: 3920f2ebfb1b4dacc025d86f8bcb6fc2ed3e59694ec174ba6c1f50ccd5650dc6
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 14148161150b25960f24543bb03c673632af5c8302a5773e15863b88ade9c3a9ef20e6db2ec67bbb3a58bada47c673d8f32d877df11bd0a79d9619ab43e42c1f
|
|
7
|
+
data.tar.gz: 2ad6f10909561f0a87e59c87efdbecedb1b6bbf14a559fa59c6154d9d45d550a91e2e36850457c415118d6de93b8968a9b3053e65ad1d25de368e60e54aee350
|
data/edn-abnf.gemspec
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Gem::Specification.new do |s|
|
|
2
2
|
s.name = "edn-abnf"
|
|
3
|
-
s.version = "0.5.
|
|
3
|
+
s.version = "0.5.41"
|
|
4
4
|
s.summary = "CBOR Extended Diagnostic Notation (EDN) implemented in ABNF"
|
|
5
5
|
s.description = %q{edn-abnf implements converters and miscellaneous tools for CBOR EDN's ABNF}
|
|
6
6
|
s.author = "Carsten Bormann"
|
data/lib/parser/edngrammar.rb
CHANGED
|
@@ -127,6 +127,23 @@ module EDNGRAMMAR
|
|
|
127
127
|
r0
|
|
128
128
|
end
|
|
129
129
|
|
|
130
|
+
module Item0
|
|
131
|
+
def spec
|
|
132
|
+
elements[1]
|
|
133
|
+
end
|
|
134
|
+
end
|
|
135
|
+
|
|
136
|
+
module Item1
|
|
137
|
+
def ast
|
|
138
|
+
val = elements[0].ast
|
|
139
|
+
if ei = spec.text_value[1..-1]
|
|
140
|
+
# warn "*** implementing encoding indicator #{ei.inspect} for #{elements[0].text_value}"
|
|
141
|
+
val = CBOR::Box.from_instance(val, {ei: ei})
|
|
142
|
+
end
|
|
143
|
+
val
|
|
144
|
+
end
|
|
145
|
+
end
|
|
146
|
+
|
|
130
147
|
def _nt_item
|
|
131
148
|
start_index = index
|
|
132
149
|
if node_cache[:item].has_key?(index)
|
|
@@ -154,25 +171,59 @@ module EDNGRAMMAR
|
|
|
154
171
|
r3 = SyntaxNode.new(input, (index-1)...index) if r3 == true
|
|
155
172
|
r0 = r3
|
|
156
173
|
else
|
|
157
|
-
|
|
174
|
+
i4, s4 = index, []
|
|
175
|
+
i5 = index
|
|
176
|
+
r6 = _nt_number
|
|
177
|
+
if r6
|
|
178
|
+
r6 = SyntaxNode.new(input, (index-1)...index) if r6 == true
|
|
179
|
+
r5 = r6
|
|
180
|
+
else
|
|
181
|
+
r7 = _nt_string
|
|
182
|
+
if r7
|
|
183
|
+
r7 = SyntaxNode.new(input, (index-1)...index) if r7 == true
|
|
184
|
+
r5 = r7
|
|
185
|
+
else
|
|
186
|
+
r8 = _nt_prefixed
|
|
187
|
+
if r8
|
|
188
|
+
r8 = SyntaxNode.new(input, (index-1)...index) if r8 == true
|
|
189
|
+
r5 = r8
|
|
190
|
+
else
|
|
191
|
+
@index = i5
|
|
192
|
+
r5 = nil
|
|
193
|
+
end
|
|
194
|
+
end
|
|
195
|
+
end
|
|
196
|
+
s4 << r5
|
|
197
|
+
if r5
|
|
198
|
+
r9 = _nt_spec
|
|
199
|
+
s4 << r9
|
|
200
|
+
end
|
|
201
|
+
if s4.last
|
|
202
|
+
r4 = instantiate_node(SyntaxNode,input, i4...index, s4)
|
|
203
|
+
r4.extend(Item0)
|
|
204
|
+
r4.extend(Item1)
|
|
205
|
+
else
|
|
206
|
+
@index = i4
|
|
207
|
+
r4 = nil
|
|
208
|
+
end
|
|
158
209
|
if r4
|
|
159
210
|
r4 = SyntaxNode.new(input, (index-1)...index) if r4 == true
|
|
160
211
|
r0 = r4
|
|
161
212
|
else
|
|
162
|
-
|
|
163
|
-
if
|
|
164
|
-
|
|
165
|
-
r0 =
|
|
213
|
+
r10 = _nt_simple
|
|
214
|
+
if r10
|
|
215
|
+
r10 = SyntaxNode.new(input, (index-1)...index) if r10 == true
|
|
216
|
+
r0 = r10
|
|
166
217
|
else
|
|
167
|
-
|
|
168
|
-
if
|
|
169
|
-
|
|
170
|
-
r0 =
|
|
218
|
+
r11 = _nt_ellipsis
|
|
219
|
+
if r11
|
|
220
|
+
r11 = SyntaxNode.new(input, (index-1)...index) if r11 == true
|
|
221
|
+
r0 = r11
|
|
171
222
|
else
|
|
172
|
-
|
|
173
|
-
if
|
|
174
|
-
|
|
175
|
-
r0 =
|
|
223
|
+
r12 = _nt_streamstring
|
|
224
|
+
if r12
|
|
225
|
+
r12 = SyntaxNode.new(input, (index-1)...index) if r12 == true
|
|
226
|
+
r0 = r12
|
|
176
227
|
else
|
|
177
228
|
@index = i0
|
|
178
229
|
r0 = nil
|
|
@@ -189,227 +240,56 @@ module EDNGRAMMAR
|
|
|
189
240
|
r0
|
|
190
241
|
end
|
|
191
242
|
|
|
192
|
-
|
|
193
|
-
def spec
|
|
194
|
-
elements[1]
|
|
195
|
-
end
|
|
196
|
-
end
|
|
197
|
-
|
|
198
|
-
module String11
|
|
199
|
-
def ast
|
|
200
|
-
val = elements[0].ast
|
|
201
|
-
if ei = spec.text_value[1..-1]
|
|
202
|
-
# warn "*** implementing encoding indicator #{ei.inspect} for #{elements[0].text_value}"
|
|
203
|
-
val = CBOR::Box.from_instance(val, {ei: ei})
|
|
204
|
-
end
|
|
205
|
-
val
|
|
206
|
-
end
|
|
207
|
-
end
|
|
208
|
-
|
|
209
|
-
def _nt_string1
|
|
210
|
-
start_index = index
|
|
211
|
-
if node_cache[:string1].has_key?(index)
|
|
212
|
-
cached = node_cache[:string1][index]
|
|
213
|
-
if cached
|
|
214
|
-
node_cache[:string1][index] = cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
|
|
215
|
-
@index = cached.interval.end
|
|
216
|
-
end
|
|
217
|
-
return cached
|
|
218
|
-
end
|
|
219
|
-
|
|
220
|
-
i0, s0 = index, []
|
|
221
|
-
i1 = index
|
|
222
|
-
r2 = _nt_tstr
|
|
223
|
-
if r2
|
|
224
|
-
r2 = SyntaxNode.new(input, (index-1)...index) if r2 == true
|
|
225
|
-
r1 = r2
|
|
226
|
-
else
|
|
227
|
-
r3 = _nt_bstr
|
|
228
|
-
if r3
|
|
229
|
-
r3 = SyntaxNode.new(input, (index-1)...index) if r3 == true
|
|
230
|
-
r1 = r3
|
|
231
|
-
else
|
|
232
|
-
@index = i1
|
|
233
|
-
r1 = nil
|
|
234
|
-
end
|
|
235
|
-
end
|
|
236
|
-
s0 << r1
|
|
237
|
-
if r1
|
|
238
|
-
r4 = _nt_spec
|
|
239
|
-
s0 << r4
|
|
240
|
-
end
|
|
241
|
-
if s0.last
|
|
242
|
-
r0 = instantiate_node(SyntaxNode,input, i0...index, s0)
|
|
243
|
-
r0.extend(String10)
|
|
244
|
-
r0.extend(String11)
|
|
245
|
-
else
|
|
246
|
-
@index = i0
|
|
247
|
-
r0 = nil
|
|
248
|
-
end
|
|
249
|
-
|
|
250
|
-
node_cache[:string1][start_index] = r0
|
|
251
|
-
|
|
252
|
-
r0
|
|
253
|
-
end
|
|
254
|
-
|
|
255
|
-
def _nt_string
|
|
243
|
+
def _nt_number
|
|
256
244
|
start_index = index
|
|
257
|
-
if node_cache[:
|
|
258
|
-
cached = node_cache[:
|
|
245
|
+
if node_cache[:number].has_key?(index)
|
|
246
|
+
cached = node_cache[:number][index]
|
|
259
247
|
if cached
|
|
260
|
-
node_cache[:
|
|
248
|
+
node_cache[:number][index] = cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
|
|
261
249
|
@index = cached.interval.end
|
|
262
250
|
end
|
|
263
251
|
return cached
|
|
264
252
|
end
|
|
265
253
|
|
|
266
254
|
i0 = index
|
|
267
|
-
r1 =
|
|
255
|
+
r1 = _nt_hexfloat
|
|
268
256
|
if r1
|
|
269
257
|
r1 = SyntaxNode.new(input, (index-1)...index) if r1 == true
|
|
270
258
|
r0 = r1
|
|
271
259
|
else
|
|
272
|
-
r2 =
|
|
260
|
+
r2 = _nt_hexint
|
|
273
261
|
if r2
|
|
274
262
|
r2 = SyntaxNode.new(input, (index-1)...index) if r2 == true
|
|
275
263
|
r0 = r2
|
|
276
264
|
else
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
node_cache[:string][start_index] = r0
|
|
283
|
-
|
|
284
|
-
r0
|
|
285
|
-
end
|
|
286
|
-
|
|
287
|
-
module Ellipsis0
|
|
288
|
-
def ast; CBOR::Tagged.new(888, nil) end
|
|
289
|
-
end
|
|
290
|
-
|
|
291
|
-
def _nt_ellipsis
|
|
292
|
-
start_index = index
|
|
293
|
-
if node_cache[:ellipsis].has_key?(index)
|
|
294
|
-
cached = node_cache[:ellipsis][index]
|
|
295
|
-
if cached
|
|
296
|
-
node_cache[:ellipsis][index] = cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
|
|
297
|
-
@index = cached.interval.end
|
|
298
|
-
end
|
|
299
|
-
return cached
|
|
300
|
-
end
|
|
301
|
-
|
|
302
|
-
s0, i0 = [], index
|
|
303
|
-
loop do
|
|
304
|
-
if (match_len = has_terminal?(".", false, index))
|
|
305
|
-
r1 = true
|
|
306
|
-
@index += match_len
|
|
307
|
-
else
|
|
308
|
-
terminal_parse_failure('"."')
|
|
309
|
-
r1 = nil
|
|
310
|
-
end
|
|
311
|
-
if r1
|
|
312
|
-
s0 << r1
|
|
313
|
-
else
|
|
314
|
-
break
|
|
315
|
-
end
|
|
316
|
-
end
|
|
317
|
-
if s0.size < 3
|
|
318
|
-
@index = i0
|
|
319
|
-
r0 = nil
|
|
320
|
-
else
|
|
321
|
-
r0 = instantiate_node(SyntaxNode,input, i0...index, s0)
|
|
322
|
-
r0.extend(Ellipsis0)
|
|
323
|
-
r0.extend(Ellipsis0)
|
|
324
|
-
end
|
|
325
|
-
|
|
326
|
-
node_cache[:ellipsis][start_index] = r0
|
|
327
|
-
|
|
328
|
-
r0
|
|
329
|
-
end
|
|
330
|
-
|
|
331
|
-
module Number0
|
|
332
|
-
def spec
|
|
333
|
-
elements[1]
|
|
334
|
-
end
|
|
335
|
-
end
|
|
336
|
-
|
|
337
|
-
module Number1
|
|
338
|
-
def ast
|
|
339
|
-
val = elements[0].ast
|
|
340
|
-
|
|
341
|
-
if ei = spec.text_value[1..-1]
|
|
342
|
-
# warn "*** implementing encoding indicator #{ei.inspect} for #{elements[0].text_value}"
|
|
343
|
-
val = CBOR::Box.from_instance(val, {ei: ei})
|
|
344
|
-
end
|
|
345
|
-
val
|
|
346
|
-
end
|
|
347
|
-
end
|
|
348
|
-
|
|
349
|
-
def _nt_number
|
|
350
|
-
start_index = index
|
|
351
|
-
if node_cache[:number].has_key?(index)
|
|
352
|
-
cached = node_cache[:number][index]
|
|
353
|
-
if cached
|
|
354
|
-
node_cache[:number][index] = cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
|
|
355
|
-
@index = cached.interval.end
|
|
356
|
-
end
|
|
357
|
-
return cached
|
|
358
|
-
end
|
|
359
|
-
|
|
360
|
-
i0, s0 = index, []
|
|
361
|
-
i1 = index
|
|
362
|
-
r2 = _nt_hexfloat
|
|
363
|
-
if r2
|
|
364
|
-
r2 = SyntaxNode.new(input, (index-1)...index) if r2 == true
|
|
365
|
-
r1 = r2
|
|
366
|
-
else
|
|
367
|
-
r3 = _nt_hexint
|
|
368
|
-
if r3
|
|
369
|
-
r3 = SyntaxNode.new(input, (index-1)...index) if r3 == true
|
|
370
|
-
r1 = r3
|
|
371
|
-
else
|
|
372
|
-
r4 = _nt_octint
|
|
373
|
-
if r4
|
|
374
|
-
r4 = SyntaxNode.new(input, (index-1)...index) if r4 == true
|
|
375
|
-
r1 = r4
|
|
265
|
+
r3 = _nt_octint
|
|
266
|
+
if r3
|
|
267
|
+
r3 = SyntaxNode.new(input, (index-1)...index) if r3 == true
|
|
268
|
+
r0 = r3
|
|
376
269
|
else
|
|
377
|
-
|
|
378
|
-
if
|
|
379
|
-
|
|
380
|
-
|
|
270
|
+
r4 = _nt_binint
|
|
271
|
+
if r4
|
|
272
|
+
r4 = SyntaxNode.new(input, (index-1)...index) if r4 == true
|
|
273
|
+
r0 = r4
|
|
381
274
|
else
|
|
382
|
-
|
|
383
|
-
if
|
|
384
|
-
|
|
385
|
-
|
|
275
|
+
r5 = _nt_decnumber
|
|
276
|
+
if r5
|
|
277
|
+
r5 = SyntaxNode.new(input, (index-1)...index) if r5 == true
|
|
278
|
+
r0 = r5
|
|
386
279
|
else
|
|
387
|
-
|
|
388
|
-
if
|
|
389
|
-
|
|
390
|
-
|
|
280
|
+
r6 = _nt_nonfin
|
|
281
|
+
if r6
|
|
282
|
+
r6 = SyntaxNode.new(input, (index-1)...index) if r6 == true
|
|
283
|
+
r0 = r6
|
|
391
284
|
else
|
|
392
|
-
@index =
|
|
393
|
-
|
|
285
|
+
@index = i0
|
|
286
|
+
r0 = nil
|
|
394
287
|
end
|
|
395
288
|
end
|
|
396
289
|
end
|
|
397
290
|
end
|
|
398
291
|
end
|
|
399
292
|
end
|
|
400
|
-
s0 << r1
|
|
401
|
-
if r1
|
|
402
|
-
r8 = _nt_spec
|
|
403
|
-
s0 << r8
|
|
404
|
-
end
|
|
405
|
-
if s0.last
|
|
406
|
-
r0 = instantiate_node(SyntaxNode,input, i0...index, s0)
|
|
407
|
-
r0.extend(Number0)
|
|
408
|
-
r0.extend(Number1)
|
|
409
|
-
else
|
|
410
|
-
@index = i0
|
|
411
|
-
r0 = nil
|
|
412
|
-
end
|
|
413
293
|
|
|
414
294
|
node_cache[:number][start_index] = r0
|
|
415
295
|
|
|
@@ -1166,36 +1046,124 @@ module EDNGRAMMAR
|
|
|
1166
1046
|
r0
|
|
1167
1047
|
end
|
|
1168
1048
|
|
|
1169
|
-
|
|
1170
|
-
|
|
1171
|
-
|
|
1172
|
-
|
|
1173
|
-
|
|
1174
|
-
|
|
1175
|
-
|
|
1176
|
-
|
|
1177
|
-
|
|
1178
|
-
def ast; nil end
|
|
1179
|
-
end
|
|
1180
|
-
|
|
1181
|
-
module Simple3
|
|
1182
|
-
def ast; CBOR::Simple.new(23) end
|
|
1183
|
-
end
|
|
1184
|
-
|
|
1185
|
-
module Simple4
|
|
1186
|
-
def S1
|
|
1187
|
-
elements[1]
|
|
1188
|
-
end
|
|
1189
|
-
|
|
1190
|
-
def simple_number
|
|
1191
|
-
elements[2]
|
|
1192
|
-
end
|
|
1193
|
-
|
|
1194
|
-
def S2
|
|
1195
|
-
elements[3]
|
|
1049
|
+
def _nt_string
|
|
1050
|
+
start_index = index
|
|
1051
|
+
if node_cache[:string].has_key?(index)
|
|
1052
|
+
cached = node_cache[:string][index]
|
|
1053
|
+
if cached
|
|
1054
|
+
node_cache[:string][index] = cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
|
|
1055
|
+
@index = cached.interval.end
|
|
1056
|
+
end
|
|
1057
|
+
return cached
|
|
1196
1058
|
end
|
|
1197
1059
|
|
|
1198
|
-
|
|
1060
|
+
i0 = index
|
|
1061
|
+
r1 = _nt_dqstr
|
|
1062
|
+
if r1
|
|
1063
|
+
r1 = SyntaxNode.new(input, (index-1)...index) if r1 == true
|
|
1064
|
+
r0 = r1
|
|
1065
|
+
else
|
|
1066
|
+
r2 = _nt_rawstring
|
|
1067
|
+
if r2
|
|
1068
|
+
r2 = SyntaxNode.new(input, (index-1)...index) if r2 == true
|
|
1069
|
+
r0 = r2
|
|
1070
|
+
else
|
|
1071
|
+
r3 = _nt_sqstr
|
|
1072
|
+
if r3
|
|
1073
|
+
r3 = SyntaxNode.new(input, (index-1)...index) if r3 == true
|
|
1074
|
+
r0 = r3
|
|
1075
|
+
else
|
|
1076
|
+
r4 = _nt_embedded
|
|
1077
|
+
if r4
|
|
1078
|
+
r4 = SyntaxNode.new(input, (index-1)...index) if r4 == true
|
|
1079
|
+
r0 = r4
|
|
1080
|
+
else
|
|
1081
|
+
@index = i0
|
|
1082
|
+
r0 = nil
|
|
1083
|
+
end
|
|
1084
|
+
end
|
|
1085
|
+
end
|
|
1086
|
+
end
|
|
1087
|
+
|
|
1088
|
+
node_cache[:string][start_index] = r0
|
|
1089
|
+
|
|
1090
|
+
r0
|
|
1091
|
+
end
|
|
1092
|
+
|
|
1093
|
+
module Ellipsis0
|
|
1094
|
+
def ast; CBOR::Tagged.new(888, nil) end
|
|
1095
|
+
end
|
|
1096
|
+
|
|
1097
|
+
def _nt_ellipsis
|
|
1098
|
+
start_index = index
|
|
1099
|
+
if node_cache[:ellipsis].has_key?(index)
|
|
1100
|
+
cached = node_cache[:ellipsis][index]
|
|
1101
|
+
if cached
|
|
1102
|
+
node_cache[:ellipsis][index] = cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
|
|
1103
|
+
@index = cached.interval.end
|
|
1104
|
+
end
|
|
1105
|
+
return cached
|
|
1106
|
+
end
|
|
1107
|
+
|
|
1108
|
+
s0, i0 = [], index
|
|
1109
|
+
loop do
|
|
1110
|
+
if (match_len = has_terminal?(".", false, index))
|
|
1111
|
+
r1 = true
|
|
1112
|
+
@index += match_len
|
|
1113
|
+
else
|
|
1114
|
+
terminal_parse_failure('"."')
|
|
1115
|
+
r1 = nil
|
|
1116
|
+
end
|
|
1117
|
+
if r1
|
|
1118
|
+
s0 << r1
|
|
1119
|
+
else
|
|
1120
|
+
break
|
|
1121
|
+
end
|
|
1122
|
+
end
|
|
1123
|
+
if s0.size < 3
|
|
1124
|
+
@index = i0
|
|
1125
|
+
r0 = nil
|
|
1126
|
+
else
|
|
1127
|
+
r0 = instantiate_node(SyntaxNode,input, i0...index, s0)
|
|
1128
|
+
r0.extend(Ellipsis0)
|
|
1129
|
+
r0.extend(Ellipsis0)
|
|
1130
|
+
end
|
|
1131
|
+
|
|
1132
|
+
node_cache[:ellipsis][start_index] = r0
|
|
1133
|
+
|
|
1134
|
+
r0
|
|
1135
|
+
end
|
|
1136
|
+
|
|
1137
|
+
module Simple0
|
|
1138
|
+
def ast; false end
|
|
1139
|
+
end
|
|
1140
|
+
|
|
1141
|
+
module Simple1
|
|
1142
|
+
def ast; true end
|
|
1143
|
+
end
|
|
1144
|
+
|
|
1145
|
+
module Simple2
|
|
1146
|
+
def ast; nil end
|
|
1147
|
+
end
|
|
1148
|
+
|
|
1149
|
+
module Simple3
|
|
1150
|
+
def ast; CBOR::Simple.new(23) end
|
|
1151
|
+
end
|
|
1152
|
+
|
|
1153
|
+
module Simple4
|
|
1154
|
+
def S1
|
|
1155
|
+
elements[1]
|
|
1156
|
+
end
|
|
1157
|
+
|
|
1158
|
+
def simple_number
|
|
1159
|
+
elements[2]
|
|
1160
|
+
end
|
|
1161
|
+
|
|
1162
|
+
def S2
|
|
1163
|
+
elements[3]
|
|
1164
|
+
end
|
|
1165
|
+
|
|
1166
|
+
end
|
|
1199
1167
|
|
|
1200
1168
|
module Simple5
|
|
1201
1169
|
def ast; CBOR::Simple(simple_number.text_value.to_i) end
|
|
@@ -1768,26 +1736,26 @@ module EDNGRAMMAR
|
|
|
1768
1736
|
r0
|
|
1769
1737
|
end
|
|
1770
1738
|
|
|
1771
|
-
module
|
|
1739
|
+
module Prefix0
|
|
1772
1740
|
def lcalpha
|
|
1773
1741
|
elements[0]
|
|
1774
1742
|
end
|
|
1775
1743
|
|
|
1776
1744
|
end
|
|
1777
1745
|
|
|
1778
|
-
module
|
|
1746
|
+
module Prefix1
|
|
1779
1747
|
def ucalpha
|
|
1780
1748
|
elements[0]
|
|
1781
1749
|
end
|
|
1782
1750
|
|
|
1783
1751
|
end
|
|
1784
1752
|
|
|
1785
|
-
def
|
|
1753
|
+
def _nt_prefix
|
|
1786
1754
|
start_index = index
|
|
1787
|
-
if node_cache[:
|
|
1788
|
-
cached = node_cache[:
|
|
1755
|
+
if node_cache[:prefix].has_key?(index)
|
|
1756
|
+
cached = node_cache[:prefix][index]
|
|
1789
1757
|
if cached
|
|
1790
|
-
node_cache[:
|
|
1758
|
+
node_cache[:prefix][index] = cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
|
|
1791
1759
|
@index = cached.interval.end
|
|
1792
1760
|
end
|
|
1793
1761
|
return cached
|
|
@@ -1812,7 +1780,7 @@ module EDNGRAMMAR
|
|
|
1812
1780
|
end
|
|
1813
1781
|
if s1.last
|
|
1814
1782
|
r1 = instantiate_node(SyntaxNode,input, i1...index, s1)
|
|
1815
|
-
r1.extend(
|
|
1783
|
+
r1.extend(Prefix0)
|
|
1816
1784
|
else
|
|
1817
1785
|
@index = i1
|
|
1818
1786
|
r1 = nil
|
|
@@ -1839,7 +1807,7 @@ module EDNGRAMMAR
|
|
|
1839
1807
|
end
|
|
1840
1808
|
if s5.last
|
|
1841
1809
|
r5 = instantiate_node(SyntaxNode,input, i5...index, s5)
|
|
1842
|
-
r5.extend(
|
|
1810
|
+
r5.extend(Prefix1)
|
|
1843
1811
|
else
|
|
1844
1812
|
@index = i5
|
|
1845
1813
|
r5 = nil
|
|
@@ -1853,248 +1821,167 @@ module EDNGRAMMAR
|
|
|
1853
1821
|
end
|
|
1854
1822
|
end
|
|
1855
1823
|
|
|
1856
|
-
node_cache[:
|
|
1824
|
+
node_cache[:prefix][start_index] = r0
|
|
1857
1825
|
|
|
1858
1826
|
r0
|
|
1859
1827
|
end
|
|
1860
1828
|
|
|
1861
|
-
module
|
|
1862
|
-
def
|
|
1863
|
-
|
|
1864
|
-
|
|
1865
|
-
|
|
1866
|
-
|
|
1867
|
-
|
|
1829
|
+
module Prefixed0
|
|
1830
|
+
def ast1(pref)
|
|
1831
|
+
data = ast.force_encoding(Encoding::UTF_8) # XXX undo .b
|
|
1832
|
+
begin
|
|
1833
|
+
::EDNGRAMMAR::APPS[pref].decode(pref, data)
|
|
1834
|
+
rescue CBOR_DIAG::AppParseError => e
|
|
1835
|
+
app_parser_level1_diagnostics(e, elements[1])
|
|
1836
|
+
raise e
|
|
1837
|
+
end
|
|
1868
1838
|
end
|
|
1869
1839
|
end
|
|
1870
1840
|
|
|
1871
|
-
module
|
|
1872
|
-
|
|
1873
|
-
|
|
1874
|
-
|
|
1875
|
-
|
|
1876
|
-
|
|
1877
|
-
|
|
1878
|
-
|
|
1879
|
-
|
|
1880
|
-
rescue CBOR_DIAG::AppParseError => e
|
|
1881
|
-
app_parser_level1_diagnostics(e, elements[0].elements[1].elements[1])
|
|
1882
|
-
raise e
|
|
1883
|
-
end
|
|
1841
|
+
module Prefixed1
|
|
1842
|
+
def ast1(pref)
|
|
1843
|
+
data = ast.force_encoding(Encoding::UTF_8) # XXX undo .b
|
|
1844
|
+
begin
|
|
1845
|
+
::EDNGRAMMAR::APPS[pref].decode(pref, data)
|
|
1846
|
+
rescue CBOR_DIAG::AppParseError => e
|
|
1847
|
+
app_parser_level1_raw_diagnostics(e, elements[1])
|
|
1848
|
+
raise e
|
|
1849
|
+
end
|
|
1884
1850
|
end
|
|
1885
1851
|
end
|
|
1886
1852
|
|
|
1887
|
-
|
|
1888
|
-
|
|
1889
|
-
|
|
1890
|
-
|
|
1891
|
-
if cached
|
|
1892
|
-
node_cache[:app_string][index] = cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
|
|
1893
|
-
@index = cached.interval.end
|
|
1894
|
-
end
|
|
1895
|
-
return cached
|
|
1896
|
-
end
|
|
1897
|
-
|
|
1898
|
-
i0, s0 = index, []
|
|
1899
|
-
i1, s1 = index, []
|
|
1900
|
-
r2 = _nt_app_prefix
|
|
1901
|
-
s1 << r2
|
|
1902
|
-
if r2
|
|
1903
|
-
r3 = _nt_sqstr
|
|
1904
|
-
s1 << r3
|
|
1905
|
-
end
|
|
1906
|
-
if s1.last
|
|
1907
|
-
r1 = instantiate_node(SyntaxNode,input, i1...index, s1)
|
|
1908
|
-
r1.extend(AppString0)
|
|
1909
|
-
else
|
|
1910
|
-
@index = i1
|
|
1911
|
-
r1 = nil
|
|
1912
|
-
end
|
|
1913
|
-
s0 << r1
|
|
1914
|
-
if r1
|
|
1915
|
-
i4 = index
|
|
1916
|
-
r5 = lambda {|x| pref = x[0].app_prefix.text_value
|
|
1917
|
-
ret = !$options.integrated || !["h", "b64", "dt"].include?(pref)
|
|
1918
|
-
ret}.call(s0)
|
|
1919
|
-
if !r5
|
|
1920
|
-
terminal_parse_failure("<semantic predicate>")
|
|
1853
|
+
module Prefixed2
|
|
1854
|
+
def ast1(pref)
|
|
1855
|
+
args = seq.ast
|
|
1856
|
+
::EDNGRAMMAR::APPS[pref].decode(pref, args)
|
|
1921
1857
|
end
|
|
1922
|
-
if r5
|
|
1923
|
-
@index = i4
|
|
1924
|
-
r4 = instantiate_node(SyntaxNode,input, index...index)
|
|
1925
|
-
else
|
|
1926
|
-
@index = i4
|
|
1927
|
-
r4 = nil
|
|
1928
|
-
end
|
|
1929
|
-
s0 << r4
|
|
1930
|
-
end
|
|
1931
|
-
if s0.last
|
|
1932
|
-
r0 = instantiate_node(SyntaxNode,input, i0...index, s0)
|
|
1933
|
-
r0.extend(AppString1)
|
|
1934
|
-
r0.extend(AppString2)
|
|
1935
|
-
else
|
|
1936
|
-
@index = i0
|
|
1937
|
-
r0 = nil
|
|
1938
|
-
end
|
|
1939
|
-
|
|
1940
|
-
node_cache[:app_string][start_index] = r0
|
|
1941
|
-
|
|
1942
|
-
r0
|
|
1943
1858
|
end
|
|
1944
1859
|
|
|
1945
|
-
module
|
|
1946
|
-
def
|
|
1860
|
+
module Prefixed3
|
|
1861
|
+
def prefix
|
|
1947
1862
|
elements[0]
|
|
1948
1863
|
end
|
|
1949
1864
|
|
|
1950
|
-
def seq
|
|
1951
|
-
elements[2]
|
|
1952
|
-
end
|
|
1953
|
-
|
|
1954
1865
|
end
|
|
1955
1866
|
|
|
1956
|
-
module
|
|
1957
|
-
def ast
|
|
1958
|
-
args = seq.ast
|
|
1959
|
-
app = app_prefix.text_value
|
|
1960
|
-
# Find a better place to put a default initialization
|
|
1961
|
-
::EDNGRAMMAR::APPS[app].decode(app, args)
|
|
1962
|
-
end
|
|
1867
|
+
module Prefixed4
|
|
1868
|
+
def ast; elements[2].ast1(prefix.text_value); end
|
|
1963
1869
|
end
|
|
1964
1870
|
|
|
1965
|
-
def
|
|
1871
|
+
def _nt_prefixed
|
|
1966
1872
|
start_index = index
|
|
1967
|
-
if node_cache[:
|
|
1968
|
-
cached = node_cache[:
|
|
1873
|
+
if node_cache[:prefixed].has_key?(index)
|
|
1874
|
+
cached = node_cache[:prefixed][index]
|
|
1969
1875
|
if cached
|
|
1970
|
-
node_cache[:
|
|
1876
|
+
node_cache[:prefixed][index] = cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
|
|
1971
1877
|
@index = cached.interval.end
|
|
1972
1878
|
end
|
|
1973
1879
|
return cached
|
|
1974
1880
|
end
|
|
1975
1881
|
|
|
1976
|
-
i0
|
|
1977
|
-
|
|
1978
|
-
|
|
1979
|
-
|
|
1980
|
-
|
|
1981
|
-
|
|
1982
|
-
|
|
1882
|
+
i0 = index
|
|
1883
|
+
i1, s1 = index, []
|
|
1884
|
+
r2 = _nt_prefix
|
|
1885
|
+
s1 << r2
|
|
1886
|
+
if r2
|
|
1887
|
+
i3 = index
|
|
1888
|
+
r4 = lambda {|(pr)| @pref = pr.text_value;
|
|
1889
|
+
!$options.integrated || !["h", "b64", "dt"].include?(@pref)}.call(s1)
|
|
1890
|
+
if !r4
|
|
1891
|
+
terminal_parse_failure("<semantic predicate>")
|
|
1892
|
+
end
|
|
1893
|
+
if r4
|
|
1894
|
+
@index = i3
|
|
1895
|
+
r3 = instantiate_node(SyntaxNode,input, index...index)
|
|
1983
1896
|
else
|
|
1984
|
-
|
|
1985
|
-
|
|
1897
|
+
@index = i3
|
|
1898
|
+
r3 = nil
|
|
1986
1899
|
end
|
|
1987
|
-
|
|
1988
|
-
if
|
|
1989
|
-
|
|
1990
|
-
|
|
1991
|
-
|
|
1992
|
-
|
|
1993
|
-
|
|
1994
|
-
|
|
1900
|
+
s1 << r3
|
|
1901
|
+
if r3
|
|
1902
|
+
i5 = index
|
|
1903
|
+
r6 = _nt_sqstr
|
|
1904
|
+
r6.extend(Prefixed0)
|
|
1905
|
+
r6.extend(Prefixed0)
|
|
1906
|
+
if r6
|
|
1907
|
+
r6 = SyntaxNode.new(input, (index-1)...index) if r6 == true
|
|
1908
|
+
r5 = r6
|
|
1909
|
+
else
|
|
1910
|
+
r7 = _nt_rawstring
|
|
1911
|
+
r7.extend(Prefixed1)
|
|
1912
|
+
r7.extend(Prefixed1)
|
|
1913
|
+
if r7
|
|
1914
|
+
r7 = SyntaxNode.new(input, (index-1)...index) if r7 == true
|
|
1915
|
+
r5 = r7
|
|
1995
1916
|
else
|
|
1996
|
-
|
|
1997
|
-
|
|
1917
|
+
r8 = _nt_embedded
|
|
1918
|
+
r8.extend(Prefixed2)
|
|
1919
|
+
r8.extend(Prefixed2)
|
|
1920
|
+
if r8
|
|
1921
|
+
r8 = SyntaxNode.new(input, (index-1)...index) if r8 == true
|
|
1922
|
+
r5 = r8
|
|
1923
|
+
else
|
|
1924
|
+
@index = i5
|
|
1925
|
+
r5 = nil
|
|
1926
|
+
end
|
|
1998
1927
|
end
|
|
1999
|
-
s0 << r4
|
|
2000
1928
|
end
|
|
1929
|
+
s1 << r5
|
|
2001
1930
|
end
|
|
2002
1931
|
end
|
|
2003
|
-
if s0.last
|
|
2004
|
-
r0 = instantiate_node(SyntaxNode,input, i0...index, s0)
|
|
2005
|
-
r0.extend(AppSequence0)
|
|
2006
|
-
r0.extend(AppSequence1)
|
|
2007
|
-
else
|
|
2008
|
-
@index = i0
|
|
2009
|
-
r0 = nil
|
|
2010
|
-
end
|
|
2011
|
-
|
|
2012
|
-
node_cache[:app_sequence][start_index] = r0
|
|
2013
|
-
|
|
2014
|
-
r0
|
|
2015
|
-
end
|
|
2016
|
-
|
|
2017
|
-
module AppRstring0
|
|
2018
|
-
def app_prefix
|
|
2019
|
-
elements[0]
|
|
2020
|
-
end
|
|
2021
|
-
|
|
2022
|
-
def rawstring
|
|
2023
|
-
elements[1]
|
|
2024
|
-
end
|
|
2025
|
-
end
|
|
2026
|
-
|
|
2027
|
-
module AppRstring1
|
|
2028
|
-
end
|
|
2029
|
-
|
|
2030
|
-
module AppRstring2
|
|
2031
|
-
|
|
2032
|
-
def ast # XXX ignoring h and b64
|
|
2033
|
-
data = elements[0].rawstring.ast.force_encoding(Encoding::UTF_8) # XXX undo .b
|
|
2034
|
-
app = elements[0].app_prefix.text_value
|
|
2035
|
-
begin
|
|
2036
|
-
::EDNGRAMMAR::APPS[app].decode(app, data)
|
|
2037
|
-
rescue CBOR_DIAG::AppParseError => e
|
|
2038
|
-
app_parser_level1_raw_diagnostics(e, elements[0].elements[1].elements[1])
|
|
2039
|
-
raise e
|
|
2040
|
-
end
|
|
2041
|
-
end
|
|
2042
|
-
end
|
|
2043
|
-
|
|
2044
|
-
def _nt_app_rstring
|
|
2045
|
-
start_index = index
|
|
2046
|
-
if node_cache[:app_rstring].has_key?(index)
|
|
2047
|
-
cached = node_cache[:app_rstring][index]
|
|
2048
|
-
if cached
|
|
2049
|
-
node_cache[:app_rstring][index] = cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
|
|
2050
|
-
@index = cached.interval.end
|
|
2051
|
-
end
|
|
2052
|
-
return cached
|
|
2053
|
-
end
|
|
2054
|
-
|
|
2055
|
-
i0, s0 = index, []
|
|
2056
|
-
i1, s1 = index, []
|
|
2057
|
-
r2 = _nt_app_prefix
|
|
2058
|
-
s1 << r2
|
|
2059
|
-
if r2
|
|
2060
|
-
r3 = _nt_rawstring
|
|
2061
|
-
s1 << r3
|
|
2062
|
-
end
|
|
2063
1932
|
if s1.last
|
|
2064
1933
|
r1 = instantiate_node(SyntaxNode,input, i1...index, s1)
|
|
2065
|
-
r1.extend(
|
|
1934
|
+
r1.extend(Prefixed3)
|
|
1935
|
+
r1.extend(Prefixed4)
|
|
2066
1936
|
else
|
|
2067
1937
|
@index = i1
|
|
2068
1938
|
r1 = nil
|
|
2069
1939
|
end
|
|
2070
|
-
s0 << r1
|
|
2071
1940
|
if r1
|
|
2072
|
-
|
|
2073
|
-
|
|
2074
|
-
|
|
2075
|
-
|
|
2076
|
-
if
|
|
2077
|
-
|
|
2078
|
-
|
|
2079
|
-
if r5
|
|
2080
|
-
@index = i4
|
|
2081
|
-
r4 = instantiate_node(SyntaxNode,input, index...index)
|
|
1941
|
+
r1 = SyntaxNode.new(input, (index-1)...index) if r1 == true
|
|
1942
|
+
r0 = r1
|
|
1943
|
+
else
|
|
1944
|
+
r9 = _nt_sq_app_string_h
|
|
1945
|
+
if r9
|
|
1946
|
+
r9 = SyntaxNode.new(input, (index-1)...index) if r9 == true
|
|
1947
|
+
r0 = r9
|
|
2082
1948
|
else
|
|
2083
|
-
|
|
2084
|
-
|
|
1949
|
+
r10 = _nt_sq_app_string_b64
|
|
1950
|
+
if r10
|
|
1951
|
+
r10 = SyntaxNode.new(input, (index-1)...index) if r10 == true
|
|
1952
|
+
r0 = r10
|
|
1953
|
+
else
|
|
1954
|
+
r11 = _nt_sq_app_string_dt
|
|
1955
|
+
if r11
|
|
1956
|
+
r11 = SyntaxNode.new(input, (index-1)...index) if r11 == true
|
|
1957
|
+
r0 = r11
|
|
1958
|
+
else
|
|
1959
|
+
r12 = _nt_raw_app_string_h
|
|
1960
|
+
if r12
|
|
1961
|
+
r12 = SyntaxNode.new(input, (index-1)...index) if r12 == true
|
|
1962
|
+
r0 = r12
|
|
1963
|
+
else
|
|
1964
|
+
r13 = _nt_raw_app_string_b64
|
|
1965
|
+
if r13
|
|
1966
|
+
r13 = SyntaxNode.new(input, (index-1)...index) if r13 == true
|
|
1967
|
+
r0 = r13
|
|
1968
|
+
else
|
|
1969
|
+
r14 = _nt_raw_app_string_dt
|
|
1970
|
+
if r14
|
|
1971
|
+
r14 = SyntaxNode.new(input, (index-1)...index) if r14 == true
|
|
1972
|
+
r0 = r14
|
|
1973
|
+
else
|
|
1974
|
+
@index = i0
|
|
1975
|
+
r0 = nil
|
|
1976
|
+
end
|
|
1977
|
+
end
|
|
1978
|
+
end
|
|
1979
|
+
end
|
|
1980
|
+
end
|
|
2085
1981
|
end
|
|
2086
|
-
s0 << r4
|
|
2087
|
-
end
|
|
2088
|
-
if s0.last
|
|
2089
|
-
r0 = instantiate_node(SyntaxNode,input, i0...index, s0)
|
|
2090
|
-
r0.extend(AppRstring1)
|
|
2091
|
-
r0.extend(AppRstring2)
|
|
2092
|
-
else
|
|
2093
|
-
@index = i0
|
|
2094
|
-
r0 = nil
|
|
2095
1982
|
end
|
|
2096
1983
|
|
|
2097
|
-
node_cache[:
|
|
1984
|
+
node_cache[:prefixed][start_index] = r0
|
|
2098
1985
|
|
|
2099
1986
|
r0
|
|
2100
1987
|
end
|
|
@@ -2481,40 +2368,40 @@ module EDNGRAMMAR
|
|
|
2481
2368
|
r0
|
|
2482
2369
|
end
|
|
2483
2370
|
|
|
2484
|
-
module
|
|
2485
|
-
def
|
|
2371
|
+
module Dqstr0
|
|
2372
|
+
def DQUOTE1
|
|
2486
2373
|
elements[0]
|
|
2487
2374
|
end
|
|
2488
2375
|
|
|
2489
|
-
def
|
|
2376
|
+
def DQUOTE2
|
|
2490
2377
|
elements[2]
|
|
2491
2378
|
end
|
|
2492
2379
|
end
|
|
2493
2380
|
|
|
2494
|
-
module
|
|
2381
|
+
module Dqstr1
|
|
2495
2382
|
def ast
|
|
2496
|
-
elements[1].elements.map {|x| x.ast}.join
|
|
2383
|
+
elements[1].elements.map {|x| x.ast}.join
|
|
2497
2384
|
end
|
|
2498
2385
|
end
|
|
2499
2386
|
|
|
2500
|
-
def
|
|
2387
|
+
def _nt_dqstr
|
|
2501
2388
|
start_index = index
|
|
2502
|
-
if node_cache[:
|
|
2503
|
-
cached = node_cache[:
|
|
2389
|
+
if node_cache[:dqstr].has_key?(index)
|
|
2390
|
+
cached = node_cache[:dqstr][index]
|
|
2504
2391
|
if cached
|
|
2505
|
-
node_cache[:
|
|
2392
|
+
node_cache[:dqstr][index] = cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
|
|
2506
2393
|
@index = cached.interval.end
|
|
2507
2394
|
end
|
|
2508
2395
|
return cached
|
|
2509
2396
|
end
|
|
2510
2397
|
|
|
2511
2398
|
i0, s0 = index, []
|
|
2512
|
-
r1 =
|
|
2399
|
+
r1 = _nt_DQUOTE
|
|
2513
2400
|
s0 << r1
|
|
2514
2401
|
if r1
|
|
2515
2402
|
s2, i2 = [], index
|
|
2516
2403
|
loop do
|
|
2517
|
-
r3 =
|
|
2404
|
+
r3 = _nt_double_quoted
|
|
2518
2405
|
if r3
|
|
2519
2406
|
s2 << r3
|
|
2520
2407
|
else
|
|
@@ -2524,366 +2411,58 @@ module EDNGRAMMAR
|
|
|
2524
2411
|
r2 = instantiate_node(SyntaxNode,input, i2...index, s2)
|
|
2525
2412
|
s0 << r2
|
|
2526
2413
|
if r2
|
|
2527
|
-
r4 =
|
|
2414
|
+
r4 = _nt_DQUOTE
|
|
2528
2415
|
s0 << r4
|
|
2529
2416
|
end
|
|
2530
2417
|
end
|
|
2531
2418
|
if s0.last
|
|
2532
2419
|
r0 = instantiate_node(SyntaxNode,input, i0...index, s0)
|
|
2533
|
-
r0.extend(
|
|
2534
|
-
r0.extend(
|
|
2420
|
+
r0.extend(Dqstr0)
|
|
2421
|
+
r0.extend(Dqstr1)
|
|
2535
2422
|
else
|
|
2536
2423
|
@index = i0
|
|
2537
2424
|
r0 = nil
|
|
2538
2425
|
end
|
|
2539
2426
|
|
|
2540
|
-
node_cache[:
|
|
2541
|
-
|
|
2542
|
-
r0
|
|
2543
|
-
end
|
|
2544
|
-
|
|
2545
|
-
module Bstr0
|
|
2546
|
-
def sq_app_string_h
|
|
2547
|
-
elements[0]
|
|
2548
|
-
end
|
|
2549
|
-
|
|
2550
|
-
end
|
|
2551
|
-
|
|
2552
|
-
module Bstr1
|
|
2553
|
-
def ast; elements[0].ast end
|
|
2554
|
-
end
|
|
2555
|
-
|
|
2556
|
-
module Bstr2
|
|
2557
|
-
def sq_app_string_b64
|
|
2558
|
-
elements[0]
|
|
2559
|
-
end
|
|
2560
|
-
|
|
2561
|
-
end
|
|
2562
|
-
|
|
2563
|
-
module Bstr3
|
|
2564
|
-
def ast; elements[0].ast end
|
|
2565
|
-
end
|
|
2566
|
-
|
|
2567
|
-
module Bstr4
|
|
2568
|
-
def raw_app_string_h
|
|
2569
|
-
elements[0]
|
|
2570
|
-
end
|
|
2571
|
-
|
|
2572
|
-
end
|
|
2573
|
-
|
|
2574
|
-
module Bstr5
|
|
2575
|
-
def ast; elements[0].ast end
|
|
2576
|
-
end
|
|
2577
|
-
|
|
2578
|
-
module Bstr6
|
|
2579
|
-
def raw_app_string_b64
|
|
2580
|
-
elements[0]
|
|
2581
|
-
end
|
|
2582
|
-
|
|
2583
|
-
end
|
|
2584
|
-
|
|
2585
|
-
module Bstr7
|
|
2586
|
-
def ast; elements[0].ast end
|
|
2587
|
-
end
|
|
2588
|
-
|
|
2589
|
-
module Bstr8
|
|
2590
|
-
def sq_app_string_dt
|
|
2591
|
-
elements[0]
|
|
2592
|
-
end
|
|
2593
|
-
|
|
2594
|
-
end
|
|
2595
|
-
|
|
2596
|
-
module Bstr9
|
|
2597
|
-
def ast; elements[0].ast end
|
|
2598
|
-
end
|
|
2599
|
-
|
|
2600
|
-
module Bstr10
|
|
2601
|
-
def raw_app_string_dt
|
|
2602
|
-
elements[0]
|
|
2603
|
-
end
|
|
2604
|
-
|
|
2605
|
-
end
|
|
2606
|
-
|
|
2607
|
-
module Bstr11
|
|
2608
|
-
def ast; elements[0].ast end
|
|
2609
|
-
end
|
|
2610
|
-
|
|
2611
|
-
def _nt_bstr
|
|
2612
|
-
start_index = index
|
|
2613
|
-
if node_cache[:bstr].has_key?(index)
|
|
2614
|
-
cached = node_cache[:bstr][index]
|
|
2615
|
-
if cached
|
|
2616
|
-
node_cache[:bstr][index] = cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
|
|
2617
|
-
@index = cached.interval.end
|
|
2618
|
-
end
|
|
2619
|
-
return cached
|
|
2620
|
-
end
|
|
2621
|
-
|
|
2622
|
-
i0 = index
|
|
2623
|
-
i1, s1 = index, []
|
|
2624
|
-
r2 = _nt_sq_app_string_h
|
|
2625
|
-
s1 << r2
|
|
2626
|
-
if r2
|
|
2627
|
-
i3 = index
|
|
2628
|
-
r4 = lambda {|x|$options.integrated}.call(s1)
|
|
2629
|
-
if !r4
|
|
2630
|
-
terminal_parse_failure("<semantic predicate>")
|
|
2631
|
-
end
|
|
2632
|
-
if r4
|
|
2633
|
-
@index = i3
|
|
2634
|
-
r3 = instantiate_node(SyntaxNode,input, index...index)
|
|
2635
|
-
else
|
|
2636
|
-
@index = i3
|
|
2637
|
-
r3 = nil
|
|
2638
|
-
end
|
|
2639
|
-
s1 << r3
|
|
2640
|
-
end
|
|
2641
|
-
if s1.last
|
|
2642
|
-
r1 = instantiate_node(SyntaxNode,input, i1...index, s1)
|
|
2643
|
-
r1.extend(Bstr0)
|
|
2644
|
-
r1.extend(Bstr1)
|
|
2645
|
-
else
|
|
2646
|
-
@index = i1
|
|
2647
|
-
r1 = nil
|
|
2648
|
-
end
|
|
2649
|
-
if r1
|
|
2650
|
-
r1 = SyntaxNode.new(input, (index-1)...index) if r1 == true
|
|
2651
|
-
r0 = r1
|
|
2652
|
-
else
|
|
2653
|
-
i5, s5 = index, []
|
|
2654
|
-
r6 = _nt_sq_app_string_b64
|
|
2655
|
-
s5 << r6
|
|
2656
|
-
if r6
|
|
2657
|
-
i7 = index
|
|
2658
|
-
r8 = lambda {|x|$options.integrated}.call(s5)
|
|
2659
|
-
if !r8
|
|
2660
|
-
terminal_parse_failure("<semantic predicate>")
|
|
2661
|
-
end
|
|
2662
|
-
if r8
|
|
2663
|
-
@index = i7
|
|
2664
|
-
r7 = instantiate_node(SyntaxNode,input, index...index)
|
|
2665
|
-
else
|
|
2666
|
-
@index = i7
|
|
2667
|
-
r7 = nil
|
|
2668
|
-
end
|
|
2669
|
-
s5 << r7
|
|
2670
|
-
end
|
|
2671
|
-
if s5.last
|
|
2672
|
-
r5 = instantiate_node(SyntaxNode,input, i5...index, s5)
|
|
2673
|
-
r5.extend(Bstr2)
|
|
2674
|
-
r5.extend(Bstr3)
|
|
2675
|
-
else
|
|
2676
|
-
@index = i5
|
|
2677
|
-
r5 = nil
|
|
2678
|
-
end
|
|
2679
|
-
if r5
|
|
2680
|
-
r5 = SyntaxNode.new(input, (index-1)...index) if r5 == true
|
|
2681
|
-
r0 = r5
|
|
2682
|
-
else
|
|
2683
|
-
i9, s9 = index, []
|
|
2684
|
-
r10 = _nt_raw_app_string_h
|
|
2685
|
-
s9 << r10
|
|
2686
|
-
if r10
|
|
2687
|
-
i11 = index
|
|
2688
|
-
r12 = lambda {|x|$options.integrated}.call(s9)
|
|
2689
|
-
if !r12
|
|
2690
|
-
terminal_parse_failure("<semantic predicate>")
|
|
2691
|
-
end
|
|
2692
|
-
if r12
|
|
2693
|
-
@index = i11
|
|
2694
|
-
r11 = instantiate_node(SyntaxNode,input, index...index)
|
|
2695
|
-
else
|
|
2696
|
-
@index = i11
|
|
2697
|
-
r11 = nil
|
|
2698
|
-
end
|
|
2699
|
-
s9 << r11
|
|
2700
|
-
end
|
|
2701
|
-
if s9.last
|
|
2702
|
-
r9 = instantiate_node(SyntaxNode,input, i9...index, s9)
|
|
2703
|
-
r9.extend(Bstr4)
|
|
2704
|
-
r9.extend(Bstr5)
|
|
2705
|
-
else
|
|
2706
|
-
@index = i9
|
|
2707
|
-
r9 = nil
|
|
2708
|
-
end
|
|
2709
|
-
if r9
|
|
2710
|
-
r9 = SyntaxNode.new(input, (index-1)...index) if r9 == true
|
|
2711
|
-
r0 = r9
|
|
2712
|
-
else
|
|
2713
|
-
i13, s13 = index, []
|
|
2714
|
-
r14 = _nt_raw_app_string_b64
|
|
2715
|
-
s13 << r14
|
|
2716
|
-
if r14
|
|
2717
|
-
i15 = index
|
|
2718
|
-
r16 = lambda {|x|$options.integrated}.call(s13)
|
|
2719
|
-
if !r16
|
|
2720
|
-
terminal_parse_failure("<semantic predicate>")
|
|
2721
|
-
end
|
|
2722
|
-
if r16
|
|
2723
|
-
@index = i15
|
|
2724
|
-
r15 = instantiate_node(SyntaxNode,input, index...index)
|
|
2725
|
-
else
|
|
2726
|
-
@index = i15
|
|
2727
|
-
r15 = nil
|
|
2728
|
-
end
|
|
2729
|
-
s13 << r15
|
|
2730
|
-
end
|
|
2731
|
-
if s13.last
|
|
2732
|
-
r13 = instantiate_node(SyntaxNode,input, i13...index, s13)
|
|
2733
|
-
r13.extend(Bstr6)
|
|
2734
|
-
r13.extend(Bstr7)
|
|
2735
|
-
else
|
|
2736
|
-
@index = i13
|
|
2737
|
-
r13 = nil
|
|
2738
|
-
end
|
|
2739
|
-
if r13
|
|
2740
|
-
r13 = SyntaxNode.new(input, (index-1)...index) if r13 == true
|
|
2741
|
-
r0 = r13
|
|
2742
|
-
else
|
|
2743
|
-
i17, s17 = index, []
|
|
2744
|
-
r18 = _nt_sq_app_string_dt
|
|
2745
|
-
s17 << r18
|
|
2746
|
-
if r18
|
|
2747
|
-
i19 = index
|
|
2748
|
-
r20 = lambda {|x|$options.integrated}.call(s17)
|
|
2749
|
-
if !r20
|
|
2750
|
-
terminal_parse_failure("<semantic predicate>")
|
|
2751
|
-
end
|
|
2752
|
-
if r20
|
|
2753
|
-
@index = i19
|
|
2754
|
-
r19 = instantiate_node(SyntaxNode,input, index...index)
|
|
2755
|
-
else
|
|
2756
|
-
@index = i19
|
|
2757
|
-
r19 = nil
|
|
2758
|
-
end
|
|
2759
|
-
s17 << r19
|
|
2760
|
-
end
|
|
2761
|
-
if s17.last
|
|
2762
|
-
r17 = instantiate_node(SyntaxNode,input, i17...index, s17)
|
|
2763
|
-
r17.extend(Bstr8)
|
|
2764
|
-
r17.extend(Bstr9)
|
|
2765
|
-
else
|
|
2766
|
-
@index = i17
|
|
2767
|
-
r17 = nil
|
|
2768
|
-
end
|
|
2769
|
-
if r17
|
|
2770
|
-
r17 = SyntaxNode.new(input, (index-1)...index) if r17 == true
|
|
2771
|
-
r0 = r17
|
|
2772
|
-
else
|
|
2773
|
-
i21, s21 = index, []
|
|
2774
|
-
r22 = _nt_raw_app_string_dt
|
|
2775
|
-
s21 << r22
|
|
2776
|
-
if r22
|
|
2777
|
-
i23 = index
|
|
2778
|
-
r24 = lambda {|x|$options.integrated}.call(s21)
|
|
2779
|
-
if !r24
|
|
2780
|
-
terminal_parse_failure("<semantic predicate>")
|
|
2781
|
-
end
|
|
2782
|
-
if r24
|
|
2783
|
-
@index = i23
|
|
2784
|
-
r23 = instantiate_node(SyntaxNode,input, index...index)
|
|
2785
|
-
else
|
|
2786
|
-
@index = i23
|
|
2787
|
-
r23 = nil
|
|
2788
|
-
end
|
|
2789
|
-
s21 << r23
|
|
2790
|
-
end
|
|
2791
|
-
if s21.last
|
|
2792
|
-
r21 = instantiate_node(SyntaxNode,input, i21...index, s21)
|
|
2793
|
-
r21.extend(Bstr10)
|
|
2794
|
-
r21.extend(Bstr11)
|
|
2795
|
-
else
|
|
2796
|
-
@index = i21
|
|
2797
|
-
r21 = nil
|
|
2798
|
-
end
|
|
2799
|
-
if r21
|
|
2800
|
-
r21 = SyntaxNode.new(input, (index-1)...index) if r21 == true
|
|
2801
|
-
r0 = r21
|
|
2802
|
-
else
|
|
2803
|
-
r25 = _nt_app_string
|
|
2804
|
-
if r25
|
|
2805
|
-
r25 = SyntaxNode.new(input, (index-1)...index) if r25 == true
|
|
2806
|
-
r0 = r25
|
|
2807
|
-
else
|
|
2808
|
-
r26 = _nt_sqstr
|
|
2809
|
-
if r26
|
|
2810
|
-
r26 = SyntaxNode.new(input, (index-1)...index) if r26 == true
|
|
2811
|
-
r0 = r26
|
|
2812
|
-
else
|
|
2813
|
-
r27 = _nt_app_rstring
|
|
2814
|
-
if r27
|
|
2815
|
-
r27 = SyntaxNode.new(input, (index-1)...index) if r27 == true
|
|
2816
|
-
r0 = r27
|
|
2817
|
-
else
|
|
2818
|
-
r28 = _nt_rawstring
|
|
2819
|
-
if r28
|
|
2820
|
-
r28 = SyntaxNode.new(input, (index-1)...index) if r28 == true
|
|
2821
|
-
r0 = r28
|
|
2822
|
-
else
|
|
2823
|
-
r29 = _nt_app_sequence
|
|
2824
|
-
if r29
|
|
2825
|
-
r29 = SyntaxNode.new(input, (index-1)...index) if r29 == true
|
|
2826
|
-
r0 = r29
|
|
2827
|
-
else
|
|
2828
|
-
r30 = _nt_embedded
|
|
2829
|
-
if r30
|
|
2830
|
-
r30 = SyntaxNode.new(input, (index-1)...index) if r30 == true
|
|
2831
|
-
r0 = r30
|
|
2832
|
-
else
|
|
2833
|
-
@index = i0
|
|
2834
|
-
r0 = nil
|
|
2835
|
-
end
|
|
2836
|
-
end
|
|
2837
|
-
end
|
|
2838
|
-
end
|
|
2839
|
-
end
|
|
2840
|
-
end
|
|
2841
|
-
end
|
|
2842
|
-
end
|
|
2843
|
-
end
|
|
2844
|
-
end
|
|
2845
|
-
end
|
|
2846
|
-
end
|
|
2847
|
-
|
|
2848
|
-
node_cache[:bstr][start_index] = r0
|
|
2427
|
+
node_cache[:dqstr][start_index] = r0
|
|
2849
2428
|
|
|
2850
2429
|
r0
|
|
2851
2430
|
end
|
|
2852
2431
|
|
|
2853
|
-
module
|
|
2854
|
-
def
|
|
2432
|
+
module Sqstr0
|
|
2433
|
+
def SQUOTE1
|
|
2855
2434
|
elements[0]
|
|
2856
2435
|
end
|
|
2857
2436
|
|
|
2858
|
-
def
|
|
2437
|
+
def SQUOTE2
|
|
2859
2438
|
elements[2]
|
|
2860
2439
|
end
|
|
2861
2440
|
end
|
|
2862
2441
|
|
|
2863
|
-
module
|
|
2442
|
+
module Sqstr1
|
|
2864
2443
|
def ast
|
|
2865
|
-
elements[1].elements.map {|x| x.ast}.join
|
|
2444
|
+
elements[1].elements.map {|x| x.ast}.join.b # XXX .b
|
|
2866
2445
|
end
|
|
2867
2446
|
end
|
|
2868
2447
|
|
|
2869
|
-
def
|
|
2448
|
+
def _nt_sqstr
|
|
2870
2449
|
start_index = index
|
|
2871
|
-
if node_cache[:
|
|
2872
|
-
cached = node_cache[:
|
|
2450
|
+
if node_cache[:sqstr].has_key?(index)
|
|
2451
|
+
cached = node_cache[:sqstr][index]
|
|
2873
2452
|
if cached
|
|
2874
|
-
node_cache[:
|
|
2453
|
+
node_cache[:sqstr][index] = cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
|
|
2875
2454
|
@index = cached.interval.end
|
|
2876
2455
|
end
|
|
2877
2456
|
return cached
|
|
2878
2457
|
end
|
|
2879
2458
|
|
|
2880
2459
|
i0, s0 = index, []
|
|
2881
|
-
r1 =
|
|
2460
|
+
r1 = _nt_SQUOTE
|
|
2882
2461
|
s0 << r1
|
|
2883
2462
|
if r1
|
|
2884
2463
|
s2, i2 = [], index
|
|
2885
2464
|
loop do
|
|
2886
|
-
r3 =
|
|
2465
|
+
r3 = _nt_single_quoted
|
|
2887
2466
|
if r3
|
|
2888
2467
|
s2 << r3
|
|
2889
2468
|
else
|
|
@@ -2893,20 +2472,20 @@ module EDNGRAMMAR
|
|
|
2893
2472
|
r2 = instantiate_node(SyntaxNode,input, i2...index, s2)
|
|
2894
2473
|
s0 << r2
|
|
2895
2474
|
if r2
|
|
2896
|
-
r4 =
|
|
2475
|
+
r4 = _nt_SQUOTE
|
|
2897
2476
|
s0 << r4
|
|
2898
2477
|
end
|
|
2899
2478
|
end
|
|
2900
2479
|
if s0.last
|
|
2901
2480
|
r0 = instantiate_node(SyntaxNode,input, i0...index, s0)
|
|
2902
|
-
r0.extend(
|
|
2903
|
-
r0.extend(
|
|
2481
|
+
r0.extend(Sqstr0)
|
|
2482
|
+
r0.extend(Sqstr1)
|
|
2904
2483
|
else
|
|
2905
2484
|
@index = i0
|
|
2906
2485
|
r0 = nil
|
|
2907
2486
|
end
|
|
2908
2487
|
|
|
2909
|
-
node_cache[:
|
|
2488
|
+
node_cache[:sqstr][start_index] = r0
|
|
2910
2489
|
|
|
2911
2490
|
r0
|
|
2912
2491
|
end
|