edn-abnf 0.5.39 → 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 +406 -1261
- metadata +1 -1
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,341 +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_string1e
|
|
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
|
-
r0 = nil
|
|
279
|
-
end
|
|
280
|
-
end
|
|
281
|
-
|
|
282
|
-
node_cache[:string1e][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 String0
|
|
332
|
-
def S1
|
|
333
|
-
elements[0]
|
|
334
|
-
end
|
|
335
|
-
|
|
336
|
-
def S2
|
|
337
|
-
elements[2]
|
|
338
|
-
end
|
|
339
|
-
|
|
340
|
-
def string1e
|
|
341
|
-
elements[3]
|
|
342
|
-
end
|
|
343
|
-
end
|
|
344
|
-
|
|
345
|
-
module String1
|
|
346
|
-
def string1e
|
|
347
|
-
elements[0]
|
|
348
|
-
end
|
|
349
|
-
|
|
350
|
-
end
|
|
351
|
-
|
|
352
|
-
module String2
|
|
353
|
-
def join1(s)
|
|
354
|
-
s.join # XXX -- look at encoding and ei
|
|
355
|
-
end
|
|
356
|
-
def unpack_chunk(c, s)
|
|
357
|
-
if c == String
|
|
358
|
-
join1(s)
|
|
359
|
-
else
|
|
360
|
-
unless c == CBOR::Tagged && s.first.tag == 888 && s.first.value == nil # XXX check all values?
|
|
361
|
-
raise ArgumentError, "*** unjoinable chunks #{c.inspect} #{s.inspect}" if s.size != 1
|
|
362
|
-
end
|
|
363
|
-
s.first
|
|
364
|
-
end
|
|
365
|
-
end
|
|
366
|
-
def ast
|
|
367
|
-
arr = [elements[0].ast] + elements[1].elements.map {|x| x.elements[3].ast}
|
|
368
|
-
charr = arr.chunk(&:class).to_a
|
|
369
|
-
if charr.size == 1
|
|
370
|
-
unpack_chunk(*charr.first)
|
|
371
|
-
else
|
|
372
|
-
CBOR::Tagged.new(888, charr.map {|x| unpack_chunk(*x)})
|
|
373
|
-
end
|
|
374
|
-
end
|
|
375
|
-
end
|
|
376
|
-
|
|
377
|
-
def _nt_string
|
|
378
|
-
start_index = index
|
|
379
|
-
if node_cache[:string].has_key?(index)
|
|
380
|
-
cached = node_cache[:string][index]
|
|
381
|
-
if cached
|
|
382
|
-
node_cache[:string][index] = cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
|
|
383
|
-
@index = cached.interval.end
|
|
384
|
-
end
|
|
385
|
-
return cached
|
|
386
|
-
end
|
|
387
|
-
|
|
388
|
-
i0, s0 = index, []
|
|
389
|
-
r1 = _nt_string1e
|
|
390
|
-
s0 << r1
|
|
391
|
-
if r1
|
|
392
|
-
s2, i2 = [], index
|
|
393
|
-
loop do
|
|
394
|
-
i3, s3 = index, []
|
|
395
|
-
r4 = _nt_S
|
|
396
|
-
s3 << r4
|
|
397
|
-
if r4
|
|
398
|
-
if (match_len = has_terminal?("+", false, index))
|
|
399
|
-
r5 = true
|
|
400
|
-
@index += match_len
|
|
401
|
-
else
|
|
402
|
-
terminal_parse_failure('"+"')
|
|
403
|
-
r5 = nil
|
|
404
|
-
end
|
|
405
|
-
s3 << r5
|
|
406
|
-
if r5
|
|
407
|
-
r6 = _nt_S
|
|
408
|
-
s3 << r6
|
|
409
|
-
if r6
|
|
410
|
-
r7 = _nt_string1e
|
|
411
|
-
s3 << r7
|
|
412
|
-
end
|
|
413
|
-
end
|
|
414
|
-
end
|
|
415
|
-
if s3.last
|
|
416
|
-
r3 = instantiate_node(SyntaxNode,input, i3...index, s3)
|
|
417
|
-
r3.extend(String0)
|
|
418
|
-
else
|
|
419
|
-
@index = i3
|
|
420
|
-
r3 = nil
|
|
421
|
-
end
|
|
265
|
+
r3 = _nt_octint
|
|
422
266
|
if r3
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
break
|
|
426
|
-
end
|
|
427
|
-
end
|
|
428
|
-
r2 = instantiate_node(SyntaxNode,input, i2...index, s2)
|
|
429
|
-
s0 << r2
|
|
430
|
-
end
|
|
431
|
-
if s0.last
|
|
432
|
-
r0 = instantiate_node(SyntaxNode,input, i0...index, s0)
|
|
433
|
-
r0.extend(String1)
|
|
434
|
-
r0.extend(String2)
|
|
435
|
-
else
|
|
436
|
-
@index = i0
|
|
437
|
-
r0 = nil
|
|
438
|
-
end
|
|
439
|
-
|
|
440
|
-
node_cache[:string][start_index] = r0
|
|
441
|
-
|
|
442
|
-
r0
|
|
443
|
-
end
|
|
444
|
-
|
|
445
|
-
module Number0
|
|
446
|
-
def spec
|
|
447
|
-
elements[1]
|
|
448
|
-
end
|
|
449
|
-
end
|
|
450
|
-
|
|
451
|
-
module Number1
|
|
452
|
-
def ast
|
|
453
|
-
val = elements[0].ast
|
|
454
|
-
|
|
455
|
-
if ei = spec.text_value[1..-1]
|
|
456
|
-
# warn "*** implementing encoding indicator #{ei.inspect} for #{elements[0].text_value}"
|
|
457
|
-
val = CBOR::Box.from_instance(val, {ei: ei})
|
|
458
|
-
end
|
|
459
|
-
val
|
|
460
|
-
end
|
|
461
|
-
end
|
|
462
|
-
|
|
463
|
-
def _nt_number
|
|
464
|
-
start_index = index
|
|
465
|
-
if node_cache[:number].has_key?(index)
|
|
466
|
-
cached = node_cache[:number][index]
|
|
467
|
-
if cached
|
|
468
|
-
node_cache[:number][index] = cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
|
|
469
|
-
@index = cached.interval.end
|
|
470
|
-
end
|
|
471
|
-
return cached
|
|
472
|
-
end
|
|
473
|
-
|
|
474
|
-
i0, s0 = index, []
|
|
475
|
-
i1 = index
|
|
476
|
-
r2 = _nt_hexfloat
|
|
477
|
-
if r2
|
|
478
|
-
r2 = SyntaxNode.new(input, (index-1)...index) if r2 == true
|
|
479
|
-
r1 = r2
|
|
480
|
-
else
|
|
481
|
-
r3 = _nt_hexint
|
|
482
|
-
if r3
|
|
483
|
-
r3 = SyntaxNode.new(input, (index-1)...index) if r3 == true
|
|
484
|
-
r1 = r3
|
|
485
|
-
else
|
|
486
|
-
r4 = _nt_octint
|
|
487
|
-
if r4
|
|
488
|
-
r4 = SyntaxNode.new(input, (index-1)...index) if r4 == true
|
|
489
|
-
r1 = r4
|
|
267
|
+
r3 = SyntaxNode.new(input, (index-1)...index) if r3 == true
|
|
268
|
+
r0 = r3
|
|
490
269
|
else
|
|
491
|
-
|
|
492
|
-
if
|
|
493
|
-
|
|
494
|
-
|
|
270
|
+
r4 = _nt_binint
|
|
271
|
+
if r4
|
|
272
|
+
r4 = SyntaxNode.new(input, (index-1)...index) if r4 == true
|
|
273
|
+
r0 = r4
|
|
495
274
|
else
|
|
496
|
-
|
|
497
|
-
if
|
|
498
|
-
|
|
499
|
-
|
|
275
|
+
r5 = _nt_decnumber
|
|
276
|
+
if r5
|
|
277
|
+
r5 = SyntaxNode.new(input, (index-1)...index) if r5 == true
|
|
278
|
+
r0 = r5
|
|
500
279
|
else
|
|
501
|
-
|
|
502
|
-
if
|
|
503
|
-
|
|
504
|
-
|
|
280
|
+
r6 = _nt_nonfin
|
|
281
|
+
if r6
|
|
282
|
+
r6 = SyntaxNode.new(input, (index-1)...index) if r6 == true
|
|
283
|
+
r0 = r6
|
|
505
284
|
else
|
|
506
|
-
@index =
|
|
507
|
-
|
|
285
|
+
@index = i0
|
|
286
|
+
r0 = nil
|
|
508
287
|
end
|
|
509
288
|
end
|
|
510
289
|
end
|
|
511
290
|
end
|
|
512
291
|
end
|
|
513
292
|
end
|
|
514
|
-
s0 << r1
|
|
515
|
-
if r1
|
|
516
|
-
r8 = _nt_spec
|
|
517
|
-
s0 << r8
|
|
518
|
-
end
|
|
519
|
-
if s0.last
|
|
520
|
-
r0 = instantiate_node(SyntaxNode,input, i0...index, s0)
|
|
521
|
-
r0.extend(Number0)
|
|
522
|
-
r0.extend(Number1)
|
|
523
|
-
else
|
|
524
|
-
@index = i0
|
|
525
|
-
r0 = nil
|
|
526
|
-
end
|
|
527
293
|
|
|
528
294
|
node_cache[:number][start_index] = r0
|
|
529
295
|
|
|
@@ -1275,7 +1041,95 @@ module EDNGRAMMAR
|
|
|
1275
1041
|
end
|
|
1276
1042
|
end
|
|
1277
1043
|
|
|
1278
|
-
node_cache[:nonfin][start_index] = r0
|
|
1044
|
+
node_cache[:nonfin][start_index] = r0
|
|
1045
|
+
|
|
1046
|
+
r0
|
|
1047
|
+
end
|
|
1048
|
+
|
|
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
|
|
1058
|
+
end
|
|
1059
|
+
|
|
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
|
|
1279
1133
|
|
|
1280
1134
|
r0
|
|
1281
1135
|
end
|
|
@@ -1882,26 +1736,26 @@ module EDNGRAMMAR
|
|
|
1882
1736
|
r0
|
|
1883
1737
|
end
|
|
1884
1738
|
|
|
1885
|
-
module
|
|
1739
|
+
module Prefix0
|
|
1886
1740
|
def lcalpha
|
|
1887
1741
|
elements[0]
|
|
1888
1742
|
end
|
|
1889
1743
|
|
|
1890
1744
|
end
|
|
1891
1745
|
|
|
1892
|
-
module
|
|
1746
|
+
module Prefix1
|
|
1893
1747
|
def ucalpha
|
|
1894
1748
|
elements[0]
|
|
1895
1749
|
end
|
|
1896
1750
|
|
|
1897
1751
|
end
|
|
1898
1752
|
|
|
1899
|
-
def
|
|
1753
|
+
def _nt_prefix
|
|
1900
1754
|
start_index = index
|
|
1901
|
-
if node_cache[:
|
|
1902
|
-
cached = node_cache[:
|
|
1755
|
+
if node_cache[:prefix].has_key?(index)
|
|
1756
|
+
cached = node_cache[:prefix][index]
|
|
1903
1757
|
if cached
|
|
1904
|
-
node_cache[:
|
|
1758
|
+
node_cache[:prefix][index] = cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
|
|
1905
1759
|
@index = cached.interval.end
|
|
1906
1760
|
end
|
|
1907
1761
|
return cached
|
|
@@ -1926,7 +1780,7 @@ module EDNGRAMMAR
|
|
|
1926
1780
|
end
|
|
1927
1781
|
if s1.last
|
|
1928
1782
|
r1 = instantiate_node(SyntaxNode,input, i1...index, s1)
|
|
1929
|
-
r1.extend(
|
|
1783
|
+
r1.extend(Prefix0)
|
|
1930
1784
|
else
|
|
1931
1785
|
@index = i1
|
|
1932
1786
|
r1 = nil
|
|
@@ -1953,7 +1807,7 @@ module EDNGRAMMAR
|
|
|
1953
1807
|
end
|
|
1954
1808
|
if s5.last
|
|
1955
1809
|
r5 = instantiate_node(SyntaxNode,input, i5...index, s5)
|
|
1956
|
-
r5.extend(
|
|
1810
|
+
r5.extend(Prefix1)
|
|
1957
1811
|
else
|
|
1958
1812
|
@index = i5
|
|
1959
1813
|
r5 = nil
|
|
@@ -1967,277 +1821,196 @@ module EDNGRAMMAR
|
|
|
1967
1821
|
end
|
|
1968
1822
|
end
|
|
1969
1823
|
|
|
1970
|
-
node_cache[:
|
|
1824
|
+
node_cache[:prefix][start_index] = r0
|
|
1971
1825
|
|
|
1972
1826
|
r0
|
|
1973
1827
|
end
|
|
1974
1828
|
|
|
1975
|
-
module
|
|
1976
|
-
def
|
|
1977
|
-
|
|
1978
|
-
|
|
1979
|
-
|
|
1980
|
-
|
|
1981
|
-
|
|
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
|
|
1982
1838
|
end
|
|
1983
1839
|
end
|
|
1984
1840
|
|
|
1985
|
-
module
|
|
1986
|
-
|
|
1987
|
-
|
|
1988
|
-
|
|
1989
|
-
|
|
1990
|
-
|
|
1991
|
-
|
|
1992
|
-
|
|
1993
|
-
|
|
1994
|
-
rescue CBOR_DIAG::AppParseError => e
|
|
1995
|
-
app_parser_level1_diagnostics(e, elements[0].elements[1].elements[1])
|
|
1996
|
-
raise e
|
|
1997
|
-
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
|
|
1998
1850
|
end
|
|
1999
1851
|
end
|
|
2000
1852
|
|
|
2001
|
-
|
|
2002
|
-
|
|
2003
|
-
|
|
2004
|
-
|
|
2005
|
-
if cached
|
|
2006
|
-
node_cache[:app_string][index] = cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
|
|
2007
|
-
@index = cached.interval.end
|
|
2008
|
-
end
|
|
2009
|
-
return cached
|
|
2010
|
-
end
|
|
2011
|
-
|
|
2012
|
-
i0, s0 = index, []
|
|
2013
|
-
i1, s1 = index, []
|
|
2014
|
-
r2 = _nt_app_prefix
|
|
2015
|
-
s1 << r2
|
|
2016
|
-
if r2
|
|
2017
|
-
r3 = _nt_sqstr
|
|
2018
|
-
s1 << r3
|
|
2019
|
-
end
|
|
2020
|
-
if s1.last
|
|
2021
|
-
r1 = instantiate_node(SyntaxNode,input, i1...index, s1)
|
|
2022
|
-
r1.extend(AppString0)
|
|
2023
|
-
else
|
|
2024
|
-
@index = i1
|
|
2025
|
-
r1 = nil
|
|
2026
|
-
end
|
|
2027
|
-
s0 << r1
|
|
2028
|
-
if r1
|
|
2029
|
-
i4 = index
|
|
2030
|
-
r5 = lambda {|x| pref = x[0].app_prefix.text_value
|
|
2031
|
-
ret = !$options.integrated || !["h", "b64", "dt"].include?(pref)
|
|
2032
|
-
ret}.call(s0)
|
|
2033
|
-
if !r5
|
|
2034
|
-
terminal_parse_failure("<semantic predicate>")
|
|
2035
|
-
end
|
|
2036
|
-
if r5
|
|
2037
|
-
@index = i4
|
|
2038
|
-
r4 = instantiate_node(SyntaxNode,input, index...index)
|
|
2039
|
-
else
|
|
2040
|
-
@index = i4
|
|
2041
|
-
r4 = nil
|
|
1853
|
+
module Prefixed2
|
|
1854
|
+
def ast1(pref)
|
|
1855
|
+
args = seq.ast
|
|
1856
|
+
::EDNGRAMMAR::APPS[pref].decode(pref, args)
|
|
2042
1857
|
end
|
|
2043
|
-
s0 << r4
|
|
2044
|
-
end
|
|
2045
|
-
if s0.last
|
|
2046
|
-
r0 = instantiate_node(SyntaxNode,input, i0...index, s0)
|
|
2047
|
-
r0.extend(AppString1)
|
|
2048
|
-
r0.extend(AppString2)
|
|
2049
|
-
else
|
|
2050
|
-
@index = i0
|
|
2051
|
-
r0 = nil
|
|
2052
|
-
end
|
|
2053
|
-
|
|
2054
|
-
node_cache[:app_string][start_index] = r0
|
|
2055
|
-
|
|
2056
|
-
r0
|
|
2057
1858
|
end
|
|
2058
1859
|
|
|
2059
|
-
module
|
|
2060
|
-
def
|
|
1860
|
+
module Prefixed3
|
|
1861
|
+
def prefix
|
|
2061
1862
|
elements[0]
|
|
2062
1863
|
end
|
|
2063
1864
|
|
|
2064
|
-
def seq
|
|
2065
|
-
elements[2]
|
|
2066
|
-
end
|
|
2067
|
-
|
|
2068
1865
|
end
|
|
2069
1866
|
|
|
2070
|
-
module
|
|
2071
|
-
def ast
|
|
2072
|
-
args = seq.ast
|
|
2073
|
-
app = app_prefix.text_value
|
|
2074
|
-
# Find a better place to put a default initialization
|
|
2075
|
-
::EDNGRAMMAR::APPS[app].decode(app, args)
|
|
2076
|
-
end
|
|
1867
|
+
module Prefixed4
|
|
1868
|
+
def ast; elements[2].ast1(prefix.text_value); end
|
|
2077
1869
|
end
|
|
2078
1870
|
|
|
2079
|
-
def
|
|
1871
|
+
def _nt_prefixed
|
|
2080
1872
|
start_index = index
|
|
2081
|
-
if node_cache[:
|
|
2082
|
-
cached = node_cache[:
|
|
1873
|
+
if node_cache[:prefixed].has_key?(index)
|
|
1874
|
+
cached = node_cache[:prefixed][index]
|
|
2083
1875
|
if cached
|
|
2084
|
-
node_cache[:
|
|
1876
|
+
node_cache[:prefixed][index] = cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
|
|
2085
1877
|
@index = cached.interval.end
|
|
2086
1878
|
end
|
|
2087
1879
|
return cached
|
|
2088
1880
|
end
|
|
2089
1881
|
|
|
2090
|
-
i0
|
|
2091
|
-
|
|
2092
|
-
|
|
2093
|
-
|
|
2094
|
-
|
|
2095
|
-
|
|
2096
|
-
|
|
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)
|
|
2097
1896
|
else
|
|
2098
|
-
|
|
2099
|
-
|
|
1897
|
+
@index = i3
|
|
1898
|
+
r3 = nil
|
|
2100
1899
|
end
|
|
2101
|
-
|
|
2102
|
-
if
|
|
2103
|
-
|
|
2104
|
-
|
|
2105
|
-
|
|
2106
|
-
|
|
2107
|
-
|
|
2108
|
-
|
|
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
|
|
2109
1916
|
else
|
|
2110
|
-
|
|
2111
|
-
|
|
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
|
|
2112
1927
|
end
|
|
2113
|
-
s0 << r4
|
|
2114
1928
|
end
|
|
1929
|
+
s1 << r5
|
|
2115
1930
|
end
|
|
2116
1931
|
end
|
|
2117
|
-
if s0.last
|
|
2118
|
-
r0 = instantiate_node(SyntaxNode,input, i0...index, s0)
|
|
2119
|
-
r0.extend(AppSequence0)
|
|
2120
|
-
r0.extend(AppSequence1)
|
|
2121
|
-
else
|
|
2122
|
-
@index = i0
|
|
2123
|
-
r0 = nil
|
|
2124
|
-
end
|
|
2125
|
-
|
|
2126
|
-
node_cache[:app_sequence][start_index] = r0
|
|
2127
|
-
|
|
2128
|
-
r0
|
|
2129
|
-
end
|
|
2130
|
-
|
|
2131
|
-
module AppRstring0
|
|
2132
|
-
def app_prefix
|
|
2133
|
-
elements[0]
|
|
2134
|
-
end
|
|
2135
|
-
|
|
2136
|
-
def rawstring
|
|
2137
|
-
elements[1]
|
|
2138
|
-
end
|
|
2139
|
-
end
|
|
2140
|
-
|
|
2141
|
-
module AppRstring1
|
|
2142
|
-
end
|
|
2143
|
-
|
|
2144
|
-
module AppRstring2
|
|
2145
|
-
|
|
2146
|
-
def ast # XXX ignoring h and b64
|
|
2147
|
-
data = elements[0].rawstring.ast.force_encoding(Encoding::UTF_8) # XXX undo .b
|
|
2148
|
-
app = elements[0].app_prefix.text_value
|
|
2149
|
-
begin
|
|
2150
|
-
::EDNGRAMMAR::APPS[app].decode(app, data)
|
|
2151
|
-
rescue CBOR_DIAG::AppParseError => e
|
|
2152
|
-
app_parser_level1_raw_diagnostics(e, elements[0].elements[1].elements[1])
|
|
2153
|
-
raise e
|
|
2154
|
-
end
|
|
2155
|
-
end
|
|
2156
|
-
end
|
|
2157
|
-
|
|
2158
|
-
def _nt_app_rstring
|
|
2159
|
-
start_index = index
|
|
2160
|
-
if node_cache[:app_rstring].has_key?(index)
|
|
2161
|
-
cached = node_cache[:app_rstring][index]
|
|
2162
|
-
if cached
|
|
2163
|
-
node_cache[:app_rstring][index] = cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
|
|
2164
|
-
@index = cached.interval.end
|
|
2165
|
-
end
|
|
2166
|
-
return cached
|
|
2167
|
-
end
|
|
2168
|
-
|
|
2169
|
-
i0, s0 = index, []
|
|
2170
|
-
i1, s1 = index, []
|
|
2171
|
-
r2 = _nt_app_prefix
|
|
2172
|
-
s1 << r2
|
|
2173
|
-
if r2
|
|
2174
|
-
r3 = _nt_rawstring
|
|
2175
|
-
s1 << r3
|
|
2176
|
-
end
|
|
2177
1932
|
if s1.last
|
|
2178
1933
|
r1 = instantiate_node(SyntaxNode,input, i1...index, s1)
|
|
2179
|
-
r1.extend(
|
|
1934
|
+
r1.extend(Prefixed3)
|
|
1935
|
+
r1.extend(Prefixed4)
|
|
2180
1936
|
else
|
|
2181
1937
|
@index = i1
|
|
2182
1938
|
r1 = nil
|
|
2183
1939
|
end
|
|
2184
|
-
s0 << r1
|
|
2185
1940
|
if r1
|
|
2186
|
-
|
|
2187
|
-
|
|
2188
|
-
|
|
2189
|
-
|
|
2190
|
-
if
|
|
2191
|
-
|
|
2192
|
-
|
|
2193
|
-
if r5
|
|
2194
|
-
@index = i4
|
|
2195
|
-
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
|
|
2196
1948
|
else
|
|
2197
|
-
|
|
2198
|
-
|
|
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
|
|
2199
1981
|
end
|
|
2200
|
-
s0 << r4
|
|
2201
|
-
end
|
|
2202
|
-
if s0.last
|
|
2203
|
-
r0 = instantiate_node(SyntaxNode,input, i0...index, s0)
|
|
2204
|
-
r0.extend(AppRstring1)
|
|
2205
|
-
r0.extend(AppRstring2)
|
|
2206
|
-
else
|
|
2207
|
-
@index = i0
|
|
2208
|
-
r0 = nil
|
|
2209
1982
|
end
|
|
2210
1983
|
|
|
2211
|
-
node_cache[:
|
|
1984
|
+
node_cache[:prefixed][start_index] = r0
|
|
2212
1985
|
|
|
2213
1986
|
r0
|
|
2214
1987
|
end
|
|
2215
1988
|
|
|
2216
1989
|
module Rawstring0
|
|
2217
|
-
def
|
|
2218
|
-
elements[
|
|
1990
|
+
def startrawdelim
|
|
1991
|
+
elements[0]
|
|
2219
1992
|
end
|
|
2220
1993
|
|
|
2221
|
-
|
|
2222
|
-
|
|
2223
|
-
module Rawstring1
|
|
2224
|
-
def rawcontent
|
|
1994
|
+
def raw_inner
|
|
2225
1995
|
elements[1]
|
|
2226
1996
|
end
|
|
2227
|
-
end
|
|
2228
|
-
|
|
2229
|
-
module Rawstring2
|
|
2230
|
-
def startrawdelim
|
|
2231
|
-
elements[0]
|
|
2232
|
-
end
|
|
2233
1997
|
|
|
2234
1998
|
def alikerawdelim
|
|
2235
1999
|
elements[2]
|
|
2236
2000
|
end
|
|
2237
2001
|
end
|
|
2238
2002
|
|
|
2239
|
-
module
|
|
2240
|
-
def ast
|
|
2003
|
+
module Rawstring1
|
|
2004
|
+
def ast
|
|
2005
|
+
val = raw_inner.text_value.gsub("\r", "")
|
|
2006
|
+
if val[0] == ' ' && val[-1] == ' '
|
|
2007
|
+
val[1...-1]
|
|
2008
|
+
elsif val[0] == "\n"
|
|
2009
|
+
val[1..-1]
|
|
2010
|
+
else
|
|
2011
|
+
val
|
|
2012
|
+
end
|
|
2013
|
+
end
|
|
2241
2014
|
end
|
|
2242
2015
|
|
|
2243
2016
|
def _nt_rawstring
|
|
@@ -2246,87 +2019,26 @@ module EDNGRAMMAR
|
|
|
2246
2019
|
cached = node_cache[:rawstring][index]
|
|
2247
2020
|
if cached
|
|
2248
2021
|
node_cache[:rawstring][index] = cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
|
|
2249
|
-
@index = cached.interval.end
|
|
2250
|
-
end
|
|
2251
|
-
return cached
|
|
2252
|
-
end
|
|
2253
|
-
|
|
2254
|
-
i0, s0 = index, []
|
|
2255
|
-
r1 = _nt_startrawdelim
|
|
2256
|
-
s0 << r1
|
|
2257
|
-
if r1
|
|
2258
|
-
i2 = index
|
|
2259
|
-
i3, s3 = index, []
|
|
2260
|
-
if (match_len = has_terminal?(" ", false, index))
|
|
2261
|
-
r4 = true
|
|
2262
|
-
@index += match_len
|
|
2263
|
-
else
|
|
2264
|
-
terminal_parse_failure('" "')
|
|
2265
|
-
r4 = nil
|
|
2266
|
-
end
|
|
2267
|
-
s3 << r4
|
|
2268
|
-
if r4
|
|
2269
|
-
r5 = _nt_rawcontent0
|
|
2270
|
-
s3 << r5
|
|
2271
|
-
if r5
|
|
2272
|
-
if (match_len = has_terminal?(" ", false, index))
|
|
2273
|
-
r6 = true
|
|
2274
|
-
@index += match_len
|
|
2275
|
-
else
|
|
2276
|
-
terminal_parse_failure('" "')
|
|
2277
|
-
r6 = nil
|
|
2278
|
-
end
|
|
2279
|
-
s3 << r6
|
|
2280
|
-
end
|
|
2281
|
-
end
|
|
2282
|
-
if s3.last
|
|
2283
|
-
r3 = instantiate_node(SyntaxNode,input, i3...index, s3)
|
|
2284
|
-
r3.extend(Rawstring0)
|
|
2285
|
-
else
|
|
2286
|
-
@index = i3
|
|
2287
|
-
r3 = nil
|
|
2288
|
-
end
|
|
2289
|
-
if r3
|
|
2290
|
-
r3 = SyntaxNode.new(input, (index-1)...index) if r3 == true
|
|
2291
|
-
r2 = r3
|
|
2292
|
-
else
|
|
2293
|
-
i7, s7 = index, []
|
|
2294
|
-
r9 = _nt_newline
|
|
2295
|
-
if r9
|
|
2296
|
-
r8 = r9
|
|
2297
|
-
else
|
|
2298
|
-
r8 = instantiate_node(SyntaxNode,input, index...index)
|
|
2299
|
-
end
|
|
2300
|
-
s7 << r8
|
|
2301
|
-
if r8
|
|
2302
|
-
r10 = _nt_rawcontent
|
|
2303
|
-
s7 << r10
|
|
2304
|
-
end
|
|
2305
|
-
if s7.last
|
|
2306
|
-
r7 = instantiate_node(SyntaxNode,input, i7...index, s7)
|
|
2307
|
-
r7.extend(Rawstring1)
|
|
2308
|
-
else
|
|
2309
|
-
@index = i7
|
|
2310
|
-
r7 = nil
|
|
2311
|
-
end
|
|
2312
|
-
if r7
|
|
2313
|
-
r7 = SyntaxNode.new(input, (index-1)...index) if r7 == true
|
|
2314
|
-
r2 = r7
|
|
2315
|
-
else
|
|
2316
|
-
@index = i2
|
|
2317
|
-
r2 = nil
|
|
2318
|
-
end
|
|
2022
|
+
@index = cached.interval.end
|
|
2319
2023
|
end
|
|
2024
|
+
return cached
|
|
2025
|
+
end
|
|
2026
|
+
|
|
2027
|
+
i0, s0 = index, []
|
|
2028
|
+
r1 = _nt_startrawdelim
|
|
2029
|
+
s0 << r1
|
|
2030
|
+
if r1
|
|
2031
|
+
r2 = _nt_raw_inner
|
|
2320
2032
|
s0 << r2
|
|
2321
2033
|
if r2
|
|
2322
|
-
|
|
2323
|
-
s0 <<
|
|
2034
|
+
r3 = _nt_alikerawdelim
|
|
2035
|
+
s0 << r3
|
|
2324
2036
|
end
|
|
2325
2037
|
end
|
|
2326
2038
|
if s0.last
|
|
2327
2039
|
r0 = instantiate_node(SyntaxNode,input, i0...index, s0)
|
|
2328
|
-
r0.extend(
|
|
2329
|
-
r0.extend(
|
|
2040
|
+
r0.extend(Rawstring0)
|
|
2041
|
+
r0.extend(Rawstring1)
|
|
2330
2042
|
else
|
|
2331
2043
|
@index = i0
|
|
2332
2044
|
r0 = nil
|
|
@@ -2610,100 +2322,12 @@ module EDNGRAMMAR
|
|
|
2610
2322
|
r0
|
|
2611
2323
|
end
|
|
2612
2324
|
|
|
2613
|
-
def
|
|
2614
|
-
start_index = index
|
|
2615
|
-
if node_cache[:rawchars0].has_key?(index)
|
|
2616
|
-
cached = node_cache[:rawchars0][index]
|
|
2617
|
-
if cached
|
|
2618
|
-
node_cache[:rawchars0][index] = cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
|
|
2619
|
-
@index = cached.interval.end
|
|
2620
|
-
end
|
|
2621
|
-
return cached
|
|
2622
|
-
end
|
|
2623
|
-
|
|
2624
|
-
s0, i0 = [], index
|
|
2625
|
-
loop do
|
|
2626
|
-
i1 = index
|
|
2627
|
-
if (match_len = has_terminal?("\n", false, index))
|
|
2628
|
-
r2 = true
|
|
2629
|
-
@index += match_len
|
|
2630
|
-
else
|
|
2631
|
-
terminal_parse_failure('"\\n"')
|
|
2632
|
-
r2 = nil
|
|
2633
|
-
end
|
|
2634
|
-
if r2
|
|
2635
|
-
r2 = SyntaxNode.new(input, (index-1)...index) if r2 == true
|
|
2636
|
-
r1 = r2
|
|
2637
|
-
else
|
|
2638
|
-
if (match_len = has_terminal?("\r", false, index))
|
|
2639
|
-
r3 = true
|
|
2640
|
-
@index += match_len
|
|
2641
|
-
else
|
|
2642
|
-
terminal_parse_failure('"\\r"')
|
|
2643
|
-
r3 = nil
|
|
2644
|
-
end
|
|
2645
|
-
if r3
|
|
2646
|
-
r3 = SyntaxNode.new(input, (index-1)...index) if r3 == true
|
|
2647
|
-
r1 = r3
|
|
2648
|
-
else
|
|
2649
|
-
if has_terminal?(@regexps[gr = '\A[!-_]'] ||= Regexp.new(gr), :regexp, index)
|
|
2650
|
-
r4 = true
|
|
2651
|
-
@index += 1
|
|
2652
|
-
else
|
|
2653
|
-
terminal_parse_failure('[!-_]')
|
|
2654
|
-
r4 = nil
|
|
2655
|
-
end
|
|
2656
|
-
if r4
|
|
2657
|
-
r4 = SyntaxNode.new(input, (index-1)...index) if r4 == true
|
|
2658
|
-
r1 = r4
|
|
2659
|
-
else
|
|
2660
|
-
if has_terminal?(@regexps[gr = '\A[a-~]'] ||= Regexp.new(gr), :regexp, index)
|
|
2661
|
-
r5 = true
|
|
2662
|
-
@index += 1
|
|
2663
|
-
else
|
|
2664
|
-
terminal_parse_failure('[a-~]')
|
|
2665
|
-
r5 = nil
|
|
2666
|
-
end
|
|
2667
|
-
if r5
|
|
2668
|
-
r5 = SyntaxNode.new(input, (index-1)...index) if r5 == true
|
|
2669
|
-
r1 = r5
|
|
2670
|
-
else
|
|
2671
|
-
r6 = _nt_NONASCII
|
|
2672
|
-
if r6
|
|
2673
|
-
r6 = SyntaxNode.new(input, (index-1)...index) if r6 == true
|
|
2674
|
-
r1 = r6
|
|
2675
|
-
else
|
|
2676
|
-
@index = i1
|
|
2677
|
-
r1 = nil
|
|
2678
|
-
end
|
|
2679
|
-
end
|
|
2680
|
-
end
|
|
2681
|
-
end
|
|
2682
|
-
end
|
|
2683
|
-
if r1
|
|
2684
|
-
s0 << r1
|
|
2685
|
-
else
|
|
2686
|
-
break
|
|
2687
|
-
end
|
|
2688
|
-
end
|
|
2689
|
-
if s0.empty?
|
|
2690
|
-
@index = i0
|
|
2691
|
-
r0 = nil
|
|
2692
|
-
else
|
|
2693
|
-
r0 = instantiate_node(SyntaxNode,input, i0...index, s0)
|
|
2694
|
-
end
|
|
2695
|
-
|
|
2696
|
-
node_cache[:rawchars0][start_index] = r0
|
|
2697
|
-
|
|
2698
|
-
r0
|
|
2699
|
-
end
|
|
2700
|
-
|
|
2701
|
-
def _nt_rawcontent
|
|
2325
|
+
def _nt_raw_inner
|
|
2702
2326
|
start_index = index
|
|
2703
|
-
if node_cache[:
|
|
2704
|
-
cached = node_cache[:
|
|
2327
|
+
if node_cache[:raw_inner].has_key?(index)
|
|
2328
|
+
cached = node_cache[:raw_inner][index]
|
|
2705
2329
|
if cached
|
|
2706
|
-
node_cache[:
|
|
2330
|
+
node_cache[:raw_inner][index] = cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
|
|
2707
2331
|
@index = cached.interval.end
|
|
2708
2332
|
end
|
|
2709
2333
|
return cached
|
|
@@ -2730,528 +2354,115 @@ module EDNGRAMMAR
|
|
|
2730
2354
|
s0 << r1
|
|
2731
2355
|
else
|
|
2732
2356
|
break
|
|
2733
|
-
end
|
|
2734
|
-
end
|
|
2735
|
-
if s0.empty?
|
|
2736
|
-
@index = i0
|
|
2737
|
-
r0 = nil
|
|
2738
|
-
else
|
|
2739
|
-
r0 = instantiate_node(SyntaxNode,input, i0...index, s0)
|
|
2740
|
-
end
|
|
2741
|
-
|
|
2742
|
-
node_cache[:rawcontent][start_index] = r0
|
|
2743
|
-
|
|
2744
|
-
r0
|
|
2745
|
-
end
|
|
2746
|
-
|
|
2747
|
-
module Rawcontent00
|
|
2748
|
-
def shortrawdelim
|
|
2749
|
-
elements[1]
|
|
2750
|
-
end
|
|
2751
|
-
end
|
|
2752
|
-
|
|
2753
|
-
module Rawcontent01
|
|
2754
|
-
end
|
|
2755
|
-
|
|
2756
|
-
def _nt_rawcontent0
|
|
2757
|
-
start_index = index
|
|
2758
|
-
if node_cache[:rawcontent0].has_key?(index)
|
|
2759
|
-
cached = node_cache[:rawcontent0][index]
|
|
2760
|
-
if cached
|
|
2761
|
-
node_cache[:rawcontent0][index] = cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
|
|
2762
|
-
@index = cached.interval.end
|
|
2763
|
-
end
|
|
2764
|
-
return cached
|
|
2765
|
-
end
|
|
2766
|
-
|
|
2767
|
-
s0, i0 = [], index
|
|
2768
|
-
loop do
|
|
2769
|
-
i1 = index
|
|
2770
|
-
r2 = _nt_rawchars0
|
|
2771
|
-
if r2
|
|
2772
|
-
r2 = SyntaxNode.new(input, (index-1)...index) if r2 == true
|
|
2773
|
-
r1 = r2
|
|
2774
|
-
else
|
|
2775
|
-
i3, s3 = index, []
|
|
2776
|
-
s4, i4 = [], index
|
|
2777
|
-
loop do
|
|
2778
|
-
r5 = _nt_rawchars
|
|
2779
|
-
if r5
|
|
2780
|
-
s4 << r5
|
|
2781
|
-
else
|
|
2782
|
-
break
|
|
2783
|
-
end
|
|
2784
|
-
end
|
|
2785
|
-
r4 = instantiate_node(SyntaxNode,input, i4...index, s4)
|
|
2786
|
-
s3 << r4
|
|
2787
|
-
if r4
|
|
2788
|
-
r6 = _nt_shortrawdelim
|
|
2789
|
-
s3 << r6
|
|
2790
|
-
end
|
|
2791
|
-
if s3.last
|
|
2792
|
-
r3 = instantiate_node(SyntaxNode,input, i3...index, s3)
|
|
2793
|
-
r3.extend(Rawcontent00)
|
|
2794
|
-
else
|
|
2795
|
-
@index = i3
|
|
2796
|
-
r3 = nil
|
|
2797
|
-
end
|
|
2798
|
-
if r3
|
|
2799
|
-
r3 = SyntaxNode.new(input, (index-1)...index) if r3 == true
|
|
2800
|
-
r1 = r3
|
|
2801
|
-
else
|
|
2802
|
-
i7, s7 = index, []
|
|
2803
|
-
if (match_len = has_terminal?(" ", false, index))
|
|
2804
|
-
r8 = true
|
|
2805
|
-
@index += match_len
|
|
2806
|
-
else
|
|
2807
|
-
terminal_parse_failure('" "')
|
|
2808
|
-
r8 = nil
|
|
2809
|
-
end
|
|
2810
|
-
s7 << r8
|
|
2811
|
-
if r8
|
|
2812
|
-
i9 = index
|
|
2813
|
-
r10 = _nt_alikerawdelim
|
|
2814
|
-
if r10
|
|
2815
|
-
@index = i9
|
|
2816
|
-
r9 = nil
|
|
2817
|
-
else
|
|
2818
|
-
@index = i9
|
|
2819
|
-
r9 = instantiate_node(SyntaxNode,input, index...index)
|
|
2820
|
-
end
|
|
2821
|
-
s7 << r9
|
|
2822
|
-
end
|
|
2823
|
-
if s7.last
|
|
2824
|
-
r7 = instantiate_node(SyntaxNode,input, i7...index, s7)
|
|
2825
|
-
r7.extend(Rawcontent01)
|
|
2826
|
-
else
|
|
2827
|
-
@index = i7
|
|
2828
|
-
r7 = nil
|
|
2829
|
-
end
|
|
2830
|
-
if r7
|
|
2831
|
-
r7 = SyntaxNode.new(input, (index-1)...index) if r7 == true
|
|
2832
|
-
r1 = r7
|
|
2833
|
-
else
|
|
2834
|
-
@index = i1
|
|
2835
|
-
r1 = nil
|
|
2836
|
-
end
|
|
2837
|
-
end
|
|
2838
|
-
end
|
|
2839
|
-
if r1
|
|
2840
|
-
s0 << r1
|
|
2841
|
-
else
|
|
2842
|
-
break
|
|
2843
|
-
end
|
|
2844
|
-
end
|
|
2845
|
-
r0 = instantiate_node(SyntaxNode,input, i0...index, s0)
|
|
2846
|
-
|
|
2847
|
-
node_cache[:rawcontent0][start_index] = r0
|
|
2848
|
-
|
|
2849
|
-
r0
|
|
2850
|
-
end
|
|
2851
|
-
|
|
2852
|
-
module Sqstr0
|
|
2853
|
-
def SQUOTE1
|
|
2854
|
-
elements[0]
|
|
2855
|
-
end
|
|
2856
|
-
|
|
2857
|
-
def SQUOTE2
|
|
2858
|
-
elements[2]
|
|
2859
|
-
end
|
|
2860
|
-
end
|
|
2861
|
-
|
|
2862
|
-
module Sqstr1
|
|
2863
|
-
def ast
|
|
2864
|
-
elements[1].elements.map {|x| x.ast}.join.b # XXX .b
|
|
2865
|
-
end
|
|
2866
|
-
end
|
|
2867
|
-
|
|
2868
|
-
def _nt_sqstr
|
|
2869
|
-
start_index = index
|
|
2870
|
-
if node_cache[:sqstr].has_key?(index)
|
|
2871
|
-
cached = node_cache[:sqstr][index]
|
|
2872
|
-
if cached
|
|
2873
|
-
node_cache[:sqstr][index] = cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
|
|
2874
|
-
@index = cached.interval.end
|
|
2875
|
-
end
|
|
2876
|
-
return cached
|
|
2877
|
-
end
|
|
2878
|
-
|
|
2879
|
-
i0, s0 = index, []
|
|
2880
|
-
r1 = _nt_SQUOTE
|
|
2881
|
-
s0 << r1
|
|
2882
|
-
if r1
|
|
2883
|
-
s2, i2 = [], index
|
|
2884
|
-
loop do
|
|
2885
|
-
r3 = _nt_single_quoted
|
|
2886
|
-
if r3
|
|
2887
|
-
s2 << r3
|
|
2888
|
-
else
|
|
2889
|
-
break
|
|
2890
|
-
end
|
|
2891
|
-
end
|
|
2892
|
-
r2 = instantiate_node(SyntaxNode,input, i2...index, s2)
|
|
2893
|
-
s0 << r2
|
|
2894
|
-
if r2
|
|
2895
|
-
r4 = _nt_SQUOTE
|
|
2896
|
-
s0 << r4
|
|
2897
|
-
end
|
|
2898
|
-
end
|
|
2899
|
-
if s0.last
|
|
2900
|
-
r0 = instantiate_node(SyntaxNode,input, i0...index, s0)
|
|
2901
|
-
r0.extend(Sqstr0)
|
|
2902
|
-
r0.extend(Sqstr1)
|
|
2903
|
-
else
|
|
2904
|
-
@index = i0
|
|
2905
|
-
r0 = nil
|
|
2906
|
-
end
|
|
2907
|
-
|
|
2908
|
-
node_cache[:sqstr][start_index] = r0
|
|
2909
|
-
|
|
2910
|
-
r0
|
|
2911
|
-
end
|
|
2912
|
-
|
|
2913
|
-
module Bstr0
|
|
2914
|
-
def sq_app_string_h
|
|
2915
|
-
elements[0]
|
|
2916
|
-
end
|
|
2917
|
-
|
|
2918
|
-
end
|
|
2919
|
-
|
|
2920
|
-
module Bstr1
|
|
2921
|
-
def ast; elements[0].ast end
|
|
2922
|
-
end
|
|
2923
|
-
|
|
2924
|
-
module Bstr2
|
|
2925
|
-
def sq_app_string_b64
|
|
2926
|
-
elements[0]
|
|
2927
|
-
end
|
|
2928
|
-
|
|
2929
|
-
end
|
|
2930
|
-
|
|
2931
|
-
module Bstr3
|
|
2932
|
-
def ast; elements[0].ast end
|
|
2933
|
-
end
|
|
2934
|
-
|
|
2935
|
-
module Bstr4
|
|
2936
|
-
def raw_app_string_h
|
|
2937
|
-
elements[0]
|
|
2357
|
+
end
|
|
2938
2358
|
end
|
|
2939
|
-
|
|
2940
|
-
|
|
2941
|
-
|
|
2942
|
-
|
|
2943
|
-
|
|
2944
|
-
end
|
|
2945
|
-
|
|
2946
|
-
module Bstr6
|
|
2947
|
-
def raw_app_string_b64
|
|
2948
|
-
elements[0]
|
|
2359
|
+
if s0.empty?
|
|
2360
|
+
@index = i0
|
|
2361
|
+
r0 = nil
|
|
2362
|
+
else
|
|
2363
|
+
r0 = instantiate_node(SyntaxNode,input, i0...index, s0)
|
|
2949
2364
|
end
|
|
2950
2365
|
|
|
2951
|
-
|
|
2366
|
+
node_cache[:raw_inner][start_index] = r0
|
|
2952
2367
|
|
|
2953
|
-
|
|
2954
|
-
def ast; elements[0].ast end
|
|
2368
|
+
r0
|
|
2955
2369
|
end
|
|
2956
2370
|
|
|
2957
|
-
module
|
|
2958
|
-
def
|
|
2371
|
+
module Dqstr0
|
|
2372
|
+
def DQUOTE1
|
|
2959
2373
|
elements[0]
|
|
2960
2374
|
end
|
|
2961
2375
|
|
|
2962
|
-
|
|
2963
|
-
|
|
2964
|
-
module Bstr9
|
|
2965
|
-
def ast; elements[0].ast end
|
|
2966
|
-
end
|
|
2967
|
-
|
|
2968
|
-
module Bstr10
|
|
2969
|
-
def raw_app_string_dt
|
|
2970
|
-
elements[0]
|
|
2376
|
+
def DQUOTE2
|
|
2377
|
+
elements[2]
|
|
2971
2378
|
end
|
|
2972
|
-
|
|
2973
2379
|
end
|
|
2974
2380
|
|
|
2975
|
-
module
|
|
2976
|
-
def ast
|
|
2381
|
+
module Dqstr1
|
|
2382
|
+
def ast
|
|
2383
|
+
elements[1].elements.map {|x| x.ast}.join
|
|
2384
|
+
end
|
|
2977
2385
|
end
|
|
2978
2386
|
|
|
2979
|
-
def
|
|
2387
|
+
def _nt_dqstr
|
|
2980
2388
|
start_index = index
|
|
2981
|
-
if node_cache[:
|
|
2982
|
-
cached = node_cache[:
|
|
2389
|
+
if node_cache[:dqstr].has_key?(index)
|
|
2390
|
+
cached = node_cache[:dqstr][index]
|
|
2983
2391
|
if cached
|
|
2984
|
-
node_cache[:
|
|
2392
|
+
node_cache[:dqstr][index] = cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
|
|
2985
2393
|
@index = cached.interval.end
|
|
2986
2394
|
end
|
|
2987
2395
|
return cached
|
|
2988
2396
|
end
|
|
2989
2397
|
|
|
2990
|
-
i0 = index
|
|
2991
|
-
|
|
2992
|
-
|
|
2993
|
-
s1 << r2
|
|
2994
|
-
if r2
|
|
2995
|
-
i3 = index
|
|
2996
|
-
r4 = lambda {|x|$options.integrated}.call(s1)
|
|
2997
|
-
if !r4
|
|
2998
|
-
terminal_parse_failure("<semantic predicate>")
|
|
2999
|
-
end
|
|
3000
|
-
if r4
|
|
3001
|
-
@index = i3
|
|
3002
|
-
r3 = instantiate_node(SyntaxNode,input, index...index)
|
|
3003
|
-
else
|
|
3004
|
-
@index = i3
|
|
3005
|
-
r3 = nil
|
|
3006
|
-
end
|
|
3007
|
-
s1 << r3
|
|
3008
|
-
end
|
|
3009
|
-
if s1.last
|
|
3010
|
-
r1 = instantiate_node(SyntaxNode,input, i1...index, s1)
|
|
3011
|
-
r1.extend(Bstr0)
|
|
3012
|
-
r1.extend(Bstr1)
|
|
3013
|
-
else
|
|
3014
|
-
@index = i1
|
|
3015
|
-
r1 = nil
|
|
3016
|
-
end
|
|
2398
|
+
i0, s0 = index, []
|
|
2399
|
+
r1 = _nt_DQUOTE
|
|
2400
|
+
s0 << r1
|
|
3017
2401
|
if r1
|
|
3018
|
-
|
|
3019
|
-
|
|
3020
|
-
|
|
3021
|
-
|
|
3022
|
-
|
|
3023
|
-
s5 << r6
|
|
3024
|
-
if r6
|
|
3025
|
-
i7 = index
|
|
3026
|
-
r8 = lambda {|x|$options.integrated}.call(s5)
|
|
3027
|
-
if !r8
|
|
3028
|
-
terminal_parse_failure("<semantic predicate>")
|
|
3029
|
-
end
|
|
3030
|
-
if r8
|
|
3031
|
-
@index = i7
|
|
3032
|
-
r7 = instantiate_node(SyntaxNode,input, index...index)
|
|
2402
|
+
s2, i2 = [], index
|
|
2403
|
+
loop do
|
|
2404
|
+
r3 = _nt_double_quoted
|
|
2405
|
+
if r3
|
|
2406
|
+
s2 << r3
|
|
3033
2407
|
else
|
|
3034
|
-
|
|
3035
|
-
r7 = nil
|
|
2408
|
+
break
|
|
3036
2409
|
end
|
|
3037
|
-
s5 << r7
|
|
3038
|
-
end
|
|
3039
|
-
if s5.last
|
|
3040
|
-
r5 = instantiate_node(SyntaxNode,input, i5...index, s5)
|
|
3041
|
-
r5.extend(Bstr2)
|
|
3042
|
-
r5.extend(Bstr3)
|
|
3043
|
-
else
|
|
3044
|
-
@index = i5
|
|
3045
|
-
r5 = nil
|
|
3046
2410
|
end
|
|
3047
|
-
|
|
3048
|
-
|
|
3049
|
-
|
|
3050
|
-
|
|
3051
|
-
|
|
3052
|
-
r10 = _nt_raw_app_string_h
|
|
3053
|
-
s9 << r10
|
|
3054
|
-
if r10
|
|
3055
|
-
i11 = index
|
|
3056
|
-
r12 = lambda {|x|$options.integrated}.call(s9)
|
|
3057
|
-
if !r12
|
|
3058
|
-
terminal_parse_failure("<semantic predicate>")
|
|
3059
|
-
end
|
|
3060
|
-
if r12
|
|
3061
|
-
@index = i11
|
|
3062
|
-
r11 = instantiate_node(SyntaxNode,input, index...index)
|
|
3063
|
-
else
|
|
3064
|
-
@index = i11
|
|
3065
|
-
r11 = nil
|
|
3066
|
-
end
|
|
3067
|
-
s9 << r11
|
|
3068
|
-
end
|
|
3069
|
-
if s9.last
|
|
3070
|
-
r9 = instantiate_node(SyntaxNode,input, i9...index, s9)
|
|
3071
|
-
r9.extend(Bstr4)
|
|
3072
|
-
r9.extend(Bstr5)
|
|
3073
|
-
else
|
|
3074
|
-
@index = i9
|
|
3075
|
-
r9 = nil
|
|
3076
|
-
end
|
|
3077
|
-
if r9
|
|
3078
|
-
r9 = SyntaxNode.new(input, (index-1)...index) if r9 == true
|
|
3079
|
-
r0 = r9
|
|
3080
|
-
else
|
|
3081
|
-
i13, s13 = index, []
|
|
3082
|
-
r14 = _nt_raw_app_string_b64
|
|
3083
|
-
s13 << r14
|
|
3084
|
-
if r14
|
|
3085
|
-
i15 = index
|
|
3086
|
-
r16 = lambda {|x|$options.integrated}.call(s13)
|
|
3087
|
-
if !r16
|
|
3088
|
-
terminal_parse_failure("<semantic predicate>")
|
|
3089
|
-
end
|
|
3090
|
-
if r16
|
|
3091
|
-
@index = i15
|
|
3092
|
-
r15 = instantiate_node(SyntaxNode,input, index...index)
|
|
3093
|
-
else
|
|
3094
|
-
@index = i15
|
|
3095
|
-
r15 = nil
|
|
3096
|
-
end
|
|
3097
|
-
s13 << r15
|
|
3098
|
-
end
|
|
3099
|
-
if s13.last
|
|
3100
|
-
r13 = instantiate_node(SyntaxNode,input, i13...index, s13)
|
|
3101
|
-
r13.extend(Bstr6)
|
|
3102
|
-
r13.extend(Bstr7)
|
|
3103
|
-
else
|
|
3104
|
-
@index = i13
|
|
3105
|
-
r13 = nil
|
|
3106
|
-
end
|
|
3107
|
-
if r13
|
|
3108
|
-
r13 = SyntaxNode.new(input, (index-1)...index) if r13 == true
|
|
3109
|
-
r0 = r13
|
|
3110
|
-
else
|
|
3111
|
-
i17, s17 = index, []
|
|
3112
|
-
r18 = _nt_sq_app_string_dt
|
|
3113
|
-
s17 << r18
|
|
3114
|
-
if r18
|
|
3115
|
-
i19 = index
|
|
3116
|
-
r20 = lambda {|x|$options.integrated}.call(s17)
|
|
3117
|
-
if !r20
|
|
3118
|
-
terminal_parse_failure("<semantic predicate>")
|
|
3119
|
-
end
|
|
3120
|
-
if r20
|
|
3121
|
-
@index = i19
|
|
3122
|
-
r19 = instantiate_node(SyntaxNode,input, index...index)
|
|
3123
|
-
else
|
|
3124
|
-
@index = i19
|
|
3125
|
-
r19 = nil
|
|
3126
|
-
end
|
|
3127
|
-
s17 << r19
|
|
3128
|
-
end
|
|
3129
|
-
if s17.last
|
|
3130
|
-
r17 = instantiate_node(SyntaxNode,input, i17...index, s17)
|
|
3131
|
-
r17.extend(Bstr8)
|
|
3132
|
-
r17.extend(Bstr9)
|
|
3133
|
-
else
|
|
3134
|
-
@index = i17
|
|
3135
|
-
r17 = nil
|
|
3136
|
-
end
|
|
3137
|
-
if r17
|
|
3138
|
-
r17 = SyntaxNode.new(input, (index-1)...index) if r17 == true
|
|
3139
|
-
r0 = r17
|
|
3140
|
-
else
|
|
3141
|
-
i21, s21 = index, []
|
|
3142
|
-
r22 = _nt_raw_app_string_dt
|
|
3143
|
-
s21 << r22
|
|
3144
|
-
if r22
|
|
3145
|
-
i23 = index
|
|
3146
|
-
r24 = lambda {|x|$options.integrated}.call(s21)
|
|
3147
|
-
if !r24
|
|
3148
|
-
terminal_parse_failure("<semantic predicate>")
|
|
3149
|
-
end
|
|
3150
|
-
if r24
|
|
3151
|
-
@index = i23
|
|
3152
|
-
r23 = instantiate_node(SyntaxNode,input, index...index)
|
|
3153
|
-
else
|
|
3154
|
-
@index = i23
|
|
3155
|
-
r23 = nil
|
|
3156
|
-
end
|
|
3157
|
-
s21 << r23
|
|
3158
|
-
end
|
|
3159
|
-
if s21.last
|
|
3160
|
-
r21 = instantiate_node(SyntaxNode,input, i21...index, s21)
|
|
3161
|
-
r21.extend(Bstr10)
|
|
3162
|
-
r21.extend(Bstr11)
|
|
3163
|
-
else
|
|
3164
|
-
@index = i21
|
|
3165
|
-
r21 = nil
|
|
3166
|
-
end
|
|
3167
|
-
if r21
|
|
3168
|
-
r21 = SyntaxNode.new(input, (index-1)...index) if r21 == true
|
|
3169
|
-
r0 = r21
|
|
3170
|
-
else
|
|
3171
|
-
r25 = _nt_app_string
|
|
3172
|
-
if r25
|
|
3173
|
-
r25 = SyntaxNode.new(input, (index-1)...index) if r25 == true
|
|
3174
|
-
r0 = r25
|
|
3175
|
-
else
|
|
3176
|
-
r26 = _nt_sqstr
|
|
3177
|
-
if r26
|
|
3178
|
-
r26 = SyntaxNode.new(input, (index-1)...index) if r26 == true
|
|
3179
|
-
r0 = r26
|
|
3180
|
-
else
|
|
3181
|
-
r27 = _nt_app_rstring
|
|
3182
|
-
if r27
|
|
3183
|
-
r27 = SyntaxNode.new(input, (index-1)...index) if r27 == true
|
|
3184
|
-
r0 = r27
|
|
3185
|
-
else
|
|
3186
|
-
r28 = _nt_rawstring
|
|
3187
|
-
if r28
|
|
3188
|
-
r28 = SyntaxNode.new(input, (index-1)...index) if r28 == true
|
|
3189
|
-
r0 = r28
|
|
3190
|
-
else
|
|
3191
|
-
r29 = _nt_app_sequence
|
|
3192
|
-
if r29
|
|
3193
|
-
r29 = SyntaxNode.new(input, (index-1)...index) if r29 == true
|
|
3194
|
-
r0 = r29
|
|
3195
|
-
else
|
|
3196
|
-
r30 = _nt_embedded
|
|
3197
|
-
if r30
|
|
3198
|
-
r30 = SyntaxNode.new(input, (index-1)...index) if r30 == true
|
|
3199
|
-
r0 = r30
|
|
3200
|
-
else
|
|
3201
|
-
@index = i0
|
|
3202
|
-
r0 = nil
|
|
3203
|
-
end
|
|
3204
|
-
end
|
|
3205
|
-
end
|
|
3206
|
-
end
|
|
3207
|
-
end
|
|
3208
|
-
end
|
|
3209
|
-
end
|
|
3210
|
-
end
|
|
3211
|
-
end
|
|
3212
|
-
end
|
|
2411
|
+
r2 = instantiate_node(SyntaxNode,input, i2...index, s2)
|
|
2412
|
+
s0 << r2
|
|
2413
|
+
if r2
|
|
2414
|
+
r4 = _nt_DQUOTE
|
|
2415
|
+
s0 << r4
|
|
3213
2416
|
end
|
|
3214
2417
|
end
|
|
2418
|
+
if s0.last
|
|
2419
|
+
r0 = instantiate_node(SyntaxNode,input, i0...index, s0)
|
|
2420
|
+
r0.extend(Dqstr0)
|
|
2421
|
+
r0.extend(Dqstr1)
|
|
2422
|
+
else
|
|
2423
|
+
@index = i0
|
|
2424
|
+
r0 = nil
|
|
2425
|
+
end
|
|
3215
2426
|
|
|
3216
|
-
node_cache[:
|
|
2427
|
+
node_cache[:dqstr][start_index] = r0
|
|
3217
2428
|
|
|
3218
2429
|
r0
|
|
3219
2430
|
end
|
|
3220
2431
|
|
|
3221
|
-
module
|
|
3222
|
-
def
|
|
2432
|
+
module Sqstr0
|
|
2433
|
+
def SQUOTE1
|
|
3223
2434
|
elements[0]
|
|
3224
2435
|
end
|
|
3225
2436
|
|
|
3226
|
-
def
|
|
2437
|
+
def SQUOTE2
|
|
3227
2438
|
elements[2]
|
|
3228
2439
|
end
|
|
3229
2440
|
end
|
|
3230
2441
|
|
|
3231
|
-
module
|
|
2442
|
+
module Sqstr1
|
|
3232
2443
|
def ast
|
|
3233
|
-
elements[1].elements.map {|x| x.ast}.join
|
|
2444
|
+
elements[1].elements.map {|x| x.ast}.join.b # XXX .b
|
|
3234
2445
|
end
|
|
3235
2446
|
end
|
|
3236
2447
|
|
|
3237
|
-
def
|
|
2448
|
+
def _nt_sqstr
|
|
3238
2449
|
start_index = index
|
|
3239
|
-
if node_cache[:
|
|
3240
|
-
cached = node_cache[:
|
|
2450
|
+
if node_cache[:sqstr].has_key?(index)
|
|
2451
|
+
cached = node_cache[:sqstr][index]
|
|
3241
2452
|
if cached
|
|
3242
|
-
node_cache[:
|
|
2453
|
+
node_cache[:sqstr][index] = cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
|
|
3243
2454
|
@index = cached.interval.end
|
|
3244
2455
|
end
|
|
3245
2456
|
return cached
|
|
3246
2457
|
end
|
|
3247
2458
|
|
|
3248
2459
|
i0, s0 = index, []
|
|
3249
|
-
r1 =
|
|
2460
|
+
r1 = _nt_SQUOTE
|
|
3250
2461
|
s0 << r1
|
|
3251
2462
|
if r1
|
|
3252
2463
|
s2, i2 = [], index
|
|
3253
2464
|
loop do
|
|
3254
|
-
r3 =
|
|
2465
|
+
r3 = _nt_single_quoted
|
|
3255
2466
|
if r3
|
|
3256
2467
|
s2 << r3
|
|
3257
2468
|
else
|
|
@@ -3261,20 +2472,20 @@ module EDNGRAMMAR
|
|
|
3261
2472
|
r2 = instantiate_node(SyntaxNode,input, i2...index, s2)
|
|
3262
2473
|
s0 << r2
|
|
3263
2474
|
if r2
|
|
3264
|
-
r4 =
|
|
2475
|
+
r4 = _nt_SQUOTE
|
|
3265
2476
|
s0 << r4
|
|
3266
2477
|
end
|
|
3267
2478
|
end
|
|
3268
2479
|
if s0.last
|
|
3269
2480
|
r0 = instantiate_node(SyntaxNode,input, i0...index, s0)
|
|
3270
|
-
r0.extend(
|
|
3271
|
-
r0.extend(
|
|
2481
|
+
r0.extend(Sqstr0)
|
|
2482
|
+
r0.extend(Sqstr1)
|
|
3272
2483
|
else
|
|
3273
2484
|
@index = i0
|
|
3274
2485
|
r0 = nil
|
|
3275
2486
|
end
|
|
3276
2487
|
|
|
3277
|
-
node_cache[:
|
|
2488
|
+
node_cache[:sqstr][start_index] = r0
|
|
3278
2489
|
|
|
3279
2490
|
r0
|
|
3280
2491
|
end
|
|
@@ -10030,55 +9241,6 @@ module EDNGRAMMAR
|
|
|
10030
9241
|
r0
|
|
10031
9242
|
end
|
|
10032
9243
|
|
|
10033
|
-
module Fitrawdelim0
|
|
10034
|
-
def rawdelim
|
|
10035
|
-
elements[0]
|
|
10036
|
-
end
|
|
10037
|
-
|
|
10038
|
-
end
|
|
10039
|
-
|
|
10040
|
-
def _nt_fitrawdelim
|
|
10041
|
-
start_index = index
|
|
10042
|
-
if node_cache[:fitrawdelim].has_key?(index)
|
|
10043
|
-
cached = node_cache[:fitrawdelim][index]
|
|
10044
|
-
if cached
|
|
10045
|
-
node_cache[:fitrawdelim][index] = cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
|
|
10046
|
-
@index = cached.interval.end
|
|
10047
|
-
end
|
|
10048
|
-
return cached
|
|
10049
|
-
end
|
|
10050
|
-
|
|
10051
|
-
i0, s0 = index, []
|
|
10052
|
-
r1 = _nt_rawdelim
|
|
10053
|
-
s0 << r1
|
|
10054
|
-
if r1
|
|
10055
|
-
i2 = index
|
|
10056
|
-
r3 = lambda {|(rd)|rd.text_value.length == @rawdelimlength}.call(s0)
|
|
10057
|
-
if !r3
|
|
10058
|
-
terminal_parse_failure("<semantic predicate>")
|
|
10059
|
-
end
|
|
10060
|
-
if r3
|
|
10061
|
-
@index = i2
|
|
10062
|
-
r2 = instantiate_node(SyntaxNode,input, index...index)
|
|
10063
|
-
else
|
|
10064
|
-
@index = i2
|
|
10065
|
-
r2 = nil
|
|
10066
|
-
end
|
|
10067
|
-
s0 << r2
|
|
10068
|
-
end
|
|
10069
|
-
if s0.last
|
|
10070
|
-
r0 = instantiate_node(SyntaxNode,input, i0...index, s0)
|
|
10071
|
-
r0.extend(Fitrawdelim0)
|
|
10072
|
-
else
|
|
10073
|
-
@index = i0
|
|
10074
|
-
r0 = nil
|
|
10075
|
-
end
|
|
10076
|
-
|
|
10077
|
-
node_cache[:fitrawdelim][start_index] = r0
|
|
10078
|
-
|
|
10079
|
-
r0
|
|
10080
|
-
end
|
|
10081
|
-
|
|
10082
9244
|
module RhS0
|
|
10083
9245
|
def rh_comment
|
|
10084
9246
|
elements[0]
|
|
@@ -10744,9 +9906,6 @@ module EDNGRAMMAR
|
|
|
10744
9906
|
elements[0]
|
|
10745
9907
|
end
|
|
10746
9908
|
|
|
10747
|
-
def alikerawdelim
|
|
10748
|
-
elements[2]
|
|
10749
|
-
end
|
|
10750
9909
|
end
|
|
10751
9910
|
|
|
10752
9911
|
module RAppStringH5
|
|
@@ -10754,6 +9913,9 @@ module EDNGRAMMAR
|
|
|
10754
9913
|
elements[0]
|
|
10755
9914
|
end
|
|
10756
9915
|
|
|
9916
|
+
def alikerawdelim
|
|
9917
|
+
elements[3]
|
|
9918
|
+
end
|
|
10757
9919
|
end
|
|
10758
9920
|
|
|
10759
9921
|
module RAppStringH6
|
|
@@ -10864,7 +10026,6 @@ module EDNGRAMMAR
|
|
|
10864
10026
|
r2 = instantiate_node(SyntaxNode,input, i2...index, s2)
|
|
10865
10027
|
s0 << r2
|
|
10866
10028
|
if r2
|
|
10867
|
-
i12 = index
|
|
10868
10029
|
i13, s13 = index, []
|
|
10869
10030
|
r14 = _nt_eol_comment
|
|
10870
10031
|
s13 << r14
|
|
@@ -10880,10 +10041,6 @@ module EDNGRAMMAR
|
|
|
10880
10041
|
end
|
|
10881
10042
|
r15 = instantiate_node(SyntaxNode,input, i15...index, s15)
|
|
10882
10043
|
s13 << r15
|
|
10883
|
-
if r15
|
|
10884
|
-
r17 = _nt_alikerawdelim
|
|
10885
|
-
s13 << r17
|
|
10886
|
-
end
|
|
10887
10044
|
end
|
|
10888
10045
|
if s13.last
|
|
10889
10046
|
r13 = instantiate_node(SyntaxNode,input, i13...index, s13)
|
|
@@ -10893,19 +10050,15 @@ module EDNGRAMMAR
|
|
|
10893
10050
|
r13 = nil
|
|
10894
10051
|
end
|
|
10895
10052
|
if r13
|
|
10896
|
-
r13 = SyntaxNode.new(input, (index-1)...index) if r13 == true
|
|
10897
10053
|
r12 = r13
|
|
10898
10054
|
else
|
|
10899
|
-
|
|
10900
|
-
if r18
|
|
10901
|
-
r18 = SyntaxNode.new(input, (index-1)...index) if r18 == true
|
|
10902
|
-
r12 = r18
|
|
10903
|
-
else
|
|
10904
|
-
@index = i12
|
|
10905
|
-
r12 = nil
|
|
10906
|
-
end
|
|
10055
|
+
r12 = instantiate_node(SyntaxNode,input, index...index)
|
|
10907
10056
|
end
|
|
10908
10057
|
s0 << r12
|
|
10058
|
+
if r12
|
|
10059
|
+
r17 = _nt_alikerawdelim
|
|
10060
|
+
s0 << r17
|
|
10061
|
+
end
|
|
10909
10062
|
end
|
|
10910
10063
|
end
|
|
10911
10064
|
if s0.last
|
|
@@ -11608,9 +10761,6 @@ module EDNGRAMMAR
|
|
|
11608
10761
|
end
|
|
11609
10762
|
|
|
11610
10763
|
module RAppStringB644
|
|
11611
|
-
def alikerawdelim
|
|
11612
|
-
elements[2]
|
|
11613
|
-
end
|
|
11614
10764
|
end
|
|
11615
10765
|
|
|
11616
10766
|
module RAppStringB645
|
|
@@ -11618,9 +10768,13 @@ module EDNGRAMMAR
|
|
|
11618
10768
|
elements[0]
|
|
11619
10769
|
end
|
|
11620
10770
|
|
|
10771
|
+
def alikerawdelim
|
|
10772
|
+
elements[4]
|
|
10773
|
+
end
|
|
11621
10774
|
end
|
|
11622
10775
|
|
|
11623
10776
|
module RAppStringB646
|
|
10777
|
+
|
|
11624
10778
|
def ast
|
|
11625
10779
|
v = elements[0..2].map {|part| part.text_value}.join
|
|
11626
10780
|
t = v.gsub(/\s|#[^\n]*(?:\n|\z)/, '').chars.each_slice(4).map(&:join)
|
|
@@ -11809,7 +10963,6 @@ module EDNGRAMMAR
|
|
|
11809
10963
|
end
|
|
11810
10964
|
s0 << r7
|
|
11811
10965
|
if r7
|
|
11812
|
-
i25 = index
|
|
11813
10966
|
i26, s26 = index, []
|
|
11814
10967
|
if (match_len = has_terminal?("#", false, index))
|
|
11815
10968
|
r27 = true
|
|
@@ -11831,10 +10984,6 @@ module EDNGRAMMAR
|
|
|
11831
10984
|
end
|
|
11832
10985
|
r28 = instantiate_node(SyntaxNode,input, i28...index, s28)
|
|
11833
10986
|
s26 << r28
|
|
11834
|
-
if r28
|
|
11835
|
-
r30 = _nt_alikerawdelim
|
|
11836
|
-
s26 << r30
|
|
11837
|
-
end
|
|
11838
10987
|
end
|
|
11839
10988
|
if s26.last
|
|
11840
10989
|
r26 = instantiate_node(SyntaxNode,input, i26...index, s26)
|
|
@@ -11844,19 +10993,15 @@ module EDNGRAMMAR
|
|
|
11844
10993
|
r26 = nil
|
|
11845
10994
|
end
|
|
11846
10995
|
if r26
|
|
11847
|
-
r26 = SyntaxNode.new(input, (index-1)...index) if r26 == true
|
|
11848
10996
|
r25 = r26
|
|
11849
10997
|
else
|
|
11850
|
-
|
|
11851
|
-
if r31
|
|
11852
|
-
r31 = SyntaxNode.new(input, (index-1)...index) if r31 == true
|
|
11853
|
-
r25 = r31
|
|
11854
|
-
else
|
|
11855
|
-
@index = i25
|
|
11856
|
-
r25 = nil
|
|
11857
|
-
end
|
|
10998
|
+
r25 = instantiate_node(SyntaxNode,input, index...index)
|
|
11858
10999
|
end
|
|
11859
11000
|
s0 << r25
|
|
11001
|
+
if r25
|
|
11002
|
+
r30 = _nt_alikerawdelim
|
|
11003
|
+
s0 << r30
|
|
11004
|
+
end
|
|
11860
11005
|
end
|
|
11861
11006
|
end
|
|
11862
11007
|
end
|