edn-abnf 0.0.5 → 0.0.6
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/edn-abnf.gemspec +1 -1
- data/lib/parser/edngrammar.rb +142 -86
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 119b776b0bf643c32c9c0c2481b654e3087d0a7747f0a3f9bf9ae2460837a67a
|
4
|
+
data.tar.gz: bc7545b0786eeae5f5d33c6b95b702fe383ccdc306ecc5370e932413e089838e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e5c9dd0f7c19367133392c803bdf4719d6e0ec45d49d74c3fc05bb59e2d38e6ce0ffe38f17c0610c454783b795d5528e3bb030f32b452df9a802cbd447fc4c13
|
7
|
+
data.tar.gz: 994b84d2f1e90643aacfb3ef117d150bafbbd2a28f63057f25b51d5a1222d5a222a5d7fd8c77c83232c28e7378084bfaccc0d04db3e0f60eafecca7ed2eecb86
|
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.0.
|
3
|
+
s.version = "0.0.6"
|
4
4
|
s.summary = "CDDL (Concise Data Definition Language) converters and miscellaneous tools"
|
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
@@ -469,7 +469,13 @@ module EDNGRAMMAR
|
|
469
469
|
end
|
470
470
|
|
471
471
|
module Basenumber4
|
472
|
-
|
472
|
+
end
|
473
|
+
|
474
|
+
module Basenumber5
|
475
|
+
end
|
476
|
+
|
477
|
+
module Basenumber6
|
478
|
+
def ast; /p/i =~ text_value ? Float(text_value) : Integer(text_value) end
|
473
479
|
end
|
474
480
|
|
475
481
|
def _nt_basenumber
|
@@ -528,10 +534,98 @@ module EDNGRAMMAR
|
|
528
534
|
r7 = instantiate_node(SyntaxNode,input, i7...index, s7)
|
529
535
|
end
|
530
536
|
s5 << r7
|
537
|
+
if r7
|
538
|
+
i10, s10 = index, []
|
539
|
+
i12, s12 = index, []
|
540
|
+
if (match_len = has_terminal?(".", false, index))
|
541
|
+
r13 = true
|
542
|
+
@index += match_len
|
543
|
+
else
|
544
|
+
terminal_parse_failure('"."')
|
545
|
+
r13 = nil
|
546
|
+
end
|
547
|
+
s12 << r13
|
548
|
+
if r13
|
549
|
+
s14, i14 = [], index
|
550
|
+
loop do
|
551
|
+
r15 = _nt_HEXDIG
|
552
|
+
if r15
|
553
|
+
s14 << r15
|
554
|
+
else
|
555
|
+
break
|
556
|
+
end
|
557
|
+
end
|
558
|
+
if s14.empty?
|
559
|
+
@index = i14
|
560
|
+
r14 = nil
|
561
|
+
else
|
562
|
+
r14 = instantiate_node(SyntaxNode,input, i14...index, s14)
|
563
|
+
end
|
564
|
+
s12 << r14
|
565
|
+
end
|
566
|
+
if s12.last
|
567
|
+
r12 = instantiate_node(SyntaxNode,input, i12...index, s12)
|
568
|
+
r12.extend(Basenumber0)
|
569
|
+
else
|
570
|
+
@index = i12
|
571
|
+
r12 = nil
|
572
|
+
end
|
573
|
+
if r12
|
574
|
+
r11 = r12
|
575
|
+
else
|
576
|
+
r11 = instantiate_node(SyntaxNode,input, index...index)
|
577
|
+
end
|
578
|
+
s10 << r11
|
579
|
+
if r11
|
580
|
+
if (match_len = has_terminal?("p", :insens, index))
|
581
|
+
r16 = instantiate_node(SyntaxNode,input, index...(index + match_len))
|
582
|
+
@index += match_len
|
583
|
+
else
|
584
|
+
terminal_parse_failure('"p"')
|
585
|
+
r16 = nil
|
586
|
+
end
|
587
|
+
s10 << r16
|
588
|
+
if r16
|
589
|
+
r18 = _nt_sign
|
590
|
+
if r18
|
591
|
+
r17 = r18
|
592
|
+
else
|
593
|
+
r17 = instantiate_node(SyntaxNode,input, index...index)
|
594
|
+
end
|
595
|
+
s10 << r17
|
596
|
+
if r17
|
597
|
+
s19, i19 = [], index
|
598
|
+
loop do
|
599
|
+
r20 = _nt_DIGIT
|
600
|
+
if r20
|
601
|
+
s19 << r20
|
602
|
+
else
|
603
|
+
break
|
604
|
+
end
|
605
|
+
end
|
606
|
+
r19 = instantiate_node(SyntaxNode,input, i19...index, s19)
|
607
|
+
s10 << r19
|
608
|
+
end
|
609
|
+
end
|
610
|
+
end
|
611
|
+
if s10.last
|
612
|
+
r10 = instantiate_node(SyntaxNode,input, i10...index, s10)
|
613
|
+
r10.extend(Basenumber1)
|
614
|
+
else
|
615
|
+
@index = i10
|
616
|
+
r10 = nil
|
617
|
+
end
|
618
|
+
if r10
|
619
|
+
r9 = r10
|
620
|
+
else
|
621
|
+
r9 = instantiate_node(SyntaxNode,input, index...index)
|
622
|
+
end
|
623
|
+
s5 << r9
|
624
|
+
end
|
531
625
|
end
|
532
626
|
if s5.last
|
533
627
|
r5 = instantiate_node(SyntaxNode,input, i5...index, s5)
|
534
|
-
r5.extend(
|
628
|
+
r5.extend(Basenumber2)
|
535
629
|
else
|
536
630
|
@index = i5
|
537
631
|
r5 = nil
|
@@ -540,81 +634,81 @@ module EDNGRAMMAR
|
|
540
634
|
r5 = SyntaxNode.new(input, (index-1)...index) if r5 == true
|
541
635
|
r4 = r5
|
542
636
|
else
|
543
|
-
|
637
|
+
i21, s21 = index, []
|
544
638
|
if (match_len = has_terminal?("o", :insens, index))
|
545
|
-
|
639
|
+
r22 = instantiate_node(SyntaxNode,input, index...(index + match_len))
|
546
640
|
@index += match_len
|
547
641
|
else
|
548
642
|
terminal_parse_failure('"o"')
|
549
|
-
|
643
|
+
r22 = nil
|
550
644
|
end
|
551
|
-
|
552
|
-
if
|
553
|
-
|
645
|
+
s21 << r22
|
646
|
+
if r22
|
647
|
+
s23, i23 = [], index
|
554
648
|
loop do
|
555
|
-
|
556
|
-
if
|
557
|
-
|
649
|
+
r24 = _nt_ODIGIT
|
650
|
+
if r24
|
651
|
+
s23 << r24
|
558
652
|
else
|
559
653
|
break
|
560
654
|
end
|
561
655
|
end
|
562
|
-
if
|
563
|
-
@index =
|
564
|
-
|
656
|
+
if s23.empty?
|
657
|
+
@index = i23
|
658
|
+
r23 = nil
|
565
659
|
else
|
566
|
-
|
660
|
+
r23 = instantiate_node(SyntaxNode,input, i23...index, s23)
|
567
661
|
end
|
568
|
-
|
662
|
+
s21 << r23
|
569
663
|
end
|
570
|
-
if
|
571
|
-
|
572
|
-
|
664
|
+
if s21.last
|
665
|
+
r21 = instantiate_node(SyntaxNode,input, i21...index, s21)
|
666
|
+
r21.extend(Basenumber3)
|
573
667
|
else
|
574
|
-
@index =
|
575
|
-
|
668
|
+
@index = i21
|
669
|
+
r21 = nil
|
576
670
|
end
|
577
|
-
if
|
578
|
-
|
579
|
-
r4 =
|
671
|
+
if r21
|
672
|
+
r21 = SyntaxNode.new(input, (index-1)...index) if r21 == true
|
673
|
+
r4 = r21
|
580
674
|
else
|
581
|
-
|
675
|
+
i25, s25 = index, []
|
582
676
|
if (match_len = has_terminal?("b", :insens, index))
|
583
|
-
|
677
|
+
r26 = instantiate_node(SyntaxNode,input, index...(index + match_len))
|
584
678
|
@index += match_len
|
585
679
|
else
|
586
680
|
terminal_parse_failure('"b"')
|
587
|
-
|
681
|
+
r26 = nil
|
588
682
|
end
|
589
|
-
|
590
|
-
if
|
591
|
-
|
683
|
+
s25 << r26
|
684
|
+
if r26
|
685
|
+
s27, i27 = [], index
|
592
686
|
loop do
|
593
|
-
|
594
|
-
if
|
595
|
-
|
687
|
+
r28 = _nt_BDIGIT
|
688
|
+
if r28
|
689
|
+
s27 << r28
|
596
690
|
else
|
597
691
|
break
|
598
692
|
end
|
599
693
|
end
|
600
|
-
if
|
601
|
-
@index =
|
602
|
-
|
694
|
+
if s27.empty?
|
695
|
+
@index = i27
|
696
|
+
r27 = nil
|
603
697
|
else
|
604
|
-
|
698
|
+
r27 = instantiate_node(SyntaxNode,input, i27...index, s27)
|
605
699
|
end
|
606
|
-
|
700
|
+
s25 << r27
|
607
701
|
end
|
608
|
-
if
|
609
|
-
|
610
|
-
|
702
|
+
if s25.last
|
703
|
+
r25 = instantiate_node(SyntaxNode,input, i25...index, s25)
|
704
|
+
r25.extend(Basenumber4)
|
611
705
|
else
|
612
|
-
@index =
|
613
|
-
|
706
|
+
@index = i25
|
707
|
+
r25 = nil
|
614
708
|
end
|
615
|
-
if
|
616
|
-
|
617
|
-
r4 =
|
709
|
+
if r25
|
710
|
+
r25 = SyntaxNode.new(input, (index-1)...index) if r25 == true
|
711
|
+
r4 = r25
|
618
712
|
else
|
619
713
|
@index = i4
|
620
714
|
r4 = nil
|
@@ -626,8 +720,8 @@ module EDNGRAMMAR
|
|
626
720
|
end
|
627
721
|
if s0.last
|
628
722
|
r0 = instantiate_node(SyntaxNode,input, i0...index, s0)
|
629
|
-
r0.extend(
|
630
|
-
r0.extend(
|
723
|
+
r0.extend(Basenumber5)
|
724
|
+
r0.extend(Basenumber6)
|
631
725
|
else
|
632
726
|
@index = i0
|
633
727
|
r0 = nil
|
@@ -3690,44 +3784,6 @@ module EDNGRAMMAR
|
|
3690
3784
|
r0
|
3691
3785
|
end
|
3692
3786
|
|
3693
|
-
def _nt_ALPHA
|
3694
|
-
start_index = index
|
3695
|
-
if node_cache[:ALPHA].has_key?(index)
|
3696
|
-
cached = node_cache[:ALPHA][index]
|
3697
|
-
if cached
|
3698
|
-
node_cache[:ALPHA][index] = cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
|
3699
|
-
@index = cached.interval.end
|
3700
|
-
end
|
3701
|
-
return cached
|
3702
|
-
end
|
3703
|
-
|
3704
|
-
i0 = index
|
3705
|
-
if has_terminal?(@regexps[gr = '\A[A-Z]'] ||= Regexp.new(gr), :regexp, index)
|
3706
|
-
r1 = true
|
3707
|
-
@index += 1
|
3708
|
-
else
|
3709
|
-
terminal_parse_failure('[A-Z]')
|
3710
|
-
r1 = nil
|
3711
|
-
end
|
3712
|
-
if r1
|
3713
|
-
r1 = SyntaxNode.new(input, (index-1)...index) if r1 == true
|
3714
|
-
r0 = r1
|
3715
|
-
else
|
3716
|
-
r2 = _nt_lcalpha
|
3717
|
-
if r2
|
3718
|
-
r2 = SyntaxNode.new(input, (index-1)...index) if r2 == true
|
3719
|
-
r0 = r2
|
3720
|
-
else
|
3721
|
-
@index = i0
|
3722
|
-
r0 = nil
|
3723
|
-
end
|
3724
|
-
end
|
3725
|
-
|
3726
|
-
node_cache[:ALPHA][start_index] = r0
|
3727
|
-
|
3728
|
-
r0
|
3729
|
-
end
|
3730
|
-
|
3731
3787
|
end
|
3732
3788
|
|
3733
3789
|
class EDNGRAMMARParser < Treetop::Runtime::CompiledParser
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: edn-abnf
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.6
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Carsten Bormann
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2023-
|
11
|
+
date: 2023-10-01 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|