edn-abnf 0.5.12 → 0.5.14
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 +45 -1
- data/edn-abnf.gemspec +1 -1
- data/lib/cbor-diag-support.rb +6 -0
- data/lib/cbor-diagnostic-app/b64grammar.rb +3 -5
- data/lib/cbor-diagnostic-app/dtgrammar.rb +3 -5
- data/lib/cbor-diagnostic-app/hgrammar.rb +3 -5
- data/lib/cbor-diagnostic-app/ipgrammar.rb +3 -5
- data/lib/parser/edngrammar.rb +1 -1
- 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: 14d01eaa954b101a5d9b1a38cba3f8c26e5e6c6dbc8c18229c8d09fc8d03eb70
|
|
4
|
+
data.tar.gz: 6edb1eacbac4466bfcc4825880eae1c96c93a5af3d4a14cb5104a2c8d203ef98
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 154a66988a780298dace8e6604b2a7bac226944384c869981fcf181e41c873ae19ca31193349c1cc094aec49b84075da6c622cc0691d974823860329dce0a15c
|
|
7
|
+
data.tar.gz: 48a564790134c0d21ffc19beefff2456892e3472356c021f2e5181adc333e96ea63882046c56572dd7935a17e6f129e47b86161dc796f121697b53da5525eb0f
|
data/bin/edn-abnf
CHANGED
|
@@ -5,6 +5,7 @@ require 'yaml'
|
|
|
5
5
|
require 'treetop'
|
|
6
6
|
require 'json'
|
|
7
7
|
require 'cbor-pretty'
|
|
8
|
+
require 'cbor-deterministic'
|
|
8
9
|
|
|
9
10
|
# Temporary fix for name conflicts between cbor-diag and edn-abnf
|
|
10
11
|
diag_path = $LOAD_PATH.grep(/gems\/cbor-diag/).first
|
|
@@ -40,7 +41,7 @@ require 'ostruct'
|
|
|
40
41
|
|
|
41
42
|
$error = 0
|
|
42
43
|
|
|
43
|
-
output_formats = [:basic, :neat, :json, :yaml, :edn, :diag, :pretty, :hex, :cbor]
|
|
44
|
+
output_formats = [:basic, :neat, :json, :yaml, :edn, :diag, :pretty, :hex, :cbor, :"decoder-test"]
|
|
44
45
|
|
|
45
46
|
$options = OpenStruct.new
|
|
46
47
|
begin
|
|
@@ -199,6 +200,49 @@ when :pretty, :hex, :cbor
|
|
|
199
200
|
else
|
|
200
201
|
fail "Cannot happen"
|
|
201
202
|
end
|
|
203
|
+
when :"decoder-test"
|
|
204
|
+
fail "Not a map" unless Hash === result
|
|
205
|
+
tests = result.delete("tests")
|
|
206
|
+
fail "tests not an array" unless Array === tests
|
|
207
|
+
failing_tests = result.delete("fail")
|
|
208
|
+
puts result.inspect << ", #{tests.size} tests"
|
|
209
|
+
if failing_tests
|
|
210
|
+
tests.each do |t|
|
|
211
|
+
encoded = t.delete("encoded")
|
|
212
|
+
fail t unless encoded
|
|
213
|
+
begin
|
|
214
|
+
r = CBOR.decode(encoded)
|
|
215
|
+
fail "#{encoded.inspect} unexpectedly decodes, as #{r.cbor_diagnostic}"
|
|
216
|
+
rescue CBOR::OutOfBytesError, RuntimeError, JSON::GeneratorError
|
|
217
|
+
# p [r, t, encoded]
|
|
218
|
+
rescue => e
|
|
219
|
+
puts "*** Unexpected error:"
|
|
220
|
+
p [e, r, t, encoded.hexi]
|
|
221
|
+
end
|
|
222
|
+
end
|
|
223
|
+
else
|
|
224
|
+
tests.each do |t|
|
|
225
|
+
encoded = t.delete("encoded")
|
|
226
|
+
fail t unless encoded
|
|
227
|
+
roundtrip = t.delete("roundtrip") { true } # default is true
|
|
228
|
+
decoded = t.delete("decoded") { :"no-decoded"}
|
|
229
|
+
fail "no decoded" if decoded == :"no-decoded"
|
|
230
|
+
begin
|
|
231
|
+
r = CBOR.decode(encoded)
|
|
232
|
+
if !r.cbor_same?(decoded)
|
|
233
|
+
puts "*** unexpected: decoding #{r.inspect}, expected #{decoded.inspect} in #{t.inspect}"
|
|
234
|
+
end
|
|
235
|
+
rescue => e
|
|
236
|
+
puts "*** decode failure: #{e}"
|
|
237
|
+
end
|
|
238
|
+
if roundtrip
|
|
239
|
+
rt = CBOR.encode(decoded)
|
|
240
|
+
if rt != encoded
|
|
241
|
+
puts "*** unexpected: encoding #{rt.inspect}, expected #{encoded.inspect} in #{t.inspect}"
|
|
242
|
+
end
|
|
243
|
+
end
|
|
244
|
+
end
|
|
245
|
+
end
|
|
202
246
|
else
|
|
203
247
|
warn ["Unknown target format: ", $options.target].inspect
|
|
204
248
|
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.14"
|
|
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/cbor-diag-support.rb
CHANGED
|
@@ -669,11 +669,9 @@ module B64GRAMMAR
|
|
|
669
669
|
r0
|
|
670
670
|
end
|
|
671
671
|
|
|
672
|
-
|
|
673
|
-
class Parser < Treetop::Runtime::CompiledParser
|
|
674
|
-
include B64GRAMMAR
|
|
675
|
-
end
|
|
676
672
|
end
|
|
677
673
|
|
|
678
|
-
B64GRAMMARParser
|
|
674
|
+
class B64GRAMMARParser < Treetop::Runtime::CompiledParser
|
|
675
|
+
include B64GRAMMAR
|
|
676
|
+
end
|
|
679
677
|
|
|
@@ -707,11 +707,9 @@ module DTGRAMMAR
|
|
|
707
707
|
r0
|
|
708
708
|
end
|
|
709
709
|
|
|
710
|
-
|
|
711
|
-
class Parser < Treetop::Runtime::CompiledParser
|
|
712
|
-
include DTGRAMMAR
|
|
713
|
-
end
|
|
714
710
|
end
|
|
715
711
|
|
|
716
|
-
DTGRAMMARParser
|
|
712
|
+
class DTGRAMMARParser < Treetop::Runtime::CompiledParser
|
|
713
|
+
include DTGRAMMAR
|
|
714
|
+
end
|
|
717
715
|
|
|
@@ -763,11 +763,9 @@ module HGRAMMAR
|
|
|
763
763
|
r0
|
|
764
764
|
end
|
|
765
765
|
|
|
766
|
-
|
|
767
|
-
class Parser < Treetop::Runtime::CompiledParser
|
|
768
|
-
include HGRAMMAR
|
|
769
|
-
end
|
|
770
766
|
end
|
|
771
767
|
|
|
772
|
-
HGRAMMARParser
|
|
768
|
+
class HGRAMMARParser < Treetop::Runtime::CompiledParser
|
|
769
|
+
include HGRAMMAR
|
|
770
|
+
end
|
|
773
771
|
|
|
@@ -1690,11 +1690,9 @@ module IPGRAMMAR
|
|
|
1690
1690
|
r0
|
|
1691
1691
|
end
|
|
1692
1692
|
|
|
1693
|
-
|
|
1694
|
-
class Parser < Treetop::Runtime::CompiledParser
|
|
1695
|
-
include IPGRAMMAR
|
|
1696
|
-
end
|
|
1697
1693
|
end
|
|
1698
1694
|
|
|
1699
|
-
IPGRAMMARParser
|
|
1695
|
+
class IPGRAMMARParser < Treetop::Runtime::CompiledParser
|
|
1696
|
+
include IPGRAMMAR
|
|
1697
|
+
end
|
|
1700
1698
|
|
data/lib/parser/edngrammar.rb
CHANGED
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: edn-abnf
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.5.
|
|
4
|
+
version: 0.5.14
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Carsten Bormann
|
|
@@ -133,7 +133,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
133
133
|
- !ruby/object:Gem::Version
|
|
134
134
|
version: '0'
|
|
135
135
|
requirements: []
|
|
136
|
-
rubygems_version:
|
|
136
|
+
rubygems_version: 4.0.2
|
|
137
137
|
specification_version: 4
|
|
138
138
|
summary: CBOR Extended Diagnostic Notation (EDN) implemented in ABNF
|
|
139
139
|
test_files: []
|