cddlc 0.2.6 → 0.3.1

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: d9a2b5efd82c91f2fc158bfffdb79adc0c2cd31def11dccb6ec986c61985556f
4
- data.tar.gz: 8c663966329be0e8b0648c794c9be4e9af773ed2072dae35080c0182db9957ad
3
+ metadata.gz: 9ac6c49d6e3aae903f307b8ca75486ec8a0654bbf9bcb8ce77cfbc32d58b97a2
4
+ data.tar.gz: 04c26c80b59ca309c68d0a1ff7e1236f50ddcc10f2aab7d6eddc0c09d5a3f698
5
5
  SHA512:
6
- metadata.gz: 45eb92c7c2f2185cabcdbf49d869ea31dceef60f45fbafb3bccc2c31a57cde096e62a10542b8e389618c4db31d33734201075fc9ec7235b21ced54e0823ea855
7
- data.tar.gz: 2e1d13a69f257316054ac9866082d12f39289c587ec0049a7be5ccc89abba187ae64012e2e14a0a0d62473e92a2681dd5109105c8bd8e3e8a6f502dfaab2b634
6
+ metadata.gz: e99d700012b8c6211ee051e20399271ee9e765f92c835eb0c567880b3cf05f343f26c8ab4b28535641f98020916a2ea6b4ccb73f55c61375771f7fc68cbd69f9
7
+ data.tar.gz: fd110edebea03f2ebd07e3e670e2861c24caeff9758ecf40edefc4a73034933f22c17b183eff86babb2421472fe9fa10938710ac6965e36a9a1efa36dd7f30a9
data/cddlc.gemspec CHANGED
@@ -1,6 +1,6 @@
1
1
  Gem::Specification.new do |s|
2
2
  s.name = "cddlc"
3
- s.version = "0.2.6"
3
+ s.version = "0.3.1"
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"
@@ -947,7 +947,7 @@ module CDDLGRAMMAR
947
947
  end
948
948
 
949
949
  module Type214
950
- def tag_number
950
+ def head_number
951
951
  elements[1]
952
952
  end
953
953
  end
@@ -975,26 +975,42 @@ module CDDLGRAMMAR
975
975
  end
976
976
 
977
977
  module Type217
978
- def uint
978
+ def head_number
979
979
  elements[1]
980
980
  end
981
981
  end
982
982
 
983
983
  module Type218
984
+ end
985
+
986
+ module Type219
987
+ def ast
988
+ el = elements[2].elements
989
+ ["prim", 7, *el && [el[1].ast]]
990
+ end
991
+ end
992
+
993
+ module Type220
994
+ def uint
995
+ elements[1]
996
+ end
997
+ end
998
+
999
+ module Type221
984
1000
  def DIGIT
985
1001
  elements[1]
986
1002
  end
987
1003
 
988
1004
  end
989
1005
 
990
- module Type219
1006
+ module Type222
991
1007
  def ast
992
1008
  ["prim", elements[1].text_value.to_i,
993
1009
  *(el = elements[2].elements) ? [el[1].text_value.to_i] : []]
994
1010
  end
995
1011
  end
996
1012
 
997
- module Type220
1013
+ module Type223
998
1014
  def ast() ["prim"] end
999
1015
  end
1000
1016
 
@@ -1330,7 +1346,7 @@ module CDDLGRAMMAR
1330
1346
  end
1331
1347
  s48 << r49
1332
1348
  if r49
1333
- r50 = _nt_tag_number
1349
+ r50 = _nt_head_number
1334
1350
  s48 << r50
1335
1351
  end
1336
1352
  if s48.last
@@ -1402,7 +1418,13 @@ module CDDLGRAMMAR
1402
1418
  end
1403
1419
  s56 << r57
1404
1420
  if r57
1405
- r58 = _nt_DIGIT
1421
+ if (match_len = has_terminal?("7", false, index))
1422
+ r58 = true
1423
+ @index += match_len
1424
+ else
1425
+ terminal_parse_failure('"7"')
1426
+ r58 = nil
1427
+ end
1406
1428
  s56 << r58
1407
1429
  if r58
1408
1430
  i60, s60 = index, []
@@ -1415,7 +1437,7 @@ module CDDLGRAMMAR
1415
1437
  end
1416
1438
  s60 << r61
1417
1439
  if r61
1418
- r62 = _nt_uint
1440
+ r62 = _nt_head_number
1419
1441
  s60 << r62
1420
1442
  end
1421
1443
  if s60.last
@@ -1445,20 +1467,74 @@ module CDDLGRAMMAR
1445
1467
  r56 = SyntaxNode.new(input, (index-1)...index) if r56 == true
1446
1468
  r0 = r56
1447
1469
  else
1470
+ i63, s63 = index, []
1448
1471
  if (match_len = has_terminal?("#", false, index))
1449
- r63 = instantiate_node(SyntaxNode,input, index...(index + match_len))
1450
- r63.extend(Type220)
1472
+ r64 = true
1451
1473
  @index += match_len
1452
1474
  else
1453
1475
  terminal_parse_failure('"#"')
1476
+ r64 = nil
1477
+ end
1478
+ s63 << r64
1479
+ if r64
1480
+ r65 = _nt_DIGIT
1481
+ s63 << r65
1482
+ if r65
1483
+ i67, s67 = index, []
1484
+ if (match_len = has_terminal?(".", false, index))
1485
+ r68 = true
1486
+ @index += match_len
1487
+ else
1488
+ terminal_parse_failure('"."')
1489
+ r68 = nil
1490
+ end
1491
+ s67 << r68
1492
+ if r68
1493
+ r69 = _nt_uint
1494
+ s67 << r69
1495
+ end
1496
+ if s67.last
1497
+ r67 = instantiate_node(SyntaxNode,input, i67...index, s67)
1498
+ r67.extend(Type220)
1499
+ else
1500
+ @index = i67
1501
+ r67 = nil
1502
+ end
1503
+ if r67
1504
+ r66 = r67
1505
+ else
1506
+ r66 = instantiate_node(SyntaxNode,input, index...index)
1507
+ end
1508
+ s63 << r66
1509
+ end
1510
+ end
1511
+ if s63.last
1512
+ r63 = instantiate_node(SyntaxNode,input, i63...index, s63)
1513
+ r63.extend(Type221)
1514
+ r63.extend(Type222)
1515
+ else
1516
+ @index = i63
1454
1517
  r63 = nil
1455
1518
  end
1456
1519
  if r63
1457
1520
  r63 = SyntaxNode.new(input, (index-1)...index) if r63 == true
1458
1521
  r0 = r63
1459
1522
  else
1460
- @index = i0
1461
- r0 = nil
1523
+ if (match_len = has_terminal?("#", false, index))
1524
+ r70 = instantiate_node(SyntaxNode,input, index...(index + match_len))
1525
+ r70.extend(Type223)
1526
+ @index += match_len
1527
+ else
1528
+ terminal_parse_failure('"#"')
1529
+ r70 = nil
1530
+ end
1531
+ if r70
1532
+ r70 = SyntaxNode.new(input, (index-1)...index) if r70 == true
1533
+ r0 = r70
1534
+ else
1535
+ @index = i0
1536
+ r0 = nil
1537
+ end
1462
1538
  end
1463
1539
  end
1464
1540
  end
@@ -1476,27 +1552,27 @@ module CDDLGRAMMAR
1476
1552
  r0
1477
1553
  end
1478
1554
 
1479
- module TagNumber0
1555
+ module HeadNumber0
1480
1556
  def ast() text_value.to_i end
1481
1557
  end
1482
1558
 
1483
- module TagNumber1
1559
+ module HeadNumber1
1484
1560
  def type
1485
1561
  elements[1]
1486
1562
  end
1487
1563
 
1488
1564
  end
1489
1565
 
1490
- module TagNumber2
1566
+ module HeadNumber2
1491
1567
  def ast() elements[1].ast end
1492
1568
  end
1493
1569
 
1494
- def _nt_tag_number
1570
+ def _nt_head_number
1495
1571
  start_index = index
1496
- if node_cache[:tag_number].has_key?(index)
1497
- cached = node_cache[:tag_number][index]
1572
+ if node_cache[:head_number].has_key?(index)
1573
+ cached = node_cache[:head_number][index]
1498
1574
  if cached
1499
- node_cache[:tag_number][index] = cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
1575
+ node_cache[:head_number][index] = cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
1500
1576
  @index = cached.interval.end
1501
1577
  end
1502
1578
  return cached
@@ -1504,8 +1580,8 @@ module CDDLGRAMMAR
1504
1580
 
1505
1581
  i0 = index
1506
1582
  r1 = _nt_uint
1507
- r1.extend(TagNumber0)
1508
- r1.extend(TagNumber0)
1583
+ r1.extend(HeadNumber0)
1584
+ r1.extend(HeadNumber0)
1509
1585
  if r1
1510
1586
  r1 = SyntaxNode.new(input, (index-1)...index) if r1 == true
1511
1587
  r0 = r1
@@ -1535,8 +1611,8 @@ module CDDLGRAMMAR
1535
1611
  end
1536
1612
  if s2.last
1537
1613
  r2 = instantiate_node(SyntaxNode,input, i2...index, s2)
1538
- r2.extend(TagNumber1)
1539
- r2.extend(TagNumber2)
1614
+ r2.extend(HeadNumber1)
1615
+ r2.extend(HeadNumber2)
1540
1616
  else
1541
1617
  @index = i2
1542
1618
  r2 = nil
@@ -1550,7 +1626,7 @@ module CDDLGRAMMAR
1550
1626
  end
1551
1627
  end
1552
1628
 
1553
- node_cache[:tag_number][start_index] = r0
1629
+ node_cache[:head_number][start_index] = r0
1554
1630
 
1555
1631
  r0
1556
1632
  end
@@ -64,8 +64,10 @@ class CDDL
64
64
  [4, "#"]
65
65
  in ["prim", maj]
66
66
  [4, "##{maj}"]
67
- in ["prim", maj, min]
67
+ in ["prim", maj, Integer => min]
68
68
  [4, "##{maj}.#{min}"]
69
+ in ["prim", 7, Array => min]
70
+ [4, "##{maj}.<#{write_rhs(min, 0, indent, pn)}>"]
69
71
  in ["prim", 6, Integer => tag, type]
70
72
  [4, "#6.#{tag}(#{write_rhs(type, 0, indent, pn)})"]
71
73
  in ["prim", 6, Array => tag, type]
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.2.6
4
+ version: 0.3.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Carsten Bormann
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2024-02-26 00:00:00.000000000 Z
11
+ date: 2024-03-02 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler