edn-abnf 0.5.8 → 0.5.9
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 +4 -0
- data/edn-abnf.gemspec +1 -1
- data/lib/parser/edn-util.rb +33 -7
- 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: 806ffbc9b5f1324cd2ae94381fc1260144ed5a8dc62c29a45d42335fb5424a19
|
4
|
+
data.tar.gz: bcfcf9de27c7fe957601ee45ba33dec200314ddab4015543cf2f76aec39a3c6a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d3897fe3c7e47eadb5d3d29b90ed663d397254b802ce5fe54b493dbf75a1d3a808b04426e80c5b5e15410ab75d60056b4ca0f7a8b165140a4ba72ff49950cace
|
7
|
+
data.tar.gz: 6aab126c0f00fc8b2b6b43bffb9bd8902c79f6ae3df2fa1f6b7a866d277ed27825aa8f48d20294b24e44f62f4d5b7b9a6452a6e33bcb234476449a9901c0b827
|
data/bin/edn-abnf
CHANGED
@@ -57,6 +57,10 @@ begin
|
|
57
57
|
opts.on("-i", "--[no-]integrated", "use integrated parsers where available") do |v|
|
58
58
|
$options.integrated = v
|
59
59
|
end
|
60
|
+
opts.on("--[no-]level", "use separate level shifter") do |v|
|
61
|
+
$options.level = v
|
62
|
+
$stdout.sync = true
|
63
|
+
end
|
60
64
|
opts.on("-eEDN", "--e=EDN", "supply EDN on command line") do |v|
|
61
65
|
$options.edn = v
|
62
66
|
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.9"
|
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/parser/edn-util.rb
CHANGED
@@ -41,19 +41,45 @@ class Treetop::Runtime::SyntaxNode
|
|
41
41
|
end
|
42
42
|
def app_parser_level1_diagnostics(e, node)
|
43
43
|
outbytes = 0
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
44
|
+
if $options.level # do manual level-shifting
|
45
|
+
input = node.input
|
46
|
+
ol1pos = l1pos = node.interval.begin
|
47
|
+
while outbytes <= e.position
|
48
|
+
outbytes += 1
|
49
|
+
ol1pos = l1pos
|
50
|
+
c1 = input[l1pos]
|
51
|
+
if c1 == "\\" # escapable-s
|
52
|
+
c2 = input[l1pos += 1]
|
53
|
+
if c2 == "u" # hexchar-s
|
54
|
+
c3 = input[l1pos += 1]
|
55
|
+
if c3 == "{"
|
56
|
+
l1pos = input.index("}", l1pos)
|
57
|
+
else
|
58
|
+
if (input[l1pos, 4].to_i(16) & 0xFC00) == 0xD800 # high-surrogate
|
59
|
+
l1pos += 6 # low-surrogate
|
60
|
+
end
|
61
|
+
l1pos += 3 # non-surrogate
|
62
|
+
end
|
63
|
+
end
|
64
|
+
end
|
65
|
+
l1pos += 1
|
66
|
+
end
|
67
|
+
intv = ol1pos...l1pos
|
68
|
+
else
|
69
|
+
intv = node.interval.end...(node.interval.end+1) # default: closing '
|
70
|
+
node.elements.each_with_index do |el, i|
|
71
|
+
outbytes += el.ast.size
|
72
|
+
if outbytes > e.position
|
73
|
+
intv = el.interval
|
74
|
+
break
|
75
|
+
end
|
50
76
|
end
|
51
77
|
end
|
52
78
|
failure_index = intv.begin
|
53
79
|
failure_line = node.input.line_of(failure_index)
|
54
80
|
failure_column = node.input.column_of(failure_index)
|
81
|
+
reason = "** Line #{failure_line}, column #{failure_column}:\n"
|
55
82
|
if line = node.input.lines.to_a[failure_line - 1]
|
56
|
-
reason = "** Line #{failure_line}, column #{failure_column}:\n"
|
57
83
|
reason << line
|
58
84
|
reason << "\n#{'~' * (failure_column - 1)}#{'^' * intv.size}"
|
59
85
|
end
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
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.9
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Carsten Bormann
|
8
8
|
bindir: bin
|
9
9
|
cert_chain: []
|
10
|
-
date: 2025-07-
|
10
|
+
date: 2025-07-08 00:00:00.000000000 Z
|
11
11
|
dependencies:
|
12
12
|
- !ruby/object:Gem::Dependency
|
13
13
|
name: bundler
|