edn-abnf 0.5.36 → 0.5.37
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 +23 -0
- data/edn-abnf.gemspec +1 -1
- data/lib/parser/edngrammar.rb +8 -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: e0f64289932889f6db2279a914988e7216a97977abaa03d7cf94ce185d7318c2
|
|
4
|
+
data.tar.gz: 619f9b5f1e029409c668eb5a43794523519f8a8789d69bc918264ab74f8cfe4f
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: '05696d0f506625417e09b429819aee2c6905d6250b85f8e8df48b66922ccea56db6c5ecc0b6657bc383daa3c9170aa9b5b5c14bc59d32eab20d80f00ce8ad7fa'
|
|
7
|
+
data.tar.gz: dbdf3d08c3ad50af80f0285692fd655855419e38e88e0e6aab9561262fce195296f9c2c96465fd2a6fe8ad46df8f79f6478a28c1b54e7dfcb4c33e8bbe16f0f8
|
data/bin/edn-abnf
CHANGED
|
@@ -82,6 +82,25 @@ begin
|
|
|
82
82
|
end
|
|
83
83
|
end
|
|
84
84
|
end
|
|
85
|
+
opts.on("-AAPP", "--app-later=APP", "Handle application extension later") do |v|
|
|
86
|
+
v.split(",") do |nm|
|
|
87
|
+
if nm =~ /\A[a-z][a-z0-9]*\z/
|
|
88
|
+
code = <<-RUBY
|
|
89
|
+
class CBOR_DIAG::App_#{nm}
|
|
90
|
+
def self.decode(app_prefix, s)
|
|
91
|
+
CBOR::Tagged.new(999, [app_prefix, s])
|
|
92
|
+
end
|
|
93
|
+
end
|
|
94
|
+
RUBY
|
|
95
|
+
eval(code, TOPLEVEL_BINDING, "(app-extension #{nm})")
|
|
96
|
+
else
|
|
97
|
+
raise ArgumentError.new("edn-abnf: app-extension name #{nm} not supported")
|
|
98
|
+
end
|
|
99
|
+
end
|
|
100
|
+
end
|
|
101
|
+
opts.on("--[no-]app-now", "Handle postponed application extensions now") do |v|
|
|
102
|
+
$options.app_now = v
|
|
103
|
+
end
|
|
85
104
|
opts.on("-f", "--[no-]fallback", "use tag 999 for unknown app-extensions") do |v|
|
|
86
105
|
$options.fallback = v
|
|
87
106
|
end
|
|
@@ -93,7 +112,11 @@ begin
|
|
|
93
112
|
end
|
|
94
113
|
end
|
|
95
114
|
op.parse!
|
|
115
|
+
rescue LoadError => e
|
|
116
|
+
warn "Unsupported application extension '#{e.message.split('/')[1]}'"
|
|
117
|
+
exit 1
|
|
96
118
|
rescue Exception => e
|
|
119
|
+
warn e.inspect unless e.to_s == 'exit'
|
|
97
120
|
warn op unless e.to_s == 'exit'
|
|
98
121
|
exit 1
|
|
99
122
|
end
|
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.37"
|
|
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/edngrammar.rb
CHANGED
|
@@ -1802,7 +1802,14 @@ module EDNGRAMMAR
|
|
|
1802
1802
|
|
|
1803
1803
|
module Tagged1
|
|
1804
1804
|
def ast
|
|
1805
|
-
|
|
1805
|
+
tagnum = uint.text_value.to_i
|
|
1806
|
+
tagval = item.ast
|
|
1807
|
+
if tagnum == 999 && $options.app_now
|
|
1808
|
+
app, args = tagval
|
|
1809
|
+
val = ::EDNGRAMMAR::APPS[app].decode(app, *args)
|
|
1810
|
+
else
|
|
1811
|
+
val = CBOR::Tagged.new(tagnum, tagval)
|
|
1812
|
+
end
|
|
1806
1813
|
if ei = spec.text_value[1..-1]
|
|
1807
1814
|
val = CBOR::Box.from_instance(val, {ei: ei})
|
|
1808
1815
|
# warn "*** implementing encoding indicator #{ei.inspect} after tag number #{uint.text_value}"
|