edn-abnf 0.5.14 → 0.5.15
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 +19 -9
- data/edn-abnf.gemspec +1 -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: e0cfa7f5a3324396126a17a2530147bff309fec468d512ede0ca8c436591f44c
|
|
4
|
+
data.tar.gz: 6850c6fa052ba8b687ac8a0332ed05f27a32781e5132c76754dfd24ad2928e55
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: dd717eab5c11238c954e70ecf9575524aa1826fccbe7d885c9ac9e5946783314181443ddd17c6af22e5b18a841f472252871e14a3d480e701cdba8c996142658
|
|
7
|
+
data.tar.gz: ae2f0a9e57e9d4cb64cf3ea2f00f7f5d3e8e47141c2ec1e05276f6c4c3d859661d76003617c9b22c7773cbf067603bdf883c788ad670335e97c4757a25ff1b15
|
data/bin/edn-abnf
CHANGED
|
@@ -41,7 +41,7 @@ require 'ostruct'
|
|
|
41
41
|
|
|
42
42
|
$error = 0
|
|
43
43
|
|
|
44
|
-
output_formats = [:basic, :neat, :json, :yaml, :edn, :diag, :pretty, :hex, :cbor, :"
|
|
44
|
+
output_formats = [:basic, :neat, :json, :yaml, :edn, :diag, :pretty, :hex, :cbor, :"test-vector"]
|
|
45
45
|
|
|
46
46
|
$options = OpenStruct.new
|
|
47
47
|
begin
|
|
@@ -65,6 +65,9 @@ begin
|
|
|
65
65
|
opts.on("-eEDN", "--e=EDN", "supply EDN on command line") do |v|
|
|
66
66
|
$options.edn = v
|
|
67
67
|
end
|
|
68
|
+
opts.on("-c", "--[no-]cbor", "input is encoded CBOR data item, not EDN") do |v|
|
|
69
|
+
$options.cbor = v
|
|
70
|
+
end
|
|
68
71
|
opts.on("-tFMT", "--to=FMT",
|
|
69
72
|
output_formats,
|
|
70
73
|
"Target format (#{output_formats.join("/")}, default: diag)") do |v|
|
|
@@ -90,12 +93,8 @@ rescue Exception => e
|
|
|
90
93
|
exit 1
|
|
91
94
|
end
|
|
92
95
|
|
|
93
|
-
|
|
94
96
|
if !$options.edn
|
|
95
|
-
if
|
|
96
|
-
warn op
|
|
97
|
-
exit 1
|
|
98
|
-
end
|
|
97
|
+
ARGF.binmode if $options.cbor
|
|
99
98
|
$options.edn = ARGF.read
|
|
100
99
|
else
|
|
101
100
|
if ARGV != []
|
|
@@ -106,6 +105,10 @@ end
|
|
|
106
105
|
edn_file = $options.edn
|
|
107
106
|
|
|
108
107
|
if $options.lines
|
|
108
|
+
if $options.cbor
|
|
109
|
+
warn "*** -l and -c don't combine"
|
|
110
|
+
exit 1
|
|
111
|
+
end
|
|
109
112
|
CSV.parse(edn_file) do |ok, ednin, out|
|
|
110
113
|
if ok[0] == "#"
|
|
111
114
|
puts "# #{ok}, #{ednin.inspect}, #{out}" if $options.verbose
|
|
@@ -165,11 +168,18 @@ if $options.lines
|
|
|
165
168
|
end
|
|
166
169
|
|
|
167
170
|
begin
|
|
168
|
-
|
|
169
|
-
|
|
171
|
+
if $options.cbor
|
|
172
|
+
result = CBOR.decode(edn_file)
|
|
173
|
+
else
|
|
174
|
+
edn = EDN.from_edn(edn_file)
|
|
175
|
+
result = edn.tree # XXX .tree?
|
|
176
|
+
end
|
|
170
177
|
rescue CBOR_DIAG::AppParseError, ArgumentError => e
|
|
171
178
|
puts "** #{e}"
|
|
172
179
|
exit 1
|
|
180
|
+
rescue CBOR::OutOfBytesError, RuntimeError, JSON::GeneratorError => e
|
|
181
|
+
puts "** (encoded CBOR input:) #{e}"
|
|
182
|
+
exit 1
|
|
173
183
|
end
|
|
174
184
|
|
|
175
185
|
case $options.target
|
|
@@ -200,7 +210,7 @@ when :pretty, :hex, :cbor
|
|
|
200
210
|
else
|
|
201
211
|
fail "Cannot happen"
|
|
202
212
|
end
|
|
203
|
-
when :"
|
|
213
|
+
when :"test-vector"
|
|
204
214
|
fail "Not a map" unless Hash === result
|
|
205
215
|
tests = result.delete("tests")
|
|
206
216
|
fail "tests not an array" unless Array === tests
|
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.15"
|
|
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"
|