cbor-diag 0.5.1 → 0.5.2
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 +5 -5
- data/bin/diag2cbor.rb +1 -1
- data/cbor-diag.gemspec +1 -1
- data/lib/cbor-diag-parser.rb +44 -44
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: cae376f67f107a4ed6bb608651c4bec9cb0cfcd5c1358b550de3526f8f0074b4
|
4
|
+
data.tar.gz: f8bb4444a580def29def96821f5bf6b66df06a7952a408b519f53d4588671b1a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4959ea26cad2ed447d866a2c10ef7dac25e43719c5b79056fdfa6162277904798fa95be5029b6ba9eca51e707487c97fe9a9647cb4257e685eebf7ae5d3fa2b0
|
7
|
+
data.tar.gz: ddf871f586e7d120bb0395a6c52eba584116640edf9f88eee85e7ac289543c346f244cd7dac01e466d169327672004a36a3a20fae14753fe4594ba59ef8209aa
|
data/bin/diag2cbor.rb
CHANGED
data/cbor-diag.gemspec
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
Gem::Specification.new do |s|
|
2
2
|
s.name = "cbor-diag"
|
3
|
-
s.version = "0.5.
|
3
|
+
s.version = "0.5.2"
|
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"
|
data/lib/cbor-diag-parser.rb
CHANGED
@@ -74,62 +74,62 @@ module CBOR_DIAG
|
|
74
74
|
end
|
75
75
|
|
76
76
|
i0 = index
|
77
|
-
r1 =
|
77
|
+
r1 = _nt_string
|
78
78
|
if r1
|
79
79
|
r1 = SyntaxNode.new(input, (index-1)...index) if r1 == true
|
80
80
|
r0 = r1
|
81
81
|
else
|
82
|
-
r2 =
|
82
|
+
r2 = _nt_map
|
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_array
|
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_tagged
|
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_hnumber
|
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_fnumber
|
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_infin
|
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_simple
|
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_hstring
|
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_bstring
|
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_b64string
|
128
128
|
if r11
|
129
129
|
r11 = SyntaxNode.new(input, (index-1)...index) if r11 == true
|
130
130
|
r0 = r11
|
131
131
|
else
|
132
|
-
r12 =
|
132
|
+
r12 = _nt_embedded
|
133
133
|
if r12
|
134
134
|
r12 = SyntaxNode.new(input, (index-1)...index) if r12 == true
|
135
135
|
r0 = r12
|
@@ -936,7 +936,7 @@ module CBOR_DIAG
|
|
936
936
|
module String1
|
937
937
|
#'
|
938
938
|
def to_rb
|
939
|
-
s.elements.map(&:partval).join
|
939
|
+
s.elements.map(&:partval).join.force_encoding(Encoding::UTF_8)
|
940
940
|
end
|
941
941
|
end
|
942
942
|
|
@@ -1033,7 +1033,7 @@ module CBOR_DIAG
|
|
1033
1033
|
|
1034
1034
|
module StringPart6
|
1035
1035
|
def partval; (((s.text_value.to_i(16) & 0x3FF) << 10) +
|
1036
|
-
(t.text_value.to_i(16) & 0x3FF) + 0x10000).chr(Encoding::UTF_8) end
|
1036
|
+
(t.text_value.to_i(16) & 0x3FF) + 0x10000).chr(Encoding::UTF_8).b end
|
1037
1037
|
end
|
1038
1038
|
|
1039
1039
|
module StringPart7
|
@@ -1049,7 +1049,7 @@ module CBOR_DIAG
|
|
1049
1049
|
end
|
1050
1050
|
|
1051
1051
|
module StringPart10
|
1052
|
-
def partval; s.text_value.to_i(16).chr(Encoding::UTF_8) end
|
1052
|
+
def partval; s.text_value.to_i(16).chr(Encoding::UTF_8).b end
|
1053
1053
|
end
|
1054
1054
|
|
1055
1055
|
def _nt_string_part
|
@@ -1459,7 +1459,7 @@ module CBOR_DIAG
|
|
1459
1459
|
if r1
|
1460
1460
|
s2, i2 = [], index
|
1461
1461
|
loop do
|
1462
|
-
r3 =
|
1462
|
+
r3 = _nt_bstring_part
|
1463
1463
|
if r3
|
1464
1464
|
s2 << r3
|
1465
1465
|
else
|
@@ -1493,17 +1493,17 @@ module CBOR_DIAG
|
|
1493
1493
|
r0
|
1494
1494
|
end
|
1495
1495
|
|
1496
|
-
module
|
1496
|
+
module BstringPart0
|
1497
1497
|
def partval; text_value end
|
1498
1498
|
end
|
1499
1499
|
|
1500
|
-
module
|
1500
|
+
module BstringPart1
|
1501
1501
|
def s
|
1502
1502
|
elements[1]
|
1503
1503
|
end
|
1504
1504
|
end
|
1505
1505
|
|
1506
|
-
module
|
1506
|
+
module BstringPart2
|
1507
1507
|
#"
|
1508
1508
|
def partval
|
1509
1509
|
v = s.text_value
|
@@ -1511,13 +1511,13 @@ module CBOR_DIAG
|
|
1511
1511
|
end
|
1512
1512
|
end
|
1513
1513
|
|
1514
|
-
module
|
1514
|
+
module BstringPart3
|
1515
1515
|
end
|
1516
1516
|
|
1517
|
-
module
|
1517
|
+
module BstringPart4
|
1518
1518
|
end
|
1519
1519
|
|
1520
|
-
module
|
1520
|
+
module BstringPart5
|
1521
1521
|
def s
|
1522
1522
|
elements[1]
|
1523
1523
|
end
|
@@ -1527,33 +1527,33 @@ module CBOR_DIAG
|
|
1527
1527
|
end
|
1528
1528
|
end
|
1529
1529
|
|
1530
|
-
module
|
1530
|
+
module BstringPart6
|
1531
1531
|
def partval; (((s.text_value.to_i(16) & 0x3FF) << 10) +
|
1532
1532
|
(t.text_value.to_i(16) & 0x3FF) + 0x10000).chr(Encoding::UTF_8) end
|
1533
1533
|
end
|
1534
1534
|
|
1535
|
-
module
|
1535
|
+
module BstringPart7
|
1536
1536
|
end
|
1537
1537
|
|
1538
|
-
module
|
1538
|
+
module BstringPart8
|
1539
1539
|
end
|
1540
1540
|
|
1541
|
-
module
|
1541
|
+
module BstringPart9
|
1542
1542
|
def s
|
1543
1543
|
elements[1]
|
1544
1544
|
end
|
1545
1545
|
end
|
1546
1546
|
|
1547
|
-
module
|
1547
|
+
module BstringPart10
|
1548
1548
|
def partval; s.text_value.to_i(16).chr(Encoding::UTF_8) end
|
1549
1549
|
end
|
1550
1550
|
|
1551
|
-
def
|
1551
|
+
def _nt_bstring_part
|
1552
1552
|
start_index = index
|
1553
|
-
if node_cache[:
|
1554
|
-
cached = node_cache[:
|
1553
|
+
if node_cache[:bstring_part].has_key?(index)
|
1554
|
+
cached = node_cache[:bstring_part][index]
|
1555
1555
|
if cached
|
1556
|
-
node_cache[:
|
1556
|
+
node_cache[:bstring_part][index] = cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
|
1557
1557
|
@index = cached.interval.end
|
1558
1558
|
end
|
1559
1559
|
return cached
|
@@ -1580,8 +1580,8 @@ module CBOR_DIAG
|
|
1580
1580
|
r1 = nil
|
1581
1581
|
else
|
1582
1582
|
r1 = instantiate_node(SyntaxNode,input, i1...index, s1)
|
1583
|
-
r1.extend(
|
1584
|
-
r1.extend(
|
1583
|
+
r1.extend(BstringPart0)
|
1584
|
+
r1.extend(BstringPart0)
|
1585
1585
|
end
|
1586
1586
|
if r1
|
1587
1587
|
r1 = SyntaxNode.new(input, (index-1)...index) if r1 == true
|
@@ -1608,8 +1608,8 @@ module CBOR_DIAG
|
|
1608
1608
|
end
|
1609
1609
|
if s3.last
|
1610
1610
|
r3 = instantiate_node(SyntaxNode,input, i3...index, s3)
|
1611
|
-
r3.extend(
|
1612
|
-
r3.extend(
|
1611
|
+
r3.extend(BstringPart1)
|
1612
|
+
r3.extend(BstringPart2)
|
1613
1613
|
else
|
1614
1614
|
@index = i3
|
1615
1615
|
r3 = nil
|
@@ -1679,7 +1679,7 @@ module CBOR_DIAG
|
|
1679
1679
|
end
|
1680
1680
|
if s8.last
|
1681
1681
|
r8 = instantiate_node(SyntaxNode,input, i8...index, s8)
|
1682
|
-
r8.extend(
|
1682
|
+
r8.extend(BstringPart3)
|
1683
1683
|
else
|
1684
1684
|
@index = i8
|
1685
1685
|
r8 = nil
|
@@ -1746,7 +1746,7 @@ module CBOR_DIAG
|
|
1746
1746
|
end
|
1747
1747
|
if s14.last
|
1748
1748
|
r14 = instantiate_node(SyntaxNode,input, i14...index, s14)
|
1749
|
-
r14.extend(
|
1749
|
+
r14.extend(BstringPart4)
|
1750
1750
|
else
|
1751
1751
|
@index = i14
|
1752
1752
|
r14 = nil
|
@@ -1757,8 +1757,8 @@ module CBOR_DIAG
|
|
1757
1757
|
end
|
1758
1758
|
if s6.last
|
1759
1759
|
r6 = instantiate_node(SyntaxNode,input, i6...index, s6)
|
1760
|
-
r6.extend(
|
1761
|
-
r6.extend(
|
1760
|
+
r6.extend(BstringPart5)
|
1761
|
+
r6.extend(BstringPart6)
|
1762
1762
|
else
|
1763
1763
|
@index = i6
|
1764
1764
|
r6 = nil
|
@@ -1819,7 +1819,7 @@ module CBOR_DIAG
|
|
1819
1819
|
end
|
1820
1820
|
if s22.last
|
1821
1821
|
r22 = instantiate_node(SyntaxNode,input, i22...index, s22)
|
1822
|
-
r22.extend(
|
1822
|
+
r22.extend(BstringPart7)
|
1823
1823
|
else
|
1824
1824
|
@index = i22
|
1825
1825
|
r22 = nil
|
@@ -1879,7 +1879,7 @@ module CBOR_DIAG
|
|
1879
1879
|
end
|
1880
1880
|
if s26.last
|
1881
1881
|
r26 = instantiate_node(SyntaxNode,input, i26...index, s26)
|
1882
|
-
r26.extend(
|
1882
|
+
r26.extend(BstringPart8)
|
1883
1883
|
else
|
1884
1884
|
@index = i26
|
1885
1885
|
r26 = nil
|
@@ -1896,8 +1896,8 @@ module CBOR_DIAG
|
|
1896
1896
|
end
|
1897
1897
|
if s19.last
|
1898
1898
|
r19 = instantiate_node(SyntaxNode,input, i19...index, s19)
|
1899
|
-
r19.extend(
|
1900
|
-
r19.extend(
|
1899
|
+
r19.extend(BstringPart9)
|
1900
|
+
r19.extend(BstringPart10)
|
1901
1901
|
else
|
1902
1902
|
@index = i19
|
1903
1903
|
r19 = nil
|
@@ -1913,7 +1913,7 @@ module CBOR_DIAG
|
|
1913
1913
|
end
|
1914
1914
|
end
|
1915
1915
|
|
1916
|
-
node_cache[:
|
1916
|
+
node_cache[:bstring_part][start_index] = r0
|
1917
1917
|
|
1918
1918
|
r0
|
1919
1919
|
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.5.
|
4
|
+
version: 0.5.2
|
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: 2018-01-17 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -106,7 +106,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
106
106
|
version: '0'
|
107
107
|
requirements: []
|
108
108
|
rubyforge_project:
|
109
|
-
rubygems_version: 2.
|
109
|
+
rubygems_version: 2.7.4
|
110
110
|
signing_key:
|
111
111
|
specification_version: 4
|
112
112
|
summary: CBOR (Concise Binary Object Representation) diagnostic notation
|