cbor-diag 0.2.6 → 0.2.7

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 10976372c461c25a70671e224b8136d5c3d949d5
4
- data.tar.gz: d0bf29799ded2f7abb0bb544c7902ce58eac4978
3
+ metadata.gz: 0704b1e17c083c9ef5d176e5ea9d60510149c47f
4
+ data.tar.gz: ad8ff1c34855e5c2df358938a457c256015a6f37
5
5
  SHA512:
6
- metadata.gz: 413152c4d8cb22cd01bc287060063bdbd5fa5d22ce5644aa7b6278a93a4db2cf881c850227855d0ea1aa7169fdef1bff7ae87bf20e6562619982e8c2d2a5b81f
7
- data.tar.gz: 17d2a17a00fcc1e5c76ed31928ddf003c0222c99a6a65ab41e204198654530823aadae6708e8cfe955db8fd2c729d4aaa8ff5e491c42464f88cee96e5dbd759d
6
+ metadata.gz: ac29ccd1f9e7f34b152b88d33ed55c9daf4118268c42ddd1ebfb143d68fee6a2f8a5fa7c7249c81b5b47549a5df57e17cd641b66cc7cc2db101cc085f486fd3c
7
+ data.tar.gz: 2b01d4aabf59a15f20fb39a47cc44356e52d1336cf3e2ee4f4e20efcfdc34ea94b763f0faaa102adf1a385df8eab92d92fe5db2298071d5015126511941cdff9
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.2.6"
3
+ s.version = "0.2.7"
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"
@@ -119,23 +119,29 @@ module CBOR_DIAG
119
119
  r9 = SyntaxNode.new(input, (index-1)...index) if r9 == true
120
120
  r0 = r9
121
121
  else
122
- r10 = _nt_array
122
+ r10 = _nt_embedded
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 = _nt_map
127
+ r11 = _nt_array
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 = _nt_streamstring
132
+ r12 = _nt_map
133
133
  if r12
134
134
  r12 = SyntaxNode.new(input, (index-1)...index) if r12 == true
135
135
  r0 = r12
136
136
  else
137
- @index = i0
138
- r0 = nil
137
+ r13 = _nt_streamstring
138
+ if r13
139
+ r13 = SyntaxNode.new(input, (index-1)...index) if r13 == true
140
+ r0 = r13
141
+ else
142
+ @index = i0
143
+ r0 = nil
144
+ end
139
145
  end
140
146
  end
141
147
  end
@@ -1912,6 +1918,155 @@ module CBOR_DIAG
1912
1918
  r0
1913
1919
  end
1914
1920
 
1921
+ module Embedded0
1922
+ def text
1923
+ elements[0]
1924
+ end
1925
+
1926
+ end
1927
+
1928
+ module Embedded1
1929
+ def s
1930
+ elements[1]
1931
+ end
1932
+
1933
+ end
1934
+
1935
+ module Embedded2
1936
+ def to_rb
1937
+ if se = s.elements
1938
+ [se[0], *se[1].elements].map{|x| CBOR.encode(x.to_rb)}.join.b
1939
+ else
1940
+ "".b
1941
+ end
1942
+ end
1943
+ end
1944
+
1945
+ def _nt_embedded
1946
+ start_index = index
1947
+ if node_cache[:embedded].has_key?(index)
1948
+ cached = node_cache[:embedded][index]
1949
+ if cached
1950
+ node_cache[:embedded][index] = cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
1951
+ @index = cached.interval.end
1952
+ end
1953
+ return cached
1954
+ end
1955
+
1956
+ i0, s0 = index, []
1957
+ if (match_len = has_terminal?("<<", false, index))
1958
+ r1 = instantiate_node(SyntaxNode,input, index...(index + match_len))
1959
+ @index += match_len
1960
+ else
1961
+ terminal_parse_failure('"<<"')
1962
+ r1 = nil
1963
+ end
1964
+ s0 << r1
1965
+ if r1
1966
+ i3, s3 = index, []
1967
+ r4 = _nt_text
1968
+ s3 << r4
1969
+ if r4
1970
+ s5, i5 = [], index
1971
+ loop do
1972
+ r6 = _nt_emb1
1973
+ if r6
1974
+ s5 << r6
1975
+ else
1976
+ break
1977
+ end
1978
+ end
1979
+ r5 = instantiate_node(SyntaxNode,input, i5...index, s5)
1980
+ s3 << r5
1981
+ end
1982
+ if s3.last
1983
+ r3 = instantiate_node(SyntaxNode,input, i3...index, s3)
1984
+ r3.extend(Embedded0)
1985
+ else
1986
+ @index = i3
1987
+ r3 = nil
1988
+ end
1989
+ if r3
1990
+ r2 = r3
1991
+ else
1992
+ r2 = instantiate_node(SyntaxNode,input, index...index)
1993
+ end
1994
+ s0 << r2
1995
+ if r2
1996
+ if (match_len = has_terminal?(">>", false, index))
1997
+ r7 = instantiate_node(SyntaxNode,input, index...(index + match_len))
1998
+ @index += match_len
1999
+ else
2000
+ terminal_parse_failure('">>"')
2001
+ r7 = nil
2002
+ end
2003
+ s0 << r7
2004
+ end
2005
+ end
2006
+ if s0.last
2007
+ r0 = instantiate_node(SyntaxNode,input, i0...index, s0)
2008
+ r0.extend(Embedded1)
2009
+ r0.extend(Embedded2)
2010
+ else
2011
+ @index = i0
2012
+ r0 = nil
2013
+ end
2014
+
2015
+ node_cache[:embedded][start_index] = r0
2016
+
2017
+ r0
2018
+ end
2019
+
2020
+ module Emb10
2021
+ def s
2022
+ elements[1]
2023
+ end
2024
+ end
2025
+
2026
+ module Emb11
2027
+ def to_rb
2028
+ s.to_rb
2029
+ end
2030
+ end
2031
+
2032
+ def _nt_emb1
2033
+ start_index = index
2034
+ if node_cache[:emb1].has_key?(index)
2035
+ cached = node_cache[:emb1][index]
2036
+ if cached
2037
+ node_cache[:emb1][index] = cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
2038
+ @index = cached.interval.end
2039
+ end
2040
+ return cached
2041
+ end
2042
+
2043
+ i0, s0 = index, []
2044
+ if (match_len = has_terminal?(",", false, index))
2045
+ r1 = true
2046
+ @index += match_len
2047
+ else
2048
+ terminal_parse_failure('","')
2049
+ r1 = nil
2050
+ end
2051
+ s0 << r1
2052
+ if r1
2053
+ r2 = _nt_text
2054
+ s0 << r2
2055
+ end
2056
+ if s0.last
2057
+ r0 = instantiate_node(SyntaxNode,input, i0...index, s0)
2058
+ r0.extend(Emb10)
2059
+ r0.extend(Emb11)
2060
+ else
2061
+ @index = i0
2062
+ r0 = nil
2063
+ end
2064
+
2065
+ node_cache[:emb1][start_index] = r0
2066
+
2067
+ r0
2068
+ end
2069
+
1915
2070
  module Hexdigit0
1916
2071
  def dig
1917
2072
  elements[0]
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: cbor-diag
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.6
4
+ version: 0.2.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - Carsten Bormann