edn-abnf 0.1.2 → 0.1.3

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
  SHA256:
3
- metadata.gz: e8a0d869d43bdd2c5db0cb07f07e425f6cd1aafd83b22e6bca5620676b8b83c7
4
- data.tar.gz: b97edeff8726594b0502e67da2b0a5c57c32addfef0aa1a960fec35b8e939b93
3
+ metadata.gz: 85b82b93fb1a2682e147c29fc1012e178c48f8eae6d60243a7d87abd82c15a3f
4
+ data.tar.gz: d87f8ca88bc659c58629540a5f7fdefab86c53b09662e64e0851dbaadb8525cd
5
5
  SHA512:
6
- metadata.gz: e773170c39923fdad052d371804f2074664f42e66d17c193bc1d312aa78d12d889c509268c1c9e978407e1076ee1d28e539b7c85a135f162bb75f854b668b016
7
- data.tar.gz: 00a5c49dd6af1b9f1726d84f63d3b625b6d6ad5663ad80d51c3ef8f86151a559f47a7e694f8970eb585b351d3c728c76171fee0027b08d7a357f7af3b57fb711
6
+ metadata.gz: dc9cedb1fb36395595382a787268954d887bcf240a92379be884224dd383331750ebcbb3e97b6966364476cb26563357e9e15bc2f443936ee9d6cda6835ff77c
7
+ data.tar.gz: ae270987f189617657a5484824b44ef4468dfcd3911dc345492e0c2a56c9710af74086145fe55b5f4291c6373f5b0744a8c4ad4e637a426473a13866c189d042
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.1.2"
3
+ s.version = "0.1.3"
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"
@@ -3251,10 +3251,20 @@ module EDNGRAMMAR
3251
3251
  end
3252
3252
 
3253
3253
  module Hexchar0
3254
- def ast; hex_value.chr(Encoding::UTF_8) end
3255
3254
  end
3256
3255
 
3257
3256
  module Hexchar1
3257
+ end
3258
+
3259
+ module Hexchar2
3260
+ def ast; elements[1].hex_value.chr(Encoding::UTF_8) end
3261
+ end
3262
+
3263
+ module Hexchar3
3264
+ def ast; hex_value.chr(Encoding::UTF_8) end
3265
+ end
3266
+
3267
+ module Hexchar4
3258
3268
  def high_surrogate
3259
3269
  elements[0]
3260
3270
  end
@@ -3264,7 +3274,7 @@ module EDNGRAMMAR
3264
3274
  end
3265
3275
  end
3266
3276
 
3267
- module Hexchar2
3277
+ module Hexchar5
3268
3278
  def ast
3269
3279
  ((high_surrogate.ast << 10) + low_surrogate.ast + 0x10000).chr(Encoding::UTF_8)
3270
3280
  end
@@ -3282,54 +3292,142 @@ module EDNGRAMMAR
3282
3292
  end
3283
3293
 
3284
3294
  i0 = index
3285
- r1 = _nt_non_surrogate
3286
- r1.extend(Hexchar0)
3287
- r1.extend(Hexchar0)
3288
- if r1
3289
- r1 = SyntaxNode.new(input, (index-1)...index) if r1 == true
3290
- r0 = r1
3295
+ i1, s1 = index, []
3296
+ if (match_len = has_terminal?("{", false, index))
3297
+ r2 = true
3298
+ @index += match_len
3291
3299
  else
3292
- i2, s2 = index, []
3293
- r3 = _nt_high_surrogate
3294
- s2 << r3
3300
+ terminal_parse_failure('"{"')
3301
+ r2 = nil
3302
+ end
3303
+ s1 << r2
3304
+ if r2
3305
+ i3 = index
3306
+ i4, s4 = index, []
3307
+ s5, i5 = [], index
3308
+ loop do
3309
+ if (match_len = has_terminal?("0", false, index))
3310
+ r6 = true
3311
+ @index += match_len
3312
+ else
3313
+ terminal_parse_failure('"0"')
3314
+ r6 = nil
3315
+ end
3316
+ if r6
3317
+ s5 << r6
3318
+ else
3319
+ break
3320
+ end
3321
+ end
3322
+ if s5.empty?
3323
+ @index = i5
3324
+ r5 = nil
3325
+ else
3326
+ r5 = instantiate_node(SyntaxNode,input, i5...index, s5)
3327
+ end
3328
+ s4 << r5
3329
+ if r5
3330
+ r8 = _nt_hexscalar
3331
+ if r8
3332
+ r7 = r8
3333
+ else
3334
+ r7 = instantiate_node(SyntaxNode,input, index...index)
3335
+ end
3336
+ s4 << r7
3337
+ end
3338
+ if s4.last
3339
+ r4 = instantiate_node(SyntaxNode,input, i4...index, s4)
3340
+ r4.extend(Hexchar0)
3341
+ else
3342
+ @index = i4
3343
+ r4 = nil
3344
+ end
3345
+ if r4
3346
+ r4 = SyntaxNode.new(input, (index-1)...index) if r4 == true
3347
+ r3 = r4
3348
+ else
3349
+ r9 = _nt_hexscalar
3350
+ if r9
3351
+ r9 = SyntaxNode.new(input, (index-1)...index) if r9 == true
3352
+ r3 = r9
3353
+ else
3354
+ @index = i3
3355
+ r3 = nil
3356
+ end
3357
+ end
3358
+ s1 << r3
3295
3359
  if r3
3296
- if (match_len = has_terminal?("\\", false, index))
3297
- r4 = true
3360
+ if (match_len = has_terminal?("}", false, index))
3361
+ r10 = true
3298
3362
  @index += match_len
3299
3363
  else
3300
- terminal_parse_failure('"\\\\"')
3301
- r4 = nil
3364
+ terminal_parse_failure('"}"')
3365
+ r10 = nil
3302
3366
  end
3303
- s2 << r4
3304
- if r4
3305
- if (match_len = has_terminal?("u", false, index))
3306
- r5 = true
3367
+ s1 << r10
3368
+ end
3369
+ end
3370
+ if s1.last
3371
+ r1 = instantiate_node(SyntaxNode,input, i1...index, s1)
3372
+ r1.extend(Hexchar1)
3373
+ r1.extend(Hexchar2)
3374
+ else
3375
+ @index = i1
3376
+ r1 = nil
3377
+ end
3378
+ if r1
3379
+ r1 = SyntaxNode.new(input, (index-1)...index) if r1 == true
3380
+ r0 = r1
3381
+ else
3382
+ r11 = _nt_non_surrogate
3383
+ r11.extend(Hexchar3)
3384
+ r11.extend(Hexchar3)
3385
+ if r11
3386
+ r11 = SyntaxNode.new(input, (index-1)...index) if r11 == true
3387
+ r0 = r11
3388
+ else
3389
+ i12, s12 = index, []
3390
+ r13 = _nt_high_surrogate
3391
+ s12 << r13
3392
+ if r13
3393
+ if (match_len = has_terminal?("\\", false, index))
3394
+ r14 = true
3307
3395
  @index += match_len
3308
3396
  else
3309
- terminal_parse_failure('"u"')
3310
- r5 = nil
3397
+ terminal_parse_failure('"\\\\"')
3398
+ r14 = nil
3311
3399
  end
3312
- s2 << r5
3313
- if r5
3314
- r6 = _nt_low_surrogate
3315
- s2 << r6
3400
+ s12 << r14
3401
+ if r14
3402
+ if (match_len = has_terminal?("u", false, index))
3403
+ r15 = true
3404
+ @index += match_len
3405
+ else
3406
+ terminal_parse_failure('"u"')
3407
+ r15 = nil
3408
+ end
3409
+ s12 << r15
3410
+ if r15
3411
+ r16 = _nt_low_surrogate
3412
+ s12 << r16
3413
+ end
3316
3414
  end
3317
3415
  end
3318
- end
3319
- if s2.last
3320
- r2 = instantiate_node(SyntaxNode,input, i2...index, s2)
3321
- r2.extend(Hexchar1)
3322
- r2.extend(Hexchar2)
3323
- else
3324
- @index = i2
3325
- r2 = nil
3326
- end
3327
- if r2
3328
- r2 = SyntaxNode.new(input, (index-1)...index) if r2 == true
3329
- r0 = r2
3330
- else
3331
- @index = i0
3332
- r0 = nil
3416
+ if s12.last
3417
+ r12 = instantiate_node(SyntaxNode,input, i12...index, s12)
3418
+ r12.extend(Hexchar4)
3419
+ r12.extend(Hexchar5)
3420
+ else
3421
+ @index = i12
3422
+ r12 = nil
3423
+ end
3424
+ if r12
3425
+ r12 = SyntaxNode.new(input, (index-1)...index) if r12 == true
3426
+ r0 = r12
3427
+ else
3428
+ @index = i0
3429
+ r0 = nil
3430
+ end
3333
3431
  end
3334
3432
  end
3335
3433
 
@@ -3762,6 +3860,152 @@ module EDNGRAMMAR
3762
3860
  r0
3763
3861
  end
3764
3862
 
3863
+ module Hexscalar0
3864
+ end
3865
+
3866
+ module Hexscalar1
3867
+ def HEXDIG1
3868
+ elements[0]
3869
+ end
3870
+
3871
+ end
3872
+
3873
+ def _nt_hexscalar
3874
+ start_index = index
3875
+ if node_cache[:hexscalar].has_key?(index)
3876
+ cached = node_cache[:hexscalar][index]
3877
+ if cached
3878
+ node_cache[:hexscalar][index] = cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
3879
+ @index = cached.interval.end
3880
+ end
3881
+ return cached
3882
+ end
3883
+
3884
+ i0 = index
3885
+ i1, s1 = index, []
3886
+ if (match_len = has_terminal?("10", false, index))
3887
+ r2 = instantiate_node(SyntaxNode,input, index...(index + match_len))
3888
+ @index += match_len
3889
+ else
3890
+ terminal_parse_failure('"10"')
3891
+ r2 = nil
3892
+ end
3893
+ s1 << r2
3894
+ if r2
3895
+ s3, i3 = [], index
3896
+ loop do
3897
+ r4 = _nt_HEXDIG
3898
+ if r4
3899
+ s3 << r4
3900
+ else
3901
+ break
3902
+ end
3903
+ if s3.size == 4
3904
+ break
3905
+ end
3906
+ end
3907
+ if s3.size < 4
3908
+ @index = i3
3909
+ r3 = nil
3910
+ else
3911
+ if s3.size < 4
3912
+ @terminal_failures.pop
3913
+ end
3914
+ r3 = instantiate_node(SyntaxNode,input, i3...index, s3)
3915
+ end
3916
+ s1 << r3
3917
+ end
3918
+ if s1.last
3919
+ r1 = instantiate_node(SyntaxNode,input, i1...index, s1)
3920
+ r1.extend(Hexscalar0)
3921
+ else
3922
+ @index = i1
3923
+ r1 = nil
3924
+ end
3925
+ if r1
3926
+ r1 = SyntaxNode.new(input, (index-1)...index) if r1 == true
3927
+ r0 = r1
3928
+ else
3929
+ i5, s5 = index, []
3930
+ r6 = _nt_HEXDIG1
3931
+ s5 << r6
3932
+ if r6
3933
+ s7, i7 = [], index
3934
+ loop do
3935
+ r8 = _nt_HEXDIG
3936
+ if r8
3937
+ s7 << r8
3938
+ else
3939
+ break
3940
+ end
3941
+ if s7.size == 4
3942
+ break
3943
+ end
3944
+ end
3945
+ if s7.size < 4
3946
+ @index = i7
3947
+ r7 = nil
3948
+ else
3949
+ if s7.size < 4
3950
+ @terminal_failures.pop
3951
+ end
3952
+ r7 = instantiate_node(SyntaxNode,input, i7...index, s7)
3953
+ end
3954
+ s5 << r7
3955
+ end
3956
+ if s5.last
3957
+ r5 = instantiate_node(SyntaxNode,input, i5...index, s5)
3958
+ r5.extend(Hexscalar1)
3959
+ else
3960
+ @index = i5
3961
+ r5 = nil
3962
+ end
3963
+ if r5
3964
+ r5 = SyntaxNode.new(input, (index-1)...index) if r5 == true
3965
+ r0 = r5
3966
+ else
3967
+ r9 = _nt_non_surrogate
3968
+ if r9
3969
+ r9 = SyntaxNode.new(input, (index-1)...index) if r9 == true
3970
+ r0 = r9
3971
+ else
3972
+ s10, i10 = [], index
3973
+ loop do
3974
+ r11 = _nt_HEXDIG
3975
+ if r11
3976
+ s10 << r11
3977
+ else
3978
+ break
3979
+ end
3980
+ if s10.size == 3
3981
+ break
3982
+ end
3983
+ end
3984
+ if s10.size < 1
3985
+ @index = i10
3986
+ r10 = nil
3987
+ else
3988
+ if s10.size < 3
3989
+ @terminal_failures.pop
3990
+ end
3991
+ r10 = instantiate_node(SyntaxNode,input, i10...index, s10)
3992
+ end
3993
+ if r10
3994
+ r10 = SyntaxNode.new(input, (index-1)...index) if r10 == true
3995
+ r0 = r10
3996
+ else
3997
+ @index = i0
3998
+ r0 = nil
3999
+ end
4000
+ end
4001
+ end
4002
+ end
4003
+
4004
+ node_cache[:hexscalar][start_index] = r0
4005
+
4006
+ r0
4007
+ end
4008
+
3765
4009
  def _nt_unescaped
3766
4010
  start_index = index
3767
4011
  if node_cache[:unescaped].has_key?(index)
@@ -4084,6 +4328,104 @@ module EDNGRAMMAR
4084
4328
  r0
4085
4329
  end
4086
4330
 
4331
+ def _nt_HEXDIG1
4332
+ start_index = index
4333
+ if node_cache[:HEXDIG1].has_key?(index)
4334
+ cached = node_cache[:HEXDIG1][index]
4335
+ if cached
4336
+ node_cache[:HEXDIG1][index] = cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
4337
+ @index = cached.interval.end
4338
+ end
4339
+ return cached
4340
+ end
4341
+
4342
+ i0 = index
4343
+ r1 = _nt_DIGIT1
4344
+ if r1
4345
+ r1 = SyntaxNode.new(input, (index-1)...index) if r1 == true
4346
+ r0 = r1
4347
+ else
4348
+ if (match_len = has_terminal?("a", :insens, index))
4349
+ r2 = instantiate_node(SyntaxNode,input, index...(index + match_len))
4350
+ @index += match_len
4351
+ else
4352
+ terminal_parse_failure('"A"')
4353
+ r2 = nil
4354
+ end
4355
+ if r2
4356
+ r2 = SyntaxNode.new(input, (index-1)...index) if r2 == true
4357
+ r0 = r2
4358
+ else
4359
+ if (match_len = has_terminal?("b", :insens, index))
4360
+ r3 = instantiate_node(SyntaxNode,input, index...(index + match_len))
4361
+ @index += match_len
4362
+ else
4363
+ terminal_parse_failure('"B"')
4364
+ r3 = nil
4365
+ end
4366
+ if r3
4367
+ r3 = SyntaxNode.new(input, (index-1)...index) if r3 == true
4368
+ r0 = r3
4369
+ else
4370
+ if (match_len = has_terminal?("c", :insens, index))
4371
+ r4 = instantiate_node(SyntaxNode,input, index...(index + match_len))
4372
+ @index += match_len
4373
+ else
4374
+ terminal_parse_failure('"C"')
4375
+ r4 = nil
4376
+ end
4377
+ if r4
4378
+ r4 = SyntaxNode.new(input, (index-1)...index) if r4 == true
4379
+ r0 = r4
4380
+ else
4381
+ if (match_len = has_terminal?("d", :insens, index))
4382
+ r5 = instantiate_node(SyntaxNode,input, index...(index + match_len))
4383
+ @index += match_len
4384
+ else
4385
+ terminal_parse_failure('"D"')
4386
+ r5 = nil
4387
+ end
4388
+ if r5
4389
+ r5 = SyntaxNode.new(input, (index-1)...index) if r5 == true
4390
+ r0 = r5
4391
+ else
4392
+ if (match_len = has_terminal?("e", :insens, index))
4393
+ r6 = instantiate_node(SyntaxNode,input, index...(index + match_len))
4394
+ @index += match_len
4395
+ else
4396
+ terminal_parse_failure('"E"')
4397
+ r6 = nil
4398
+ end
4399
+ if r6
4400
+ r6 = SyntaxNode.new(input, (index-1)...index) if r6 == true
4401
+ r0 = r6
4402
+ else
4403
+ if (match_len = has_terminal?("f", :insens, index))
4404
+ r7 = instantiate_node(SyntaxNode,input, index...(index + match_len))
4405
+ @index += match_len
4406
+ else
4407
+ terminal_parse_failure('"F"')
4408
+ r7 = nil
4409
+ end
4410
+ if r7
4411
+ r7 = SyntaxNode.new(input, (index-1)...index) if r7 == true
4412
+ r0 = r7
4413
+ else
4414
+ @index = i0
4415
+ r0 = nil
4416
+ end
4417
+ end
4418
+ end
4419
+ end
4420
+ end
4421
+ end
4422
+ end
4423
+
4424
+ node_cache[:HEXDIG1][start_index] = r0
4425
+
4426
+ r0
4427
+ end
4428
+
4087
4429
  def _nt_lcalpha
4088
4430
  start_index = index
4089
4431
  if node_cache[:lcalpha].has_key?(index)
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.1.2
4
+ version: 0.1.3
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-16 00:00:00.000000000 Z
11
+ date: 2024-01-27 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler