cddlc 0.0.3 → 0.0.4

Sign up to get free protection for your applications and to get access to all the features.
Files changed (4) hide show
  1. checksums.yaml +4 -4
  2. data/cddlc.gemspec +1 -1
  3. data/lib/parser/cddlgrammar.rb +314 -231
  4. metadata +2 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 441f617191e302fe38e2a0622ab0cc7e218ab88b5753565b7d156e0d4648da8e
4
- data.tar.gz: 4a79ff5132f0a0c92a011a50ea238f9c58472cea52f27c7edd502e057f4dd570
3
+ metadata.gz: e4755090b14758b52954844be6c4fd916c2059758e60d06973e662796dc67f02
4
+ data.tar.gz: bbf25920e39e2dc432a77bd72e30007b608a4fb8e0d0c3e696e6dceeb1f35fa8
5
5
  SHA512:
6
- metadata.gz: 631b1d41853d7b8f6a1df2a0ba47c8a474d3142daa8282bb83dbc86434a824b188a033cebdb892b8e7e5b4c08fec7e24dd88933e6de11e210b077a5ff666ce88
7
- data.tar.gz: 1c2f44dbc2a98c1716b0758be614f8872b8a1921a2ffd9061099425d5e84d8861785204f1c80d1f9dd5f77f8583138a95d44489978834e0df83e4dacd7686624
6
+ metadata.gz: baf2caf2e3bdfffe7313b20f5f28352b16c8fa90e94be4a8842367e6c469a11dcdd5e44b40eae728fdf9d31a2e5467b91d537dfeb45ffa8a7d38c628afa4251b
7
+ data.tar.gz: 40cb808432a3c6ef55061323c04712eebd884eeafa23f85e6b78946006e7e78e04a325c1e090bcb78c22f5a9f1856a46b69f54497757cda73028f3ddd2cd2030
data/cddlc.gemspec CHANGED
@@ -1,6 +1,6 @@
1
1
  Gem::Specification.new do |s|
2
2
  s.name = "cddlc"
3
- s.version = "0.0.3"
3
+ s.version = "0.0.4"
4
4
  s.summary = "CDDL (Concise Data Definition Language) converters and miscellaneous tools"
5
5
  s.description = %q{cddlc implements converters and miscellaneous tools for CDDL, RFC 8610}
6
6
  s.author = "Carsten Bormann"
@@ -3280,23 +3280,92 @@ module CDDLGRAMMAR
3280
3280
  end
3281
3281
 
3282
3282
  module Hexchar0
3283
+ def high_surrogate
3284
+ elements[0]
3285
+ end
3286
+
3287
+ def low_surrogate
3288
+ elements[3]
3289
+ end
3283
3290
  end
3284
3291
 
3285
- module Hexchar1
3292
+ def _nt_hexchar
3293
+ start_index = index
3294
+ if node_cache[:hexchar].has_key?(index)
3295
+ cached = node_cache[:hexchar][index]
3296
+ if cached
3297
+ node_cache[:hexchar][index] = cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
3298
+ @index = cached.interval.end
3299
+ end
3300
+ return cached
3301
+ end
3302
+
3303
+ i0 = index
3304
+ r1 = _nt_non_surrogate
3305
+ if r1
3306
+ r1 = SyntaxNode.new(input, (index-1)...index) if r1 == true
3307
+ r0 = r1
3308
+ else
3309
+ i2, s2 = index, []
3310
+ r3 = _nt_high_surrogate
3311
+ s2 << r3
3312
+ if r3
3313
+ if (match_len = has_terminal?("\\", false, index))
3314
+ r4 = true
3315
+ @index += match_len
3316
+ else
3317
+ terminal_parse_failure('"\\\\"')
3318
+ r4 = nil
3319
+ end
3320
+ s2 << r4
3321
+ if r4
3322
+ if (match_len = has_terminal?("u", false, index))
3323
+ r5 = true
3324
+ @index += match_len
3325
+ else
3326
+ terminal_parse_failure('"u"')
3327
+ r5 = nil
3328
+ end
3329
+ s2 << r5
3330
+ if r5
3331
+ r6 = _nt_low_surrogate
3332
+ s2 << r6
3333
+ end
3334
+ end
3335
+ end
3336
+ if s2.last
3337
+ r2 = instantiate_node(SyntaxNode,input, i2...index, s2)
3338
+ r2.extend(Hexchar0)
3339
+ else
3340
+ @index = i2
3341
+ r2 = nil
3342
+ end
3343
+ if r2
3344
+ r2 = SyntaxNode.new(input, (index-1)...index) if r2 == true
3345
+ r0 = r2
3346
+ else
3347
+ @index = i0
3348
+ r0 = nil
3349
+ end
3350
+ end
3351
+
3352
+ node_cache[:hexchar][start_index] = r0
3353
+
3354
+ r0
3286
3355
  end
3287
3356
 
3288
- module Hexchar2
3357
+ module NonSurrogate0
3289
3358
  end
3290
3359
 
3291
- module Hexchar3
3360
+ module NonSurrogate1
3292
3361
  end
3293
3362
 
3294
- def _nt_hexchar
3363
+ def _nt_non_surrogate
3295
3364
  start_index = index
3296
- if node_cache[:hexchar].has_key?(index)
3297
- cached = node_cache[:hexchar][index]
3365
+ if node_cache[:non_surrogate].has_key?(index)
3366
+ cached = node_cache[:non_surrogate][index]
3298
3367
  if cached
3299
- node_cache[:hexchar][index] = cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
3368
+ node_cache[:non_surrogate][index] = cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
3300
3369
  @index = cached.interval.end
3301
3370
  end
3302
3371
  return cached
@@ -3400,7 +3469,7 @@ module CDDLGRAMMAR
3400
3469
  end
3401
3470
  if s1.last
3402
3471
  r1 = instantiate_node(SyntaxNode,input, i1...index, s1)
3403
- r1.extend(Hexchar0)
3472
+ r1.extend(NonSurrogate0)
3404
3473
  else
3405
3474
  @index = i1
3406
3475
  r1 = nil
@@ -3419,270 +3488,284 @@ module CDDLGRAMMAR
3419
3488
  end
3420
3489
  s11 << r12
3421
3490
  if r12
3422
- i13 = index
3423
- i14, s14 = index, []
3424
3491
  if has_terminal?(@regexps[gr = '\A[0-7]'] ||= Regexp.new(gr), :regexp, index)
3425
- r15 = true
3492
+ r13 = true
3426
3493
  @index += 1
3427
3494
  else
3428
3495
  terminal_parse_failure('[0-7]')
3429
- r15 = nil
3496
+ r13 = nil
3430
3497
  end
3431
- s14 << r15
3432
- if r15
3433
- s16, i16 = [], index
3498
+ s11 << r13
3499
+ if r13
3500
+ s14, i14 = [], index
3434
3501
  loop do
3435
- r17 = _nt_HEXDIG
3436
- if r17
3437
- s16 << r17
3502
+ r15 = _nt_HEXDIG
3503
+ if r15
3504
+ s14 << r15
3438
3505
  else
3439
3506
  break
3440
3507
  end
3441
- if s16.size == 2
3508
+ if s14.size == 2
3442
3509
  break
3443
3510
  end
3444
3511
  end
3445
- if s16.size < 2
3446
- @index = i16
3447
- r16 = nil
3512
+ if s14.size < 2
3513
+ @index = i14
3514
+ r14 = nil
3448
3515
  else
3449
- if s16.size < 2
3516
+ if s14.size < 2
3450
3517
  @terminal_failures.pop
3451
3518
  end
3452
- r16 = instantiate_node(SyntaxNode,input, i16...index, s16)
3519
+ r14 = instantiate_node(SyntaxNode,input, i14...index, s14)
3453
3520
  end
3454
- s14 << r16
3521
+ s11 << r14
3455
3522
  end
3456
- if s14.last
3457
- r14 = instantiate_node(SyntaxNode,input, i14...index, s14)
3458
- r14.extend(Hexchar1)
3523
+ end
3524
+ if s11.last
3525
+ r11 = instantiate_node(SyntaxNode,input, i11...index, s11)
3526
+ r11.extend(NonSurrogate1)
3527
+ else
3528
+ @index = i11
3529
+ r11 = nil
3530
+ end
3531
+ if r11
3532
+ r11 = SyntaxNode.new(input, (index-1)...index) if r11 == true
3533
+ r0 = r11
3534
+ else
3535
+ @index = i0
3536
+ r0 = nil
3537
+ end
3538
+ end
3539
+
3540
+ node_cache[:non_surrogate][start_index] = r0
3541
+
3542
+ r0
3543
+ end
3544
+
3545
+ module HighSurrogate0
3546
+ end
3547
+
3548
+ def _nt_high_surrogate
3549
+ start_index = index
3550
+ if node_cache[:high_surrogate].has_key?(index)
3551
+ cached = node_cache[:high_surrogate][index]
3552
+ if cached
3553
+ node_cache[:high_surrogate][index] = cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
3554
+ @index = cached.interval.end
3555
+ end
3556
+ return cached
3557
+ end
3558
+
3559
+ i0, s0 = index, []
3560
+ if (match_len = has_terminal?("d", :insens, index))
3561
+ r1 = instantiate_node(SyntaxNode,input, index...(index + match_len))
3562
+ @index += match_len
3563
+ else
3564
+ terminal_parse_failure('"D"')
3565
+ r1 = nil
3566
+ end
3567
+ s0 << r1
3568
+ if r1
3569
+ i2 = index
3570
+ if (match_len = has_terminal?("8", false, index))
3571
+ r3 = true
3572
+ @index += match_len
3573
+ else
3574
+ terminal_parse_failure('"8"')
3575
+ r3 = nil
3576
+ end
3577
+ if r3
3578
+ r3 = SyntaxNode.new(input, (index-1)...index) if r3 == true
3579
+ r2 = r3
3580
+ else
3581
+ if (match_len = has_terminal?("9", false, index))
3582
+ r4 = true
3583
+ @index += match_len
3459
3584
  else
3460
- @index = i14
3461
- r14 = nil
3585
+ terminal_parse_failure('"9"')
3586
+ r4 = nil
3462
3587
  end
3463
- if r14
3464
- r14 = SyntaxNode.new(input, (index-1)...index) if r14 == true
3465
- r13 = r14
3588
+ if r4
3589
+ r4 = SyntaxNode.new(input, (index-1)...index) if r4 == true
3590
+ r2 = r4
3466
3591
  else
3467
- i18, s18 = index, []
3468
- i19 = index
3469
- if (match_len = has_terminal?("8", false, index))
3470
- r20 = true
3592
+ if (match_len = has_terminal?("a", :insens, index))
3593
+ r5 = instantiate_node(SyntaxNode,input, index...(index + match_len))
3471
3594
  @index += match_len
3472
3595
  else
3473
- terminal_parse_failure('"8"')
3474
- r20 = nil
3596
+ terminal_parse_failure('"A"')
3597
+ r5 = nil
3475
3598
  end
3476
- if r20
3477
- r20 = SyntaxNode.new(input, (index-1)...index) if r20 == true
3478
- r19 = r20
3599
+ if r5
3600
+ r5 = SyntaxNode.new(input, (index-1)...index) if r5 == true
3601
+ r2 = r5
3479
3602
  else
3480
- if (match_len = has_terminal?("9", false, index))
3481
- r21 = true
3603
+ if (match_len = has_terminal?("b", :insens, index))
3604
+ r6 = instantiate_node(SyntaxNode,input, index...(index + match_len))
3482
3605
  @index += match_len
3483
3606
  else
3484
- terminal_parse_failure('"9"')
3485
- r21 = nil
3486
- end
3487
- if r21
3488
- r21 = SyntaxNode.new(input, (index-1)...index) if r21 == true
3489
- r19 = r21
3490
- else
3491
- if (match_len = has_terminal?("a", :insens, index))
3492
- r22 = instantiate_node(SyntaxNode,input, index...(index + match_len))
3493
- @index += match_len
3494
- else
3495
- terminal_parse_failure('"A"')
3496
- r22 = nil
3497
- end
3498
- if r22
3499
- r22 = SyntaxNode.new(input, (index-1)...index) if r22 == true
3500
- r19 = r22
3501
- else
3502
- if (match_len = has_terminal?("b", :insens, index))
3503
- r23 = instantiate_node(SyntaxNode,input, index...(index + match_len))
3504
- @index += match_len
3505
- else
3506
- terminal_parse_failure('"B"')
3507
- r23 = nil
3508
- end
3509
- if r23
3510
- r23 = SyntaxNode.new(input, (index-1)...index) if r23 == true
3511
- r19 = r23
3512
- else
3513
- @index = i19
3514
- r19 = nil
3515
- end
3516
- end
3517
- end
3518
- end
3519
- s18 << r19
3520
- if r19
3521
- s24, i24 = [], index
3522
- loop do
3523
- r25 = _nt_HEXDIG
3524
- if r25
3525
- s24 << r25
3526
- else
3527
- break
3528
- end
3529
- if s24.size == 2
3530
- break
3531
- end
3607
+ terminal_parse_failure('"B"')
3608
+ r6 = nil
3532
3609
  end
3533
- if s24.size < 2
3534
- @index = i24
3535
- r24 = nil
3610
+ if r6
3611
+ r6 = SyntaxNode.new(input, (index-1)...index) if r6 == true
3612
+ r2 = r6
3536
3613
  else
3537
- if s24.size < 2
3538
- @terminal_failures.pop
3539
- end
3540
- r24 = instantiate_node(SyntaxNode,input, i24...index, s24)
3541
- end
3542
- s18 << r24
3543
- if r24
3544
- if (match_len = has_terminal?("\\", false, index))
3545
- r26 = true
3546
- @index += match_len
3547
- else
3548
- terminal_parse_failure('"\\\\"')
3549
- r26 = nil
3550
- end
3551
- s18 << r26
3552
- if r26
3553
- if (match_len = has_terminal?("u", false, index))
3554
- r27 = true
3555
- @index += match_len
3556
- else
3557
- terminal_parse_failure('"u"')
3558
- r27 = nil
3559
- end
3560
- s18 << r27
3561
- if r27
3562
- if (match_len = has_terminal?("d", :insens, index))
3563
- r28 = instantiate_node(SyntaxNode,input, index...(index + match_len))
3564
- @index += match_len
3565
- else
3566
- terminal_parse_failure('"D"')
3567
- r28 = nil
3568
- end
3569
- s18 << r28
3570
- if r28
3571
- i29 = index
3572
- if (match_len = has_terminal?("c", :insens, index))
3573
- r30 = instantiate_node(SyntaxNode,input, index...(index + match_len))
3574
- @index += match_len
3575
- else
3576
- terminal_parse_failure('"C"')
3577
- r30 = nil
3578
- end
3579
- if r30
3580
- r30 = SyntaxNode.new(input, (index-1)...index) if r30 == true
3581
- r29 = r30
3582
- else
3583
- if (match_len = has_terminal?("d", :insens, index))
3584
- r31 = instantiate_node(SyntaxNode,input, index...(index + match_len))
3585
- @index += match_len
3586
- else
3587
- terminal_parse_failure('"D"')
3588
- r31 = nil
3589
- end
3590
- if r31
3591
- r31 = SyntaxNode.new(input, (index-1)...index) if r31 == true
3592
- r29 = r31
3593
- else
3594
- if (match_len = has_terminal?("e", :insens, index))
3595
- r32 = instantiate_node(SyntaxNode,input, index...(index + match_len))
3596
- @index += match_len
3597
- else
3598
- terminal_parse_failure('"E"')
3599
- r32 = nil
3600
- end
3601
- if r32
3602
- r32 = SyntaxNode.new(input, (index-1)...index) if r32 == true
3603
- r29 = r32
3604
- else
3605
- if (match_len = has_terminal?("f", :insens, index))
3606
- r33 = instantiate_node(SyntaxNode,input, index...(index + match_len))
3607
- @index += match_len
3608
- else
3609
- terminal_parse_failure('"F"')
3610
- r33 = nil
3611
- end
3612
- if r33
3613
- r33 = SyntaxNode.new(input, (index-1)...index) if r33 == true
3614
- r29 = r33
3615
- else
3616
- @index = i29
3617
- r29 = nil
3618
- end
3619
- end
3620
- end
3621
- end
3622
- s18 << r29
3623
- if r29
3624
- s34, i34 = [], index
3625
- loop do
3626
- r35 = _nt_HEXDIG
3627
- if r35
3628
- s34 << r35
3629
- else
3630
- break
3631
- end
3632
- if s34.size == 2
3633
- break
3634
- end
3635
- end
3636
- if s34.size < 2
3637
- @index = i34
3638
- r34 = nil
3639
- else
3640
- if s34.size < 2
3641
- @terminal_failures.pop
3642
- end
3643
- r34 = instantiate_node(SyntaxNode,input, i34...index, s34)
3644
- end
3645
- s18 << r34
3646
- end
3647
- end
3648
- end
3649
- end
3614
+ @index = i2
3615
+ r2 = nil
3650
3616
  end
3651
3617
  end
3652
- if s18.last
3653
- r18 = instantiate_node(SyntaxNode,input, i18...index, s18)
3654
- r18.extend(Hexchar2)
3618
+ end
3619
+ end
3620
+ s0 << r2
3621
+ if r2
3622
+ s7, i7 = [], index
3623
+ loop do
3624
+ r8 = _nt_HEXDIG
3625
+ if r8
3626
+ s7 << r8
3655
3627
  else
3656
- @index = i18
3657
- r18 = nil
3628
+ break
3658
3629
  end
3659
- if r18
3660
- r18 = SyntaxNode.new(input, (index-1)...index) if r18 == true
3661
- r13 = r18
3662
- else
3663
- @index = i13
3664
- r13 = nil
3630
+ if s7.size == 2
3631
+ break
3665
3632
  end
3666
3633
  end
3667
- s11 << r13
3634
+ if s7.size < 2
3635
+ @index = i7
3636
+ r7 = nil
3637
+ else
3638
+ if s7.size < 2
3639
+ @terminal_failures.pop
3640
+ end
3641
+ r7 = instantiate_node(SyntaxNode,input, i7...index, s7)
3642
+ end
3643
+ s0 << r7
3668
3644
  end
3669
- if s11.last
3670
- r11 = instantiate_node(SyntaxNode,input, i11...index, s11)
3671
- r11.extend(Hexchar3)
3645
+ end
3646
+ if s0.last
3647
+ r0 = instantiate_node(SyntaxNode,input, i0...index, s0)
3648
+ r0.extend(HighSurrogate0)
3649
+ else
3650
+ @index = i0
3651
+ r0 = nil
3652
+ end
3653
+
3654
+ node_cache[:high_surrogate][start_index] = r0
3655
+
3656
+ r0
3657
+ end
3658
+
3659
+ module LowSurrogate0
3660
+ end
3661
+
3662
+ def _nt_low_surrogate
3663
+ start_index = index
3664
+ if node_cache[:low_surrogate].has_key?(index)
3665
+ cached = node_cache[:low_surrogate][index]
3666
+ if cached
3667
+ node_cache[:low_surrogate][index] = cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
3668
+ @index = cached.interval.end
3669
+ end
3670
+ return cached
3671
+ end
3672
+
3673
+ i0, s0 = index, []
3674
+ if (match_len = has_terminal?("d", :insens, index))
3675
+ r1 = instantiate_node(SyntaxNode,input, index...(index + match_len))
3676
+ @index += match_len
3677
+ else
3678
+ terminal_parse_failure('"D"')
3679
+ r1 = nil
3680
+ end
3681
+ s0 << r1
3682
+ if r1
3683
+ i2 = index
3684
+ if (match_len = has_terminal?("c", :insens, index))
3685
+ r3 = instantiate_node(SyntaxNode,input, index...(index + match_len))
3686
+ @index += match_len
3672
3687
  else
3673
- @index = i11
3674
- r11 = nil
3688
+ terminal_parse_failure('"C"')
3689
+ r3 = nil
3675
3690
  end
3676
- if r11
3677
- r11 = SyntaxNode.new(input, (index-1)...index) if r11 == true
3678
- r0 = r11
3691
+ if r3
3692
+ r3 = SyntaxNode.new(input, (index-1)...index) if r3 == true
3693
+ r2 = r3
3679
3694
  else
3680
- @index = i0
3681
- r0 = nil
3695
+ if (match_len = has_terminal?("d", :insens, index))
3696
+ r4 = instantiate_node(SyntaxNode,input, index...(index + match_len))
3697
+ @index += match_len
3698
+ else
3699
+ terminal_parse_failure('"D"')
3700
+ r4 = nil
3701
+ end
3702
+ if r4
3703
+ r4 = SyntaxNode.new(input, (index-1)...index) if r4 == true
3704
+ r2 = r4
3705
+ else
3706
+ if (match_len = has_terminal?("e", :insens, index))
3707
+ r5 = instantiate_node(SyntaxNode,input, index...(index + match_len))
3708
+ @index += match_len
3709
+ else
3710
+ terminal_parse_failure('"E"')
3711
+ r5 = nil
3712
+ end
3713
+ if r5
3714
+ r5 = SyntaxNode.new(input, (index-1)...index) if r5 == true
3715
+ r2 = r5
3716
+ else
3717
+ if (match_len = has_terminal?("f", :insens, index))
3718
+ r6 = instantiate_node(SyntaxNode,input, index...(index + match_len))
3719
+ @index += match_len
3720
+ else
3721
+ terminal_parse_failure('"F"')
3722
+ r6 = nil
3723
+ end
3724
+ if r6
3725
+ r6 = SyntaxNode.new(input, (index-1)...index) if r6 == true
3726
+ r2 = r6
3727
+ else
3728
+ @index = i2
3729
+ r2 = nil
3730
+ end
3731
+ end
3732
+ end
3733
+ end
3734
+ s0 << r2
3735
+ if r2
3736
+ s7, i7 = [], index
3737
+ loop do
3738
+ r8 = _nt_HEXDIG
3739
+ if r8
3740
+ s7 << r8
3741
+ else
3742
+ break
3743
+ end
3744
+ if s7.size == 2
3745
+ break
3746
+ end
3747
+ end
3748
+ if s7.size < 2
3749
+ @index = i7
3750
+ r7 = nil
3751
+ else
3752
+ if s7.size < 2
3753
+ @terminal_failures.pop
3754
+ end
3755
+ r7 = instantiate_node(SyntaxNode,input, i7...index, s7)
3756
+ end
3757
+ s0 << r7
3682
3758
  end
3683
3759
  end
3760
+ if s0.last
3761
+ r0 = instantiate_node(SyntaxNode,input, i0...index, s0)
3762
+ r0.extend(LowSurrogate0)
3763
+ else
3764
+ @index = i0
3765
+ r0 = nil
3766
+ end
3684
3767
 
3685
- node_cache[:hexchar][start_index] = r0
3768
+ node_cache[:low_surrogate][start_index] = r0
3686
3769
 
3687
3770
  r0
3688
3771
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: cddlc
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.3
4
+ version: 0.0.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: 2021-04-13 00:00:00.000000000 Z
11
+ date: 2021-04-14 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler