edn-abnf 0.5.43 → 0.5.45
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/bin/edn-abnf +6 -1
- data/edn-abnf.gemspec +1 -1
- data/lib/cbor-diagnostic-app/h.rb +7 -0
- data/lib/cbor-diagnostic-app/hgrammar.rb +1 -1
- data/lib/edn-abnf.rb +2 -1
- data/lib/parser/edn-util.rb +7 -0
- data/lib/parser/edngrammar.rb +338 -92
- 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: 387d30122d152d5ff18c6e6c54b799e116de77aac0322668997b2d1c0fd121a6
|
|
4
|
+
data.tar.gz: 6a15cfd8406ab50fd809781d87126d9e2cbc47072d79617069b4fc42627259b2
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 383edc7befdc01f8ced4305c8cfe48eea3fff2b70128a119239c54262a08c0a7fd13e24c5e62c0c329b3c739ad7e643ebabafa2fc15d37739f794c612aa87d2e
|
|
7
|
+
data.tar.gz: c1dab33f80321f63b56226e1783cef132a158aaf05da077e355168fd0c1609e0bf49e9302f544d921def3a919f373c2ba30db5ab3db0e87d472fb80b08c7fb2e
|
data/bin/edn-abnf
CHANGED
|
@@ -35,7 +35,7 @@ require 'ostruct'
|
|
|
35
35
|
|
|
36
36
|
$error = 0
|
|
37
37
|
|
|
38
|
-
output_formats = [:basic, :neat, :json, :yaml, :edn, :diag, :pretty, :hex, :cbor, :"test-vector"]
|
|
38
|
+
output_formats = [:basic, :neat, :json, :yaml, :edn, :diag, :pretty, :hex, :cbor, :"test-vector", :feat]
|
|
39
39
|
|
|
40
40
|
$options = OpenStruct.new
|
|
41
41
|
begin
|
|
@@ -118,7 +118,10 @@ rescue Exception => e
|
|
|
118
118
|
exit 1
|
|
119
119
|
end
|
|
120
120
|
|
|
121
|
+
$feat = Set[]
|
|
122
|
+
|
|
121
123
|
if !$options.edn
|
|
124
|
+
$fn = ARGV.join(";")
|
|
122
125
|
ARGF.binmode if $options.cbor
|
|
123
126
|
$options.edn = ARGF.read
|
|
124
127
|
else
|
|
@@ -218,6 +221,8 @@ rescue CBOR::OutOfBytesError, RuntimeError, JSON::GeneratorError => e
|
|
|
218
221
|
end
|
|
219
222
|
|
|
220
223
|
case $options.target
|
|
224
|
+
when :feat
|
|
225
|
+
puts [$fn, $feat.to_a.join(",")].join(":")
|
|
221
226
|
when :basic
|
|
222
227
|
pp result
|
|
223
228
|
when :neat, :json
|
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.45"
|
|
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"
|
|
@@ -4,6 +4,13 @@ class CBOR_DIAG::App_h
|
|
|
4
4
|
def self.decode(prefix, s)
|
|
5
5
|
parser = HGRAMMARParser.new
|
|
6
6
|
s = EDN.to_one_string(prefix, s)
|
|
7
|
+
s.scan(/#.*|\s|\/[^\/]*\//).each do |comment|
|
|
8
|
+
case comment
|
|
9
|
+
in /\A\s\z/; $feat << :h_comment_space
|
|
10
|
+
in /\A#.*\z/; $feat << :h_comment_hash
|
|
11
|
+
in /\A\/[^\/]*\/\z/; $feat << :h_comment_slash
|
|
12
|
+
end
|
|
13
|
+
end
|
|
7
14
|
ast = parser.parse(s)
|
|
8
15
|
if !ast
|
|
9
16
|
raise CBOR_DIAG::AppParseError.new("cbor-diagnostic: Parse Error in h'#{s}':\n" << EDN.reason(parser, s), parser.failure_index)
|
data/lib/edn-abnf.rb
CHANGED
|
@@ -29,8 +29,9 @@ class EDN
|
|
|
29
29
|
s = s.to_str
|
|
30
30
|
ast = @@parser.parse s
|
|
31
31
|
if !ast
|
|
32
|
-
raise ArgumentError, "Parse Error:\n" << self.reason(@@parser, s)
|
|
32
|
+
raise ArgumentError, "Parse Error#{$fn ? " " + $fn.inspect : ""}:\n" << self.reason(@@parser, s)
|
|
33
33
|
end
|
|
34
|
+
ast.count_feat
|
|
34
35
|
ret = EDN.new(ast)
|
|
35
36
|
ret
|
|
36
37
|
end
|
data/lib/parser/edn-util.rb
CHANGED
data/lib/parser/edngrammar.rb
CHANGED
|
@@ -215,7 +215,7 @@ module EDNGRAMMAR
|
|
|
215
215
|
r10 = SyntaxNode.new(input, (index-1)...index) if r10 == true
|
|
216
216
|
r0 = r10
|
|
217
217
|
else
|
|
218
|
-
r11 =
|
|
218
|
+
r11 = _nt_ellipsis_meas
|
|
219
219
|
if r11
|
|
220
220
|
r11 = SyntaxNode.new(input, (index-1)...index) if r11 == true
|
|
221
221
|
r0 = r11
|
|
@@ -240,6 +240,52 @@ module EDNGRAMMAR
|
|
|
240
240
|
r0
|
|
241
241
|
end
|
|
242
242
|
|
|
243
|
+
module EllipsisMeas0
|
|
244
|
+
def ellipsis
|
|
245
|
+
elements[0]
|
|
246
|
+
end
|
|
247
|
+
|
|
248
|
+
def epsilon
|
|
249
|
+
elements[1]
|
|
250
|
+
end
|
|
251
|
+
end
|
|
252
|
+
|
|
253
|
+
module EllipsisMeas1
|
|
254
|
+
def ast; $feat << :ellipsis_outside; ellipsis.ast end
|
|
255
|
+
end
|
|
256
|
+
|
|
257
|
+
def _nt_ellipsis_meas
|
|
258
|
+
start_index = index
|
|
259
|
+
if node_cache[:ellipsis_meas].has_key?(index)
|
|
260
|
+
cached = node_cache[:ellipsis_meas][index]
|
|
261
|
+
if cached
|
|
262
|
+
node_cache[:ellipsis_meas][index] = cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
|
|
263
|
+
@index = cached.interval.end
|
|
264
|
+
end
|
|
265
|
+
return cached
|
|
266
|
+
end
|
|
267
|
+
|
|
268
|
+
i0, s0 = index, []
|
|
269
|
+
r1 = _nt_ellipsis
|
|
270
|
+
s0 << r1
|
|
271
|
+
if r1
|
|
272
|
+
r2 = _nt_epsilon
|
|
273
|
+
s0 << r2
|
|
274
|
+
end
|
|
275
|
+
if s0.last
|
|
276
|
+
r0 = instantiate_node(SyntaxNode,input, i0...index, s0)
|
|
277
|
+
r0.extend(EllipsisMeas0)
|
|
278
|
+
r0.extend(EllipsisMeas1)
|
|
279
|
+
else
|
|
280
|
+
@index = i0
|
|
281
|
+
r0 = nil
|
|
282
|
+
end
|
|
283
|
+
|
|
284
|
+
node_cache[:ellipsis_meas][start_index] = r0
|
|
285
|
+
|
|
286
|
+
r0
|
|
287
|
+
end
|
|
288
|
+
|
|
243
289
|
def _nt_number
|
|
244
290
|
start_index = index
|
|
245
291
|
if node_cache[:number].has_key?(index)
|
|
@@ -341,6 +387,10 @@ module EDNGRAMMAR
|
|
|
341
387
|
end
|
|
342
388
|
|
|
343
389
|
module Decnumber0
|
|
390
|
+
def DIGIT1
|
|
391
|
+
elements[0]
|
|
392
|
+
end
|
|
393
|
+
|
|
344
394
|
end
|
|
345
395
|
|
|
346
396
|
module Decnumber1
|
|
@@ -356,6 +406,9 @@ module EDNGRAMMAR
|
|
|
356
406
|
end
|
|
357
407
|
|
|
358
408
|
module Decnumber5
|
|
409
|
+
end
|
|
410
|
+
|
|
411
|
+
module Decnumber6
|
|
359
412
|
def ast
|
|
360
413
|
tv = text_value
|
|
361
414
|
if /[.e]/i =~ tv
|
|
@@ -391,62 +444,90 @@ module EDNGRAMMAR
|
|
|
391
444
|
if r1
|
|
392
445
|
i3 = index
|
|
393
446
|
i4, s4 = index, []
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
r6 =
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
end
|
|
447
|
+
i5 = index
|
|
448
|
+
if (match_len = has_terminal?("0", false, index))
|
|
449
|
+
r6 = true
|
|
450
|
+
@index += match_len
|
|
451
|
+
else
|
|
452
|
+
terminal_parse_failure('"0"')
|
|
453
|
+
r6 = nil
|
|
402
454
|
end
|
|
403
|
-
if
|
|
404
|
-
|
|
405
|
-
r5 =
|
|
455
|
+
if r6
|
|
456
|
+
r6 = SyntaxNode.new(input, (index-1)...index) if r6 == true
|
|
457
|
+
r5 = r6
|
|
406
458
|
else
|
|
407
|
-
|
|
459
|
+
i7, s7 = index, []
|
|
460
|
+
r8 = _nt_DIGIT1
|
|
461
|
+
s7 << r8
|
|
462
|
+
if r8
|
|
463
|
+
s9, i9 = [], index
|
|
464
|
+
loop do
|
|
465
|
+
r10 = _nt_DIGIT
|
|
466
|
+
if r10
|
|
467
|
+
s9 << r10
|
|
468
|
+
else
|
|
469
|
+
break
|
|
470
|
+
end
|
|
471
|
+
end
|
|
472
|
+
r9 = instantiate_node(SyntaxNode,input, i9...index, s9)
|
|
473
|
+
s7 << r9
|
|
474
|
+
end
|
|
475
|
+
if s7.last
|
|
476
|
+
r7 = instantiate_node(SyntaxNode,input, i7...index, s7)
|
|
477
|
+
r7.extend(Decnumber0)
|
|
478
|
+
else
|
|
479
|
+
@index = i7
|
|
480
|
+
r7 = nil
|
|
481
|
+
end
|
|
482
|
+
if r7
|
|
483
|
+
r7 = SyntaxNode.new(input, (index-1)...index) if r7 == true
|
|
484
|
+
r5 = r7
|
|
485
|
+
else
|
|
486
|
+
@index = i5
|
|
487
|
+
r5 = nil
|
|
488
|
+
end
|
|
408
489
|
end
|
|
409
490
|
s4 << r5
|
|
410
491
|
if r5
|
|
411
|
-
|
|
492
|
+
i12, s12 = index, []
|
|
412
493
|
if (match_len = has_terminal?(".", false, index))
|
|
413
|
-
|
|
494
|
+
r13 = true
|
|
414
495
|
@index += match_len
|
|
415
496
|
else
|
|
416
497
|
terminal_parse_failure('"."')
|
|
417
|
-
|
|
498
|
+
r13 = nil
|
|
418
499
|
end
|
|
419
|
-
|
|
420
|
-
if
|
|
421
|
-
|
|
500
|
+
s12 << r13
|
|
501
|
+
if r13
|
|
502
|
+
s14, i14 = [], index
|
|
422
503
|
loop do
|
|
423
|
-
|
|
424
|
-
if
|
|
425
|
-
|
|
504
|
+
r15 = _nt_DIGIT
|
|
505
|
+
if r15
|
|
506
|
+
s14 << r15
|
|
426
507
|
else
|
|
427
508
|
break
|
|
428
509
|
end
|
|
429
510
|
end
|
|
430
|
-
|
|
431
|
-
|
|
511
|
+
r14 = instantiate_node(SyntaxNode,input, i14...index, s14)
|
|
512
|
+
s12 << r14
|
|
432
513
|
end
|
|
433
|
-
if
|
|
434
|
-
|
|
435
|
-
|
|
514
|
+
if s12.last
|
|
515
|
+
r12 = instantiate_node(SyntaxNode,input, i12...index, s12)
|
|
516
|
+
r12.extend(Decnumber1)
|
|
436
517
|
else
|
|
437
|
-
@index =
|
|
438
|
-
|
|
518
|
+
@index = i12
|
|
519
|
+
r12 = nil
|
|
439
520
|
end
|
|
440
|
-
if
|
|
441
|
-
|
|
521
|
+
if r12
|
|
522
|
+
r11 = r12
|
|
442
523
|
else
|
|
443
|
-
|
|
524
|
+
r11 = instantiate_node(SyntaxNode,input, index...index)
|
|
444
525
|
end
|
|
445
|
-
s4 <<
|
|
526
|
+
s4 << r11
|
|
446
527
|
end
|
|
447
528
|
if s4.last
|
|
448
529
|
r4 = instantiate_node(SyntaxNode,input, i4...index, s4)
|
|
449
|
-
r4.extend(
|
|
530
|
+
r4.extend(Decnumber2)
|
|
450
531
|
else
|
|
451
532
|
@index = i4
|
|
452
533
|
r4 = nil
|
|
@@ -455,43 +536,43 @@ module EDNGRAMMAR
|
|
|
455
536
|
r4 = SyntaxNode.new(input, (index-1)...index) if r4 == true
|
|
456
537
|
r3 = r4
|
|
457
538
|
else
|
|
458
|
-
|
|
539
|
+
i16, s16 = index, []
|
|
459
540
|
if (match_len = has_terminal?(".", false, index))
|
|
460
|
-
|
|
541
|
+
r17 = true
|
|
461
542
|
@index += match_len
|
|
462
543
|
else
|
|
463
544
|
terminal_parse_failure('"."')
|
|
464
|
-
|
|
545
|
+
r17 = nil
|
|
465
546
|
end
|
|
466
|
-
|
|
467
|
-
if
|
|
468
|
-
|
|
547
|
+
s16 << r17
|
|
548
|
+
if r17
|
|
549
|
+
s18, i18 = [], index
|
|
469
550
|
loop do
|
|
470
|
-
|
|
471
|
-
if
|
|
472
|
-
|
|
551
|
+
r19 = _nt_DIGIT
|
|
552
|
+
if r19
|
|
553
|
+
s18 << r19
|
|
473
554
|
else
|
|
474
555
|
break
|
|
475
556
|
end
|
|
476
557
|
end
|
|
477
|
-
if
|
|
478
|
-
@index =
|
|
479
|
-
|
|
558
|
+
if s18.empty?
|
|
559
|
+
@index = i18
|
|
560
|
+
r18 = nil
|
|
480
561
|
else
|
|
481
|
-
|
|
562
|
+
r18 = instantiate_node(SyntaxNode,input, i18...index, s18)
|
|
482
563
|
end
|
|
483
|
-
|
|
564
|
+
s16 << r18
|
|
484
565
|
end
|
|
485
|
-
if
|
|
486
|
-
|
|
487
|
-
|
|
566
|
+
if s16.last
|
|
567
|
+
r16 = instantiate_node(SyntaxNode,input, i16...index, s16)
|
|
568
|
+
r16.extend(Decnumber3)
|
|
488
569
|
else
|
|
489
|
-
@index =
|
|
490
|
-
|
|
570
|
+
@index = i16
|
|
571
|
+
r16 = nil
|
|
491
572
|
end
|
|
492
|
-
if
|
|
493
|
-
|
|
494
|
-
r3 =
|
|
573
|
+
if r16
|
|
574
|
+
r16 = SyntaxNode.new(input, (index-1)...index) if r16 == true
|
|
575
|
+
r3 = r16
|
|
495
576
|
else
|
|
496
577
|
@index = i3
|
|
497
578
|
r3 = nil
|
|
@@ -499,61 +580,61 @@ module EDNGRAMMAR
|
|
|
499
580
|
end
|
|
500
581
|
s0 << r3
|
|
501
582
|
if r3
|
|
502
|
-
|
|
583
|
+
i21, s21 = index, []
|
|
503
584
|
if (match_len = has_terminal?("e", :insens, index))
|
|
504
|
-
|
|
585
|
+
r22 = instantiate_node(SyntaxNode,input, index...(index + match_len))
|
|
505
586
|
@index += match_len
|
|
506
587
|
else
|
|
507
588
|
terminal_parse_failure('"e"')
|
|
508
|
-
|
|
589
|
+
r22 = nil
|
|
509
590
|
end
|
|
510
|
-
|
|
511
|
-
if
|
|
512
|
-
|
|
513
|
-
if
|
|
514
|
-
|
|
591
|
+
s21 << r22
|
|
592
|
+
if r22
|
|
593
|
+
r24 = _nt_sign
|
|
594
|
+
if r24
|
|
595
|
+
r23 = r24
|
|
515
596
|
else
|
|
516
|
-
|
|
597
|
+
r23 = instantiate_node(SyntaxNode,input, index...index)
|
|
517
598
|
end
|
|
518
|
-
|
|
519
|
-
if
|
|
520
|
-
|
|
599
|
+
s21 << r23
|
|
600
|
+
if r23
|
|
601
|
+
s25, i25 = [], index
|
|
521
602
|
loop do
|
|
522
|
-
|
|
523
|
-
if
|
|
524
|
-
|
|
603
|
+
r26 = _nt_DIGIT
|
|
604
|
+
if r26
|
|
605
|
+
s25 << r26
|
|
525
606
|
else
|
|
526
607
|
break
|
|
527
608
|
end
|
|
528
609
|
end
|
|
529
|
-
if
|
|
530
|
-
@index =
|
|
531
|
-
|
|
610
|
+
if s25.empty?
|
|
611
|
+
@index = i25
|
|
612
|
+
r25 = nil
|
|
532
613
|
else
|
|
533
|
-
|
|
614
|
+
r25 = instantiate_node(SyntaxNode,input, i25...index, s25)
|
|
534
615
|
end
|
|
535
|
-
|
|
616
|
+
s21 << r25
|
|
536
617
|
end
|
|
537
618
|
end
|
|
538
|
-
if
|
|
539
|
-
|
|
540
|
-
|
|
619
|
+
if s21.last
|
|
620
|
+
r21 = instantiate_node(SyntaxNode,input, i21...index, s21)
|
|
621
|
+
r21.extend(Decnumber4)
|
|
541
622
|
else
|
|
542
|
-
@index =
|
|
543
|
-
|
|
623
|
+
@index = i21
|
|
624
|
+
r21 = nil
|
|
544
625
|
end
|
|
545
|
-
if
|
|
546
|
-
|
|
626
|
+
if r21
|
|
627
|
+
r20 = r21
|
|
547
628
|
else
|
|
548
|
-
|
|
629
|
+
r20 = instantiate_node(SyntaxNode,input, index...index)
|
|
549
630
|
end
|
|
550
|
-
s0 <<
|
|
631
|
+
s0 << r20
|
|
551
632
|
end
|
|
552
633
|
end
|
|
553
634
|
if s0.last
|
|
554
635
|
r0 = instantiate_node(SyntaxNode,input, i0...index, s0)
|
|
555
|
-
r0.extend(Decnumber4)
|
|
556
636
|
r0.extend(Decnumber5)
|
|
637
|
+
r0.extend(Decnumber6)
|
|
557
638
|
else
|
|
558
639
|
@index = i0
|
|
559
640
|
r0 = nil
|
|
@@ -577,7 +658,7 @@ module EDNGRAMMAR
|
|
|
577
658
|
end
|
|
578
659
|
|
|
579
660
|
module Hexfloat4
|
|
580
|
-
def ast; Float(text_value.sub(/x\./i, "x0.").sub(/\.p/i, ".0p")) end
|
|
661
|
+
def ast; $feat << :hex_float; Float(text_value.sub(/x\./i, "x0.").sub(/\.p/i, ".0p")) end
|
|
581
662
|
end
|
|
582
663
|
|
|
583
664
|
def _nt_hexfloat
|
|
@@ -775,7 +856,7 @@ module EDNGRAMMAR
|
|
|
775
856
|
end
|
|
776
857
|
|
|
777
858
|
module Hexint1
|
|
778
|
-
def ast; Integer(text_value) end
|
|
859
|
+
def ast; $feat << :hex_int; Integer(text_value) end
|
|
779
860
|
end
|
|
780
861
|
|
|
781
862
|
def _nt_hexint
|
|
@@ -843,7 +924,7 @@ module EDNGRAMMAR
|
|
|
843
924
|
end
|
|
844
925
|
|
|
845
926
|
module Octint1
|
|
846
|
-
def ast; Integer(text_value) end
|
|
927
|
+
def ast; $feat << :oct_int; Integer(text_value) end
|
|
847
928
|
end
|
|
848
929
|
|
|
849
930
|
def _nt_octint
|
|
@@ -911,7 +992,7 @@ module EDNGRAMMAR
|
|
|
911
992
|
end
|
|
912
993
|
|
|
913
994
|
module Binint1
|
|
914
|
-
def ast; Integer(text_value) end
|
|
995
|
+
def ast; $feat << :bin_int; Integer(text_value) end
|
|
915
996
|
end
|
|
916
997
|
|
|
917
998
|
def _nt_binint
|
|
@@ -1046,6 +1127,158 @@ module EDNGRAMMAR
|
|
|
1046
1127
|
r0
|
|
1047
1128
|
end
|
|
1048
1129
|
|
|
1130
|
+
module Epsilon0
|
|
1131
|
+
end
|
|
1132
|
+
|
|
1133
|
+
def _nt_epsilon
|
|
1134
|
+
start_index = index
|
|
1135
|
+
if node_cache[:epsilon].has_key?(index)
|
|
1136
|
+
cached = node_cache[:epsilon][index]
|
|
1137
|
+
if cached
|
|
1138
|
+
node_cache[:epsilon][index] = cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
|
|
1139
|
+
@index = cached.interval.end
|
|
1140
|
+
end
|
|
1141
|
+
return cached
|
|
1142
|
+
end
|
|
1143
|
+
|
|
1144
|
+
i0, s0 = index, []
|
|
1145
|
+
s1, i1 = [], index
|
|
1146
|
+
loop do
|
|
1147
|
+
if (match_len = has_terminal?("@", false, index))
|
|
1148
|
+
r2 = true
|
|
1149
|
+
@index += match_len
|
|
1150
|
+
else
|
|
1151
|
+
terminal_parse_failure('"@"')
|
|
1152
|
+
r2 = nil
|
|
1153
|
+
end
|
|
1154
|
+
if r2
|
|
1155
|
+
s1 << r2
|
|
1156
|
+
else
|
|
1157
|
+
break
|
|
1158
|
+
end
|
|
1159
|
+
end
|
|
1160
|
+
r1 = instantiate_node(SyntaxNode,input, i1...index, s1)
|
|
1161
|
+
s0 << r1
|
|
1162
|
+
if r1
|
|
1163
|
+
i3 = index
|
|
1164
|
+
r4 = lambda {|(x)|x.text_value.length == 0}.call(s0)
|
|
1165
|
+
if !r4
|
|
1166
|
+
terminal_parse_failure("<semantic predicate>")
|
|
1167
|
+
end
|
|
1168
|
+
if r4
|
|
1169
|
+
@index = i3
|
|
1170
|
+
r3 = instantiate_node(SyntaxNode,input, index...index)
|
|
1171
|
+
else
|
|
1172
|
+
@index = i3
|
|
1173
|
+
r3 = nil
|
|
1174
|
+
end
|
|
1175
|
+
s0 << r3
|
|
1176
|
+
end
|
|
1177
|
+
if s0.last
|
|
1178
|
+
r0 = instantiate_node(SyntaxNode,input, i0...index, s0)
|
|
1179
|
+
r0.extend(Epsilon0)
|
|
1180
|
+
else
|
|
1181
|
+
@index = i0
|
|
1182
|
+
r0 = nil
|
|
1183
|
+
end
|
|
1184
|
+
|
|
1185
|
+
node_cache[:epsilon][start_index] = r0
|
|
1186
|
+
|
|
1187
|
+
r0
|
|
1188
|
+
end
|
|
1189
|
+
|
|
1190
|
+
module SqstrMeas0
|
|
1191
|
+
def sqstr
|
|
1192
|
+
elements[0]
|
|
1193
|
+
end
|
|
1194
|
+
|
|
1195
|
+
def epsilon
|
|
1196
|
+
elements[1]
|
|
1197
|
+
end
|
|
1198
|
+
end
|
|
1199
|
+
|
|
1200
|
+
module SqstrMeas1
|
|
1201
|
+
def ast; $feat << :unprefixed_sqstr; sqstr.ast end
|
|
1202
|
+
end
|
|
1203
|
+
|
|
1204
|
+
def _nt_sqstr_meas
|
|
1205
|
+
start_index = index
|
|
1206
|
+
if node_cache[:sqstr_meas].has_key?(index)
|
|
1207
|
+
cached = node_cache[:sqstr_meas][index]
|
|
1208
|
+
if cached
|
|
1209
|
+
node_cache[:sqstr_meas][index] = cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
|
|
1210
|
+
@index = cached.interval.end
|
|
1211
|
+
end
|
|
1212
|
+
return cached
|
|
1213
|
+
end
|
|
1214
|
+
|
|
1215
|
+
i0, s0 = index, []
|
|
1216
|
+
r1 = _nt_sqstr
|
|
1217
|
+
s0 << r1
|
|
1218
|
+
if r1
|
|
1219
|
+
r2 = _nt_epsilon
|
|
1220
|
+
s0 << r2
|
|
1221
|
+
end
|
|
1222
|
+
if s0.last
|
|
1223
|
+
r0 = instantiate_node(SyntaxNode,input, i0...index, s0)
|
|
1224
|
+
r0.extend(SqstrMeas0)
|
|
1225
|
+
r0.extend(SqstrMeas1)
|
|
1226
|
+
else
|
|
1227
|
+
@index = i0
|
|
1228
|
+
r0 = nil
|
|
1229
|
+
end
|
|
1230
|
+
|
|
1231
|
+
node_cache[:sqstr_meas][start_index] = r0
|
|
1232
|
+
|
|
1233
|
+
r0
|
|
1234
|
+
end
|
|
1235
|
+
|
|
1236
|
+
module EmbeddedMeas0
|
|
1237
|
+
def embedded
|
|
1238
|
+
elements[0]
|
|
1239
|
+
end
|
|
1240
|
+
|
|
1241
|
+
def epsilon
|
|
1242
|
+
elements[1]
|
|
1243
|
+
end
|
|
1244
|
+
end
|
|
1245
|
+
|
|
1246
|
+
module EmbeddedMeas1
|
|
1247
|
+
def ast; $feat << :embedded_cbor; embedded.ast end
|
|
1248
|
+
end
|
|
1249
|
+
|
|
1250
|
+
def _nt_embedded_meas
|
|
1251
|
+
start_index = index
|
|
1252
|
+
if node_cache[:embedded_meas].has_key?(index)
|
|
1253
|
+
cached = node_cache[:embedded_meas][index]
|
|
1254
|
+
if cached
|
|
1255
|
+
node_cache[:embedded_meas][index] = cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
|
|
1256
|
+
@index = cached.interval.end
|
|
1257
|
+
end
|
|
1258
|
+
return cached
|
|
1259
|
+
end
|
|
1260
|
+
|
|
1261
|
+
i0, s0 = index, []
|
|
1262
|
+
r1 = _nt_embedded
|
|
1263
|
+
s0 << r1
|
|
1264
|
+
if r1
|
|
1265
|
+
r2 = _nt_epsilon
|
|
1266
|
+
s0 << r2
|
|
1267
|
+
end
|
|
1268
|
+
if s0.last
|
|
1269
|
+
r0 = instantiate_node(SyntaxNode,input, i0...index, s0)
|
|
1270
|
+
r0.extend(EmbeddedMeas0)
|
|
1271
|
+
r0.extend(EmbeddedMeas1)
|
|
1272
|
+
else
|
|
1273
|
+
@index = i0
|
|
1274
|
+
r0 = nil
|
|
1275
|
+
end
|
|
1276
|
+
|
|
1277
|
+
node_cache[:embedded_meas][start_index] = r0
|
|
1278
|
+
|
|
1279
|
+
r0
|
|
1280
|
+
end
|
|
1281
|
+
|
|
1049
1282
|
def _nt_string
|
|
1050
1283
|
start_index = index
|
|
1051
1284
|
if node_cache[:string].has_key?(index)
|
|
@@ -1068,12 +1301,12 @@ module EDNGRAMMAR
|
|
|
1068
1301
|
r2 = SyntaxNode.new(input, (index-1)...index) if r2 == true
|
|
1069
1302
|
r0 = r2
|
|
1070
1303
|
else
|
|
1071
|
-
r3 =
|
|
1304
|
+
r3 = _nt_sqstr_meas
|
|
1072
1305
|
if r3
|
|
1073
1306
|
r3 = SyntaxNode.new(input, (index-1)...index) if r3 == true
|
|
1074
1307
|
r0 = r3
|
|
1075
1308
|
else
|
|
1076
|
-
r4 =
|
|
1309
|
+
r4 = _nt_embedded_meas
|
|
1077
1310
|
if r4
|
|
1078
1311
|
r4 = SyntaxNode.new(input, (index-1)...index) if r4 == true
|
|
1079
1312
|
r0 = r4
|
|
@@ -3816,6 +4049,10 @@ module EDNGRAMMAR
|
|
|
3816
4049
|
|
|
3817
4050
|
end
|
|
3818
4051
|
|
|
4052
|
+
module MSC3
|
|
4053
|
+
def count_feat; $feat << :msc_spaced unless text_value.index(",") end
|
|
4054
|
+
end
|
|
4055
|
+
|
|
3819
4056
|
def _nt_MSC
|
|
3820
4057
|
start_index = index
|
|
3821
4058
|
if node_cache[:MSC].has_key?(index)
|
|
@@ -3851,6 +4088,8 @@ module EDNGRAMMAR
|
|
|
3851
4088
|
if r1
|
|
3852
4089
|
r1 = SyntaxNode.new(input, (index-1)...index) if r1 == true
|
|
3853
4090
|
r0 = r1
|
|
4091
|
+
r0.extend(MSC3)
|
|
4092
|
+
r0.extend(MSC3)
|
|
3854
4093
|
else
|
|
3855
4094
|
i4, s4 = index, []
|
|
3856
4095
|
r5 = _nt_MS
|
|
@@ -3893,6 +4132,8 @@ module EDNGRAMMAR
|
|
|
3893
4132
|
if r4
|
|
3894
4133
|
r4 = SyntaxNode.new(input, (index-1)...index) if r4 == true
|
|
3895
4134
|
r0 = r4
|
|
4135
|
+
r0.extend(MSC3)
|
|
4136
|
+
r0.extend(MSC3)
|
|
3896
4137
|
else
|
|
3897
4138
|
@index = i0
|
|
3898
4139
|
r0 = nil
|
|
@@ -3917,6 +4158,10 @@ module EDNGRAMMAR
|
|
|
3917
4158
|
|
|
3918
4159
|
end
|
|
3919
4160
|
|
|
4161
|
+
module SOC2
|
|
4162
|
+
def count_feat; $feat << :soc_included if text_value.index(",") end
|
|
4163
|
+
end
|
|
4164
|
+
|
|
3920
4165
|
def _nt_SOC
|
|
3921
4166
|
start_index = index
|
|
3922
4167
|
if node_cache[:SOC].has_key?(index)
|
|
@@ -3962,6 +4207,7 @@ module EDNGRAMMAR
|
|
|
3962
4207
|
if s0.last
|
|
3963
4208
|
r0 = instantiate_node(SyntaxNode,input, i0...index, s0)
|
|
3964
4209
|
r0.extend(SOC1)
|
|
4210
|
+
r0.extend(SOC2)
|
|
3965
4211
|
else
|
|
3966
4212
|
@index = i0
|
|
3967
4213
|
r0 = nil
|