cbor-diag 0.2.0 → 0.2.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/cbor-diag.gemspec +2 -2
- data/lib/cbor-diag-parser.rb +135 -20
- metadata +4 -5
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c7bb510fc7bc50a18a36135d64f8532ecd481f5d
|
4
|
+
data.tar.gz: a2b1adf9abdf7ac8fc6dd69b1e3abbbc4f150a74
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 60de42be3a630b23fb820e778a546064218cf31742b46f03e96892dc90be6dd200256344d5965849cc5d275ac5702da898137ed100754f9496008fc35fbfc122
|
7
|
+
data.tar.gz: 04a1672f01c56258d63c6fc708707f38215885cc0456b1ee321d4593730f7f564810f0863bc0b3657c589c14906232bbc10e9b46d83b2191f370e8a80a9d3414
|
data/cbor-diag.gemspec
CHANGED
@@ -1,11 +1,11 @@
|
|
1
1
|
Gem::Specification.new do |s|
|
2
2
|
s.name = "cbor-diag"
|
3
|
-
s.version = "0.2.
|
3
|
+
s.version = "0.2.1"
|
4
4
|
s.summary = "CBOR (Concise Binary Object Representation) diagnostic notation"
|
5
5
|
s.description = %q{cbor-diag implements diagnostic notation for CBOR, RFC 7049}
|
6
6
|
s.author = "Carsten Bormann"
|
7
7
|
s.email = "cabo@tzi.org"
|
8
|
-
s.license = "Apache
|
8
|
+
s.license = "Apache-2.0"
|
9
9
|
s.homepage = "http://cbor.io/"
|
10
10
|
s.has_rdoc = false
|
11
11
|
# s.files = `git ls-files`.split("\n") << "lib/cbor-diag-parser.rb"
|
data/lib/cbor-diag-parser.rb
CHANGED
@@ -79,58 +79,64 @@ module CBOR_DIAG
|
|
79
79
|
r1 = SyntaxNode.new(input, (index-1)...index) if r1 == true
|
80
80
|
r0 = r1
|
81
81
|
else
|
82
|
-
r2 =
|
82
|
+
r2 = _nt_hnumber
|
83
83
|
if r2
|
84
84
|
r2 = SyntaxNode.new(input, (index-1)...index) if r2 == true
|
85
85
|
r0 = r2
|
86
86
|
else
|
87
|
-
r3 =
|
87
|
+
r3 = _nt_fnumber
|
88
88
|
if r3
|
89
89
|
r3 = SyntaxNode.new(input, (index-1)...index) if r3 == true
|
90
90
|
r0 = r3
|
91
91
|
else
|
92
|
-
r4 =
|
92
|
+
r4 = _nt_infin
|
93
93
|
if r4
|
94
94
|
r4 = SyntaxNode.new(input, (index-1)...index) if r4 == true
|
95
95
|
r0 = r4
|
96
96
|
else
|
97
|
-
r5 =
|
97
|
+
r5 = _nt_simple
|
98
98
|
if r5
|
99
99
|
r5 = SyntaxNode.new(input, (index-1)...index) if r5 == true
|
100
100
|
r0 = r5
|
101
101
|
else
|
102
|
-
r6 =
|
102
|
+
r6 = _nt_string
|
103
103
|
if r6
|
104
104
|
r6 = SyntaxNode.new(input, (index-1)...index) if r6 == true
|
105
105
|
r0 = r6
|
106
106
|
else
|
107
|
-
r7 =
|
107
|
+
r7 = _nt_hstring
|
108
108
|
if r7
|
109
109
|
r7 = SyntaxNode.new(input, (index-1)...index) if r7 == true
|
110
110
|
r0 = r7
|
111
111
|
else
|
112
|
-
r8 =
|
112
|
+
r8 = _nt_bstring
|
113
113
|
if r8
|
114
114
|
r8 = SyntaxNode.new(input, (index-1)...index) if r8 == true
|
115
115
|
r0 = r8
|
116
116
|
else
|
117
|
-
r9 =
|
117
|
+
r9 = _nt_b64string
|
118
118
|
if r9
|
119
119
|
r9 = SyntaxNode.new(input, (index-1)...index) if r9 == true
|
120
120
|
r0 = r9
|
121
121
|
else
|
122
|
-
r10 =
|
122
|
+
r10 = _nt_array
|
123
123
|
if r10
|
124
124
|
r10 = SyntaxNode.new(input, (index-1)...index) if r10 == true
|
125
125
|
r0 = r10
|
126
126
|
else
|
127
|
-
r11 =
|
127
|
+
r11 = _nt_map
|
128
128
|
if r11
|
129
129
|
r11 = SyntaxNode.new(input, (index-1)...index) if r11 == true
|
130
130
|
r0 = r11
|
131
131
|
else
|
132
|
-
|
133
|
-
|
132
|
+
r12 = _nt_streamstring
|
133
|
+
if r12
|
134
|
+
r12 = SyntaxNode.new(input, (index-1)...index) if r12 == true
|
135
|
+
r0 = r12
|
136
|
+
else
|
137
|
+
@index = i0
|
138
|
+
r0 = nil
|
139
|
+
end
|
134
140
|
end
|
135
141
|
end
|
136
142
|
end
|
@@ -364,6 +370,113 @@ module CBOR_DIAG
|
|
364
370
|
r0
|
365
371
|
end
|
366
372
|
|
373
|
+
module Hnumber0
|
374
|
+
end
|
375
|
+
|
376
|
+
module Hnumber1
|
377
|
+
def ip
|
378
|
+
elements[0]
|
379
|
+
end
|
380
|
+
end
|
381
|
+
|
382
|
+
module Hnumber2
|
383
|
+
def to_rb
|
384
|
+
Integer(ip.text_value)
|
385
|
+
end
|
386
|
+
end
|
387
|
+
|
388
|
+
def _nt_hnumber
|
389
|
+
start_index = index
|
390
|
+
if node_cache[:hnumber].has_key?(index)
|
391
|
+
cached = node_cache[:hnumber][index]
|
392
|
+
if cached
|
393
|
+
node_cache[:hnumber][index] = cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
|
394
|
+
@index = cached.interval.end
|
395
|
+
end
|
396
|
+
return cached
|
397
|
+
end
|
398
|
+
|
399
|
+
i0, s0 = index, []
|
400
|
+
i1, s1 = index, []
|
401
|
+
if has_terminal?(@regexps[gr = '\A[-+]'] ||= Regexp.new(gr), :regexp, index)
|
402
|
+
r3 = true
|
403
|
+
@index += 1
|
404
|
+
else
|
405
|
+
terminal_parse_failure('[-+]')
|
406
|
+
r3 = nil
|
407
|
+
end
|
408
|
+
if r3
|
409
|
+
r2 = r3
|
410
|
+
else
|
411
|
+
r2 = instantiate_node(SyntaxNode,input, index...index)
|
412
|
+
end
|
413
|
+
s1 << r2
|
414
|
+
if r2
|
415
|
+
if (match_len = has_terminal?('0', false, index))
|
416
|
+
r4 = true
|
417
|
+
@index += match_len
|
418
|
+
else
|
419
|
+
terminal_parse_failure('\'0\'')
|
420
|
+
r4 = nil
|
421
|
+
end
|
422
|
+
s1 << r4
|
423
|
+
if r4
|
424
|
+
if has_terminal?(@regexps[gr = '\A[xX]'] ||= Regexp.new(gr), :regexp, index)
|
425
|
+
r5 = true
|
426
|
+
@index += 1
|
427
|
+
else
|
428
|
+
terminal_parse_failure('[xX]')
|
429
|
+
r5 = nil
|
430
|
+
end
|
431
|
+
s1 << r5
|
432
|
+
if r5
|
433
|
+
s6, i6 = [], index
|
434
|
+
loop do
|
435
|
+
if has_terminal?(@regexps[gr = '\A[0-9a-fA-F]'] ||= Regexp.new(gr), :regexp, index)
|
436
|
+
r7 = true
|
437
|
+
@index += 1
|
438
|
+
else
|
439
|
+
terminal_parse_failure('[0-9a-fA-F]')
|
440
|
+
r7 = nil
|
441
|
+
end
|
442
|
+
if r7
|
443
|
+
s6 << r7
|
444
|
+
else
|
445
|
+
break
|
446
|
+
end
|
447
|
+
end
|
448
|
+
if s6.empty?
|
449
|
+
@index = i6
|
450
|
+
r6 = nil
|
451
|
+
else
|
452
|
+
r6 = instantiate_node(SyntaxNode,input, i6...index, s6)
|
453
|
+
end
|
454
|
+
s1 << r6
|
455
|
+
end
|
456
|
+
end
|
457
|
+
end
|
458
|
+
if s1.last
|
459
|
+
r1 = instantiate_node(SyntaxNode,input, i1...index, s1)
|
460
|
+
r1.extend(Hnumber0)
|
461
|
+
else
|
462
|
+
@index = i1
|
463
|
+
r1 = nil
|
464
|
+
end
|
465
|
+
s0 << r1
|
466
|
+
if s0.last
|
467
|
+
r0 = instantiate_node(SyntaxNode,input, i0...index, s0)
|
468
|
+
r0.extend(Hnumber1)
|
469
|
+
r0.extend(Hnumber2)
|
470
|
+
else
|
471
|
+
@index = i0
|
472
|
+
r0 = nil
|
473
|
+
end
|
474
|
+
|
475
|
+
node_cache[:hnumber][start_index] = r0
|
476
|
+
|
477
|
+
r0
|
478
|
+
end
|
479
|
+
|
367
480
|
module Infin0
|
368
481
|
def to_rb; Float::INFINITY end
|
369
482
|
end
|
@@ -850,6 +963,7 @@ module CBOR_DIAG
|
|
850
963
|
else
|
851
964
|
r1 = instantiate_node(SyntaxNode,input, i1...index, s1)
|
852
965
|
r1.extend(StringPart0)
|
966
|
+
r1.extend(StringPart0)
|
853
967
|
end
|
854
968
|
if r1
|
855
969
|
r1 = SyntaxNode.new(input, (index-1)...index) if r1 == true
|
@@ -938,7 +1052,7 @@ module CBOR_DIAG
|
|
938
1052
|
r11 = nil
|
939
1053
|
else
|
940
1054
|
if s11.size < 2
|
941
|
-
terminal_failures.pop
|
1055
|
+
@terminal_failures.pop
|
942
1056
|
end
|
943
1057
|
r11 = instantiate_node(SyntaxNode,input, i11...index, s11)
|
944
1058
|
end
|
@@ -1005,7 +1119,7 @@ module CBOR_DIAG
|
|
1005
1119
|
r17 = nil
|
1006
1120
|
else
|
1007
1121
|
if s17.size < 2
|
1008
|
-
terminal_failures.pop
|
1122
|
+
@terminal_failures.pop
|
1009
1123
|
end
|
1010
1124
|
r17 = instantiate_node(SyntaxNode,input, i17...index, s17)
|
1011
1125
|
end
|
@@ -1079,7 +1193,7 @@ module CBOR_DIAG
|
|
1079
1193
|
r24 = nil
|
1080
1194
|
else
|
1081
1195
|
if s24.size < 3
|
1082
|
-
terminal_failures.pop
|
1196
|
+
@terminal_failures.pop
|
1083
1197
|
end
|
1084
1198
|
r24 = instantiate_node(SyntaxNode,input, i24...index, s24)
|
1085
1199
|
end
|
@@ -1138,7 +1252,7 @@ module CBOR_DIAG
|
|
1138
1252
|
r29 = nil
|
1139
1253
|
else
|
1140
1254
|
if s29.size < 2
|
1141
|
-
terminal_failures.pop
|
1255
|
+
@terminal_failures.pop
|
1142
1256
|
end
|
1143
1257
|
r29 = instantiate_node(SyntaxNode,input, i29...index, s29)
|
1144
1258
|
end
|
@@ -1345,6 +1459,7 @@ module CBOR_DIAG
|
|
1345
1459
|
else
|
1346
1460
|
r1 = instantiate_node(SyntaxNode,input, i1...index, s1)
|
1347
1461
|
r1.extend(StringPart10)
|
1462
|
+
r1.extend(StringPart10)
|
1348
1463
|
end
|
1349
1464
|
if r1
|
1350
1465
|
r1 = SyntaxNode.new(input, (index-1)...index) if r1 == true
|
@@ -1433,7 +1548,7 @@ module CBOR_DIAG
|
|
1433
1548
|
r11 = nil
|
1434
1549
|
else
|
1435
1550
|
if s11.size < 2
|
1436
|
-
terminal_failures.pop
|
1551
|
+
@terminal_failures.pop
|
1437
1552
|
end
|
1438
1553
|
r11 = instantiate_node(SyntaxNode,input, i11...index, s11)
|
1439
1554
|
end
|
@@ -1500,7 +1615,7 @@ module CBOR_DIAG
|
|
1500
1615
|
r17 = nil
|
1501
1616
|
else
|
1502
1617
|
if s17.size < 2
|
1503
|
-
terminal_failures.pop
|
1618
|
+
@terminal_failures.pop
|
1504
1619
|
end
|
1505
1620
|
r17 = instantiate_node(SyntaxNode,input, i17...index, s17)
|
1506
1621
|
end
|
@@ -1574,7 +1689,7 @@ module CBOR_DIAG
|
|
1574
1689
|
r24 = nil
|
1575
1690
|
else
|
1576
1691
|
if s24.size < 3
|
1577
|
-
terminal_failures.pop
|
1692
|
+
@terminal_failures.pop
|
1578
1693
|
end
|
1579
1694
|
r24 = instantiate_node(SyntaxNode,input, i24...index, s24)
|
1580
1695
|
end
|
@@ -1633,7 +1748,7 @@ module CBOR_DIAG
|
|
1633
1748
|
r29 = nil
|
1634
1749
|
else
|
1635
1750
|
if s29.size < 2
|
1636
|
-
terminal_failures.pop
|
1751
|
+
@terminal_failures.pop
|
1637
1752
|
end
|
1638
1753
|
r29 = instantiate_node(SyntaxNode,input, i29...index, s29)
|
1639
1754
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: cbor-diag
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Carsten Bormann
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2016-07-18 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -82,7 +82,7 @@ files:
|
|
82
82
|
- lib/half.rb
|
83
83
|
homepage: http://cbor.io/
|
84
84
|
licenses:
|
85
|
-
- Apache
|
85
|
+
- Apache-2.0
|
86
86
|
metadata: {}
|
87
87
|
post_install_message:
|
88
88
|
rdoc_options: []
|
@@ -100,9 +100,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
100
100
|
version: '0'
|
101
101
|
requirements: []
|
102
102
|
rubyforge_project:
|
103
|
-
rubygems_version: 2.
|
103
|
+
rubygems_version: 2.5.1
|
104
104
|
signing_key:
|
105
105
|
specification_version: 4
|
106
106
|
summary: CBOR (Concise Binary Object Representation) diagnostic notation
|
107
107
|
test_files: []
|
108
|
-
has_rdoc: false
|