edn-abnf 0.0.10 → 0.0.12
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/cbor-diagnostic-app/dt.rb +25 -0
- data/lib/cbor-diagnostic-app/dtgrammar.rb +700 -0
- data/lib/cbor-diagnostic-app/ip.rb +22 -0
- data/lib/cbor-diagnostic-app/ipgrammar.rb +1698 -0
- data/lib/parser/edn-util.rb +1 -0
- data/lib/parser/edngrammar.rb +296 -30
- metadata +6 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f762b42f537b6298556bf2e2988c8612cd26d9315c980ddb9a5e355a678a40c5
|
4
|
+
data.tar.gz: 91b77ee973f2d4c23a6a9bb0344a16324e783c47861f7f0929dfd6322dd0f743
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ecb6361fcf84f6de6d7e547093ec2de27d7cc69161d7717ee336db9b39b0b546ce50015dbcfb8ed64d81129d67acdbaa4eb0fcb64751c55fbe10996e9ca61fd1
|
7
|
+
data.tar.gz: 8f438a03ee42ea49f1d412b9fe249332acfae759be315a1c6e8f71304fb8159c9161f8267252e9e6f8f463577c2f4c55bfeafff33baae1da7f6c0752d6a131d9
|
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.12"
|
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"
|
@@ -0,0 +1,25 @@
|
|
1
|
+
require_relative "dtgrammar.rb"
|
2
|
+
require 'time'
|
3
|
+
|
4
|
+
# Using Time#iso8601 creates the following bugs:
|
5
|
+
# * dt'1970-01-01T10:00:00' is accepted and gives local time
|
6
|
+
# * dt'1970-01-01T10:00:00.0Z' gives an integer instead of a float
|
7
|
+
# Probably should copy over Time#xmlschema and fix that for us.
|
8
|
+
|
9
|
+
class CBOR_DIAG::App_dt
|
10
|
+
def self.decode(_, s)
|
11
|
+
parser = DTGRAMMARParser.new
|
12
|
+
ast = parser.parse(s)
|
13
|
+
if !ast
|
14
|
+
raise ArgumentError, "cbor-diagnostic: Parse Error in dt'#{s}':\n" << EDN.reason(parser, s)
|
15
|
+
end
|
16
|
+
# ast.ast
|
17
|
+
|
18
|
+
t = Time.iso8601(s)
|
19
|
+
if t.subsec != 0
|
20
|
+
t.to_f
|
21
|
+
else
|
22
|
+
t.to_i
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|