edn-abnf-ec 0.1.8
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/bin/edn-abnf-ec +109 -0
- data/edn-abnf.gemspec +21 -0
- data/lib/cbor-diagnostic-app/b64.rb +22 -0
- data/lib/cbor-diagnostic-app/b64grammar.rb +677 -0
- data/lib/cbor-diagnostic-app/dt.rb +33 -0
- data/lib/cbor-diagnostic-app/dtgrammar.rb +700 -0
- data/lib/cbor-diagnostic-app/h.rb +13 -0
- data/lib/cbor-diagnostic-app/hgrammar.rb +771 -0
- data/lib/cbor-diagnostic-app/ip.rb +21 -0
- data/lib/cbor-diagnostic-app/ipgrammar.rb +1698 -0
- data/lib/edn-abnf.rb +42 -0
- data/lib/parser/edn-util.rb +24 -0
- data/lib/parser/edngrammar.rb +4708 -0
- metadata +127 -0
@@ -0,0 +1,21 @@
|
|
1
|
+
require_relative "ipgrammar.rb"
|
2
|
+
require 'ipaddr'
|
3
|
+
|
4
|
+
class CBOR_DIAG::App_ip
|
5
|
+
def self.decode(app_prefix, s)
|
6
|
+
parser = IPGRAMMARParser.new
|
7
|
+
ast = parser.parse(s)
|
8
|
+
if !ast
|
9
|
+
raise ArgumentError, "cbor-diagnostic: Parse Error in ip'#{s}':\n" << EDN.reason(parser, s)
|
10
|
+
end
|
11
|
+
fam, ipv = ast.ast
|
12
|
+
case app_prefix
|
13
|
+
when 'ip'
|
14
|
+
ipv
|
15
|
+
when 'IP'
|
16
|
+
CBOR::Tagged.new(fam, ipv)
|
17
|
+
else
|
18
|
+
fail app_prefix
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|