edn-abnf 0.0.11 → 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/bin/edn-abnf +51 -4
- data/edn-abnf.gemspec +1 -1
- data/lib/cbor-diagnostic-app/dt.rb +33 -0
- data/lib/cbor-diagnostic-app/dtgrammar.rb +700 -0
- data/lib/cbor-diagnostic-app/ip.rb +21 -0
- data/lib/cbor-diagnostic-app/ipgrammar.rb +1698 -0
- data/lib/parser/edn-util.rb +1 -0
- data/lib/parser/edngrammar.rb +117 -23
- metadata +6 -2
data/lib/parser/edn-util.rb
CHANGED
data/lib/parser/edngrammar.rb
CHANGED
@@ -1400,6 +1400,13 @@ module EDNGRAMMAR
|
|
1400
1400
|
|
1401
1401
|
end
|
1402
1402
|
|
1403
|
+
module AppPrefix1
|
1404
|
+
def ucalpha
|
1405
|
+
elements[0]
|
1406
|
+
end
|
1407
|
+
|
1408
|
+
end
|
1409
|
+
|
1403
1410
|
def _nt_app_prefix
|
1404
1411
|
start_index = index
|
1405
1412
|
if node_cache[:app_prefix].has_key?(index)
|
@@ -1411,28 +1418,64 @@ module EDNGRAMMAR
|
|
1411
1418
|
return cached
|
1412
1419
|
end
|
1413
1420
|
|
1414
|
-
i0
|
1415
|
-
|
1416
|
-
|
1417
|
-
|
1418
|
-
|
1421
|
+
i0 = index
|
1422
|
+
i1, s1 = index, []
|
1423
|
+
r2 = _nt_lcalpha
|
1424
|
+
s1 << r2
|
1425
|
+
if r2
|
1426
|
+
s3, i3 = [], index
|
1419
1427
|
loop do
|
1420
|
-
|
1421
|
-
if
|
1422
|
-
|
1428
|
+
r4 = _nt_lcalnum
|
1429
|
+
if r4
|
1430
|
+
s3 << r4
|
1423
1431
|
else
|
1424
1432
|
break
|
1425
1433
|
end
|
1426
1434
|
end
|
1427
|
-
|
1428
|
-
|
1435
|
+
r3 = instantiate_node(SyntaxNode,input, i3...index, s3)
|
1436
|
+
s1 << r3
|
1429
1437
|
end
|
1430
|
-
if
|
1431
|
-
|
1432
|
-
|
1438
|
+
if s1.last
|
1439
|
+
r1 = instantiate_node(SyntaxNode,input, i1...index, s1)
|
1440
|
+
r1.extend(AppPrefix0)
|
1433
1441
|
else
|
1434
|
-
@index =
|
1435
|
-
|
1442
|
+
@index = i1
|
1443
|
+
r1 = nil
|
1444
|
+
end
|
1445
|
+
if r1
|
1446
|
+
r1 = SyntaxNode.new(input, (index-1)...index) if r1 == true
|
1447
|
+
r0 = r1
|
1448
|
+
else
|
1449
|
+
i5, s5 = index, []
|
1450
|
+
r6 = _nt_ucalpha
|
1451
|
+
s5 << r6
|
1452
|
+
if r6
|
1453
|
+
s7, i7 = [], index
|
1454
|
+
loop do
|
1455
|
+
r8 = _nt_ucalnum
|
1456
|
+
if r8
|
1457
|
+
s7 << r8
|
1458
|
+
else
|
1459
|
+
break
|
1460
|
+
end
|
1461
|
+
end
|
1462
|
+
r7 = instantiate_node(SyntaxNode,input, i7...index, s7)
|
1463
|
+
s5 << r7
|
1464
|
+
end
|
1465
|
+
if s5.last
|
1466
|
+
r5 = instantiate_node(SyntaxNode,input, i5...index, s5)
|
1467
|
+
r5.extend(AppPrefix1)
|
1468
|
+
else
|
1469
|
+
@index = i5
|
1470
|
+
r5 = nil
|
1471
|
+
end
|
1472
|
+
if r5
|
1473
|
+
r5 = SyntaxNode.new(input, (index-1)...index) if r5 == true
|
1474
|
+
r0 = r5
|
1475
|
+
else
|
1476
|
+
@index = i0
|
1477
|
+
r0 = nil
|
1478
|
+
end
|
1436
1479
|
end
|
1437
1480
|
|
1438
1481
|
node_cache[:app_prefix][start_index] = r0
|
@@ -1456,7 +1499,8 @@ module EDNGRAMMAR
|
|
1456
1499
|
app = app_prefix.text_value
|
1457
1500
|
# Find a better place to put a default initialization
|
1458
1501
|
EDNGRAMMAR.const_set(:APPS, Hash.new { |h, k|
|
1459
|
-
h[k] = begin ::CBOR_DIAG.const_get("App_#{
|
1502
|
+
h[k] = begin ::CBOR_DIAG.const_get("App_#{k.downcase}")
|
1503
|
+
|
1460
1504
|
rescue NameError
|
1461
1505
|
raise ArgumentError, "cbor-diagnostic: Unknown application-oriented extension '#{k}'", caller
|
1462
1506
|
end
|
@@ -4096,6 +4140,62 @@ module EDNGRAMMAR
|
|
4096
4140
|
r0
|
4097
4141
|
end
|
4098
4142
|
|
4143
|
+
def _nt_ucalpha
|
4144
|
+
start_index = index
|
4145
|
+
if node_cache[:ucalpha].has_key?(index)
|
4146
|
+
cached = node_cache[:ucalpha][index]
|
4147
|
+
if cached
|
4148
|
+
node_cache[:ucalpha][index] = cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
|
4149
|
+
@index = cached.interval.end
|
4150
|
+
end
|
4151
|
+
return cached
|
4152
|
+
end
|
4153
|
+
|
4154
|
+
if has_terminal?(@regexps[gr = '\A[A-Z]'] ||= Regexp.new(gr), :regexp, index)
|
4155
|
+
r0 = instantiate_node(SyntaxNode,input, index...(index + 1))
|
4156
|
+
@index += 1
|
4157
|
+
else
|
4158
|
+
terminal_parse_failure('[A-Z]')
|
4159
|
+
r0 = nil
|
4160
|
+
end
|
4161
|
+
|
4162
|
+
node_cache[:ucalpha][start_index] = r0
|
4163
|
+
|
4164
|
+
r0
|
4165
|
+
end
|
4166
|
+
|
4167
|
+
def _nt_ucalnum
|
4168
|
+
start_index = index
|
4169
|
+
if node_cache[:ucalnum].has_key?(index)
|
4170
|
+
cached = node_cache[:ucalnum][index]
|
4171
|
+
if cached
|
4172
|
+
node_cache[:ucalnum][index] = cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
|
4173
|
+
@index = cached.interval.end
|
4174
|
+
end
|
4175
|
+
return cached
|
4176
|
+
end
|
4177
|
+
|
4178
|
+
i0 = index
|
4179
|
+
r1 = _nt_ucalpha
|
4180
|
+
if r1
|
4181
|
+
r1 = SyntaxNode.new(input, (index-1)...index) if r1 == true
|
4182
|
+
r0 = r1
|
4183
|
+
else
|
4184
|
+
r2 = _nt_DIGIT
|
4185
|
+
if r2
|
4186
|
+
r2 = SyntaxNode.new(input, (index-1)...index) if r2 == true
|
4187
|
+
r0 = r2
|
4188
|
+
else
|
4189
|
+
@index = i0
|
4190
|
+
r0 = nil
|
4191
|
+
end
|
4192
|
+
end
|
4193
|
+
|
4194
|
+
node_cache[:ucalnum][start_index] = r0
|
4195
|
+
|
4196
|
+
r0
|
4197
|
+
end
|
4198
|
+
|
4099
4199
|
def _nt_wordchar
|
4100
4200
|
start_index = index
|
4101
4201
|
if node_cache[:wordchar].has_key?(index)
|
@@ -4124,13 +4224,7 @@ module EDNGRAMMAR
|
|
4124
4224
|
r2 = SyntaxNode.new(input, (index-1)...index) if r2 == true
|
4125
4225
|
r0 = r2
|
4126
4226
|
else
|
4127
|
-
|
4128
|
-
r3 = true
|
4129
|
-
@index += 1
|
4130
|
-
else
|
4131
|
-
terminal_parse_failure('[A-Z]')
|
4132
|
-
r3 = nil
|
4133
|
-
end
|
4227
|
+
r3 = _nt_ucalpha
|
4134
4228
|
if r3
|
4135
4229
|
r3 = SyntaxNode.new(input, (index-1)...index) if r3 == true
|
4136
4230
|
r0 = r3
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: edn-abnf
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0
|
4
|
+
version: 0.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Carsten Bormann
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2023-10-
|
11
|
+
date: 2023-10-16 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -94,8 +94,12 @@ files:
|
|
94
94
|
- edn-abnf.gemspec
|
95
95
|
- lib/cbor-diagnostic-app/b64.rb
|
96
96
|
- lib/cbor-diagnostic-app/b64grammar.rb
|
97
|
+
- lib/cbor-diagnostic-app/dt.rb
|
98
|
+
- lib/cbor-diagnostic-app/dtgrammar.rb
|
97
99
|
- lib/cbor-diagnostic-app/h.rb
|
98
100
|
- lib/cbor-diagnostic-app/hgrammar.rb
|
101
|
+
- lib/cbor-diagnostic-app/ip.rb
|
102
|
+
- lib/cbor-diagnostic-app/ipgrammar.rb
|
99
103
|
- lib/edn-abnf.rb
|
100
104
|
- lib/parser/edn-util.rb
|
101
105
|
- lib/parser/edngrammar.rb
|