edn-abnf 0.3.3 → 0.3.5
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/cbor-diagnostic-app/dt.rb +2 -2
- data/lib/cbor-diagnostic-app/dtgrammar.rb +15 -0
- data/lib/parser/edngrammar.rb +40 -29
- 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: f27ae567e340f8f491fd48f61ffcf98080e5a7e25f73e48178ba716382976232
|
4
|
+
data.tar.gz: 911714cd26c0f5fc215d75bf29f95bb17bb8f7e20b1c89897e2bbdc919047366
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: adf381d82f725bbcf8f2fcc67bdcf57d999ba236bc6d3f4aae062cc85c0c189770662bb38916134a4e0d5d7a73ed1fa1e0a604cfe39f9f0f29ca34a4102e423b
|
7
|
+
data.tar.gz: 4edde63c1bd6aac32b14d3c5bf118e43e8d26dd77cc7e4653ec5304699e6341b7e885e96b4afeb7dce3c8f628d07d2f405a85fff24aaa7dfc5324271264c42b3
|
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.3.
|
3
|
+
s.version = "0.3.5"
|
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"
|
@@ -13,10 +13,10 @@ class CBOR_DIAG::App_dt
|
|
13
13
|
if !ast
|
14
14
|
raise ArgumentError, "cbor-diagnostic: Parse Error in dt'#{s}':\n" << EDN.reason(parser, s)
|
15
15
|
end
|
16
|
-
|
16
|
+
frac = ast.has_frac != ""
|
17
17
|
|
18
18
|
t = Time.iso8601(s)
|
19
|
-
tv = if t.subsec != 0
|
19
|
+
tv = if frac # t.subsec != 0
|
20
20
|
t.to_f
|
21
21
|
else
|
22
22
|
t.to_i
|
@@ -443,6 +443,10 @@ module DTGRAMMAR
|
|
443
443
|
|
444
444
|
end
|
445
445
|
|
446
|
+
module PartialTime1
|
447
|
+
def has_frac; elements[5].text_value end
|
448
|
+
end
|
449
|
+
|
446
450
|
def _nt_partial_time
|
447
451
|
start_index = index
|
448
452
|
if node_cache[:partial_time].has_key?(index)
|
@@ -497,6 +501,7 @@ module DTGRAMMAR
|
|
497
501
|
if s0.last
|
498
502
|
r0 = instantiate_node(SyntaxNode,input, i0...index, s0)
|
499
503
|
r0.extend(PartialTime0)
|
504
|
+
r0.extend(PartialTime1)
|
500
505
|
else
|
501
506
|
@index = i0
|
502
507
|
r0 = nil
|
@@ -586,6 +591,10 @@ module DTGRAMMAR
|
|
586
591
|
end
|
587
592
|
end
|
588
593
|
|
594
|
+
module FullTime1
|
595
|
+
def has_frac; partial_time.has_frac end
|
596
|
+
end
|
597
|
+
|
589
598
|
def _nt_full_time
|
590
599
|
start_index = index
|
591
600
|
if node_cache[:full_time].has_key?(index)
|
@@ -607,6 +616,7 @@ module DTGRAMMAR
|
|
607
616
|
if s0.last
|
608
617
|
r0 = instantiate_node(SyntaxNode,input, i0...index, s0)
|
609
618
|
r0.extend(FullTime0)
|
619
|
+
r0.extend(FullTime1)
|
610
620
|
else
|
611
621
|
@index = i0
|
612
622
|
r0 = nil
|
@@ -627,6 +637,10 @@ module DTGRAMMAR
|
|
627
637
|
end
|
628
638
|
end
|
629
639
|
|
640
|
+
module DateTime1
|
641
|
+
def has_frac; full_time.has_frac end
|
642
|
+
end
|
643
|
+
|
630
644
|
def _nt_date_time
|
631
645
|
start_index = index
|
632
646
|
if node_cache[:date_time].has_key?(index)
|
@@ -658,6 +672,7 @@ module DTGRAMMAR
|
|
658
672
|
if s0.last
|
659
673
|
r0 = instantiate_node(SyntaxNode,input, i0...index, s0)
|
660
674
|
r0.extend(DateTime0)
|
675
|
+
r0.extend(DateTime1)
|
661
676
|
else
|
662
677
|
@index = i0
|
663
678
|
r0 = nil
|
data/lib/parser/edngrammar.rb
CHANGED
@@ -1757,6 +1757,13 @@ module EDNGRAMMAR
|
|
1757
1757
|
end
|
1758
1758
|
|
1759
1759
|
module Sqstr0
|
1760
|
+
def SQUOTE1
|
1761
|
+
elements[0]
|
1762
|
+
end
|
1763
|
+
|
1764
|
+
def SQUOTE2
|
1765
|
+
elements[2]
|
1766
|
+
end
|
1760
1767
|
end
|
1761
1768
|
|
1762
1769
|
module Sqstr1
|
@@ -1777,13 +1784,7 @@ module EDNGRAMMAR
|
|
1777
1784
|
end
|
1778
1785
|
|
1779
1786
|
i0, s0 = index, []
|
1780
|
-
|
1781
|
-
r1 = true
|
1782
|
-
@index += match_len
|
1783
|
-
else
|
1784
|
-
terminal_parse_failure('"\'"')
|
1785
|
-
r1 = nil
|
1786
|
-
end
|
1787
|
+
r1 = _nt_SQUOTE
|
1787
1788
|
s0 << r1
|
1788
1789
|
if r1
|
1789
1790
|
s2, i2 = [], index
|
@@ -1798,13 +1799,7 @@ module EDNGRAMMAR
|
|
1798
1799
|
r2 = instantiate_node(SyntaxNode,input, i2...index, s2)
|
1799
1800
|
s0 << r2
|
1800
1801
|
if r2
|
1801
|
-
|
1802
|
-
r4 = true
|
1803
|
-
@index += match_len
|
1804
|
-
else
|
1805
|
-
terminal_parse_failure('"\'"')
|
1806
|
-
r4 = nil
|
1807
|
-
end
|
1802
|
+
r4 = _nt_SQUOTE
|
1808
1803
|
s0 << r4
|
1809
1804
|
end
|
1810
1805
|
end
|
@@ -3067,14 +3062,9 @@ module EDNGRAMMAR
|
|
3067
3062
|
r1 = SyntaxNode.new(input, (index-1)...index) if r1 == true
|
3068
3063
|
r0 = r1
|
3069
3064
|
else
|
3070
|
-
|
3071
|
-
|
3072
|
-
|
3073
|
-
@index += match_len
|
3074
|
-
else
|
3075
|
-
terminal_parse_failure('"\'"')
|
3076
|
-
r2 = nil
|
3077
|
-
end
|
3065
|
+
r2 = _nt_SQUOTE
|
3066
|
+
r2.extend(DoubleQuoted1)
|
3067
|
+
r2.extend(DoubleQuoted1)
|
3078
3068
|
if r2
|
3079
3069
|
r2 = SyntaxNode.new(input, (index-1)...index) if r2 == true
|
3080
3070
|
r0 = r2
|
@@ -3150,6 +3140,9 @@ module EDNGRAMMAR
|
|
3150
3140
|
end
|
3151
3141
|
|
3152
3142
|
module SingleQuoted2
|
3143
|
+
def SQUOTE
|
3144
|
+
elements[1]
|
3145
|
+
end
|
3153
3146
|
end
|
3154
3147
|
|
3155
3148
|
module SingleQuoted3
|
@@ -3202,13 +3195,7 @@ module EDNGRAMMAR
|
|
3202
3195
|
end
|
3203
3196
|
s3 << r4
|
3204
3197
|
if r4
|
3205
|
-
|
3206
|
-
r5 = true
|
3207
|
-
@index += match_len
|
3208
|
-
else
|
3209
|
-
terminal_parse_failure('"\'"')
|
3210
|
-
r5 = nil
|
3211
|
-
end
|
3198
|
+
r5 = _nt_SQUOTE
|
3212
3199
|
s3 << r5
|
3213
3200
|
end
|
3214
3201
|
if s3.last
|
@@ -4319,6 +4306,30 @@ module EDNGRAMMAR
|
|
4319
4306
|
r0
|
4320
4307
|
end
|
4321
4308
|
|
4309
|
+
def _nt_SQUOTE
|
4310
|
+
start_index = index
|
4311
|
+
if node_cache[:SQUOTE].has_key?(index)
|
4312
|
+
cached = node_cache[:SQUOTE][index]
|
4313
|
+
if cached
|
4314
|
+
node_cache[:SQUOTE][index] = cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
|
4315
|
+
@index = cached.interval.end
|
4316
|
+
end
|
4317
|
+
return cached
|
4318
|
+
end
|
4319
|
+
|
4320
|
+
if (match_len = has_terminal?("'", false, index))
|
4321
|
+
r0 = instantiate_node(SyntaxNode,input, index...(index + match_len))
|
4322
|
+
@index += match_len
|
4323
|
+
else
|
4324
|
+
terminal_parse_failure('"\'"')
|
4325
|
+
r0 = nil
|
4326
|
+
end
|
4327
|
+
|
4328
|
+
node_cache[:SQUOTE][start_index] = r0
|
4329
|
+
|
4330
|
+
r0
|
4331
|
+
end
|
4332
|
+
|
4322
4333
|
def _nt_DIGIT
|
4323
4334
|
start_index = index
|
4324
4335
|
if node_cache[:DIGIT].has_key?(index)
|
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.3.
|
4
|
+
version: 0.3.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Carsten Bormann
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2025-01-06 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|