edn-abnf 0.1.2 → 0.1.4

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