edn-abnf 0.5.6 → 0.5.7
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 +5 -1
- data/edn-abnf.gemspec +1 -1
- data/lib/parser/edn-util.rb +16 -1
- 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: 3bcd4eb027bdd536dd68495888d729d0bd74647daa157fe2ba8f674432f6a8d8
|
4
|
+
data.tar.gz: 3fcc1ece75ccda7eca35284880b26232f6014528d17e0abd46ef73c86c2dc7da
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c2820714dc0bca0ac2196af9f156062423db534c166de6b18dd0e243638b808d2906b3bcd2cf0e2d7fcbb6555fa42f21213c1026983ac586e1793735b21bfcd1
|
7
|
+
data.tar.gz: dc913cf9e16dfc2655c086042c477ac664f43ac179bfd06939cc063426360e1e62a1173f84b7413cc97a4f4b7f663a399b3eaaf7e7099f48d1c1c6feeef12614
|
data/bin/edn-abnf
CHANGED
@@ -68,17 +68,21 @@ begin
|
|
68
68
|
end
|
69
69
|
end
|
70
70
|
end
|
71
|
+
opts.on("-f", "--[no-]fallback", "use tag 999 for unknown app-extensions") do |v|
|
72
|
+
$options.fallback = v
|
73
|
+
end
|
71
74
|
end
|
72
75
|
op.parse!
|
73
76
|
rescue Exception => e
|
74
77
|
warn e
|
78
|
+
warn op
|
75
79
|
exit 1
|
76
80
|
end
|
77
81
|
|
78
82
|
|
79
83
|
if !$options.edn
|
80
84
|
if ARGV == []
|
81
|
-
|
85
|
+
warn op
|
82
86
|
exit 1
|
83
87
|
end
|
84
88
|
$options.edn = ARGF.read
|
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.7"
|
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"
|
data/lib/parser/edn-util.rb
CHANGED
@@ -5,11 +5,26 @@ end
|
|
5
5
|
require 'treetop'
|
6
6
|
require_relative './edngrammar'
|
7
7
|
|
8
|
+
class CBOR_DIAG::App_ # fallback!
|
9
|
+
def self.decode(app_prefix, s)
|
10
|
+
if CBOR::Sequence === s
|
11
|
+
args = s.elements
|
12
|
+
else
|
13
|
+
args = [s]
|
14
|
+
end
|
15
|
+
CBOR::Tagged.new(999, [app_prefix, args])
|
16
|
+
end
|
17
|
+
end
|
18
|
+
|
8
19
|
module EDNGRAMMAR
|
9
20
|
const_set(:APPS, Hash.new { |h, k|
|
10
21
|
h[k] = begin ::CBOR_DIAG.const_get("App_#{k.downcase}")
|
11
22
|
rescue NameError
|
12
|
-
|
23
|
+
if $options.fallback
|
24
|
+
::CBOR_DIAG::App_
|
25
|
+
else
|
26
|
+
raise ArgumentError, "cbor-diagnostic: Unknown application-oriented extension '#{k}'", caller
|
27
|
+
end
|
13
28
|
end
|
14
29
|
}) unless const_defined?(:APPS)
|
15
30
|
end
|