edn-abnf 0.3.3 → 0.3.5

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: a7e57901f15e144386956e94dd3aaa6b808786e4d41b7ff5b5c1c5bc54c0df35
4
- data.tar.gz: 35f7b7e937487e76f4f5f21ee265346099274eb62e87675912c28a49b57a68b1
3
+ metadata.gz: f27ae567e340f8f491fd48f61ffcf98080e5a7e25f73e48178ba716382976232
4
+ data.tar.gz: 911714cd26c0f5fc215d75bf29f95bb17bb8f7e20b1c89897e2bbdc919047366
5
5
  SHA512:
6
- metadata.gz: aeba40ba7ed1e0c9e19da2b10e236fce5d15b1cead0c128050c9b40b0500787a0377126d83f413582bdc04199534b58830dd105ed3bb4944c57d8ba90ce808e3
7
- data.tar.gz: c5cca7b60d9059f98956d1aa18eae7a039d5de44e623e296d59019d27ded411063eb9dc584f6e82391d7b0d1b20206e789dd62694e95c4827b3179138742a99c
6
+ metadata.gz: adf381d82f725bbcf8f2fcc67bdcf57d999ba236bc6d3f4aae062cc85c0c189770662bb38916134a4e0d5d7a73ed1fa1e0a604cfe39f9f0f29ca34a4102e423b
7
+ data.tar.gz: 4edde63c1bd6aac32b14d3c5bf118e43e8d26dd77cc7e4653ec5304699e6341b7e885e96b4afeb7dce3c8f628d07d2f405a85fff24aaa7dfc5324271264c42b3
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.3.3"
3
+ s.version = "0.3.5"
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"
@@ -13,10 +13,10 @@ class CBOR_DIAG::App_dt
13
13
  if !ast
14
14
  raise ArgumentError, "cbor-diagnostic: Parse Error in dt'#{s}':\n" << EDN.reason(parser, s)
15
15
  end
16
- # ast.ast
16
+ frac = ast.has_frac != ""
17
17
 
18
18
  t = Time.iso8601(s)
19
- tv = if t.subsec != 0
19
+ tv = if frac # t.subsec != 0
20
20
  t.to_f
21
21
  else
22
22
  t.to_i
@@ -443,6 +443,10 @@ module DTGRAMMAR
443
443
 
444
444
  end
445
445
 
446
+ module PartialTime1
447
+ def has_frac; elements[5].text_value end
448
+ end
449
+
446
450
  def _nt_partial_time
447
451
  start_index = index
448
452
  if node_cache[:partial_time].has_key?(index)
@@ -497,6 +501,7 @@ module DTGRAMMAR
497
501
  if s0.last
498
502
  r0 = instantiate_node(SyntaxNode,input, i0...index, s0)
499
503
  r0.extend(PartialTime0)
504
+ r0.extend(PartialTime1)
500
505
  else
501
506
  @index = i0
502
507
  r0 = nil
@@ -586,6 +591,10 @@ module DTGRAMMAR
586
591
  end
587
592
  end
588
593
 
594
+ module FullTime1
595
+ def has_frac; partial_time.has_frac end
596
+ end
597
+
589
598
  def _nt_full_time
590
599
  start_index = index
591
600
  if node_cache[:full_time].has_key?(index)
@@ -607,6 +616,7 @@ module DTGRAMMAR
607
616
  if s0.last
608
617
  r0 = instantiate_node(SyntaxNode,input, i0...index, s0)
609
618
  r0.extend(FullTime0)
619
+ r0.extend(FullTime1)
610
620
  else
611
621
  @index = i0
612
622
  r0 = nil
@@ -627,6 +637,10 @@ module DTGRAMMAR
627
637
  end
628
638
  end
629
639
 
640
+ module DateTime1
641
+ def has_frac; full_time.has_frac end
642
+ end
643
+
630
644
  def _nt_date_time
631
645
  start_index = index
632
646
  if node_cache[:date_time].has_key?(index)
@@ -658,6 +672,7 @@ module DTGRAMMAR
658
672
  if s0.last
659
673
  r0 = instantiate_node(SyntaxNode,input, i0...index, s0)
660
674
  r0.extend(DateTime0)
675
+ r0.extend(DateTime1)
661
676
  else
662
677
  @index = i0
663
678
  r0 = nil
@@ -1757,6 +1757,13 @@ module EDNGRAMMAR
1757
1757
  end
1758
1758
 
1759
1759
  module Sqstr0
1760
+ def SQUOTE1
1761
+ elements[0]
1762
+ end
1763
+
1764
+ def SQUOTE2
1765
+ elements[2]
1766
+ end
1760
1767
  end
1761
1768
 
1762
1769
  module Sqstr1
@@ -1777,13 +1784,7 @@ module EDNGRAMMAR
1777
1784
  end
1778
1785
 
1779
1786
  i0, s0 = index, []
1780
- if (match_len = has_terminal?("'", false, index))
1781
- r1 = true
1782
- @index += match_len
1783
- else
1784
- terminal_parse_failure('"\'"')
1785
- r1 = nil
1786
- end
1787
+ r1 = _nt_SQUOTE
1787
1788
  s0 << r1
1788
1789
  if r1
1789
1790
  s2, i2 = [], index
@@ -1798,13 +1799,7 @@ module EDNGRAMMAR
1798
1799
  r2 = instantiate_node(SyntaxNode,input, i2...index, s2)
1799
1800
  s0 << r2
1800
1801
  if r2
1801
- if (match_len = has_terminal?("'", false, index))
1802
- r4 = true
1803
- @index += match_len
1804
- else
1805
- terminal_parse_failure('"\'"')
1806
- r4 = nil
1807
- end
1802
+ r4 = _nt_SQUOTE
1808
1803
  s0 << r4
1809
1804
  end
1810
1805
  end
@@ -3067,14 +3062,9 @@ module EDNGRAMMAR
3067
3062
  r1 = SyntaxNode.new(input, (index-1)...index) if r1 == true
3068
3063
  r0 = r1
3069
3064
  else
3070
- if (match_len = has_terminal?("'", false, index))
3071
- r2 = instantiate_node(SyntaxNode,input, index...(index + match_len))
3072
- r2.extend(DoubleQuoted1)
3073
- @index += match_len
3074
- else
3075
- terminal_parse_failure('"\'"')
3076
- r2 = nil
3077
- end
3065
+ r2 = _nt_SQUOTE
3066
+ r2.extend(DoubleQuoted1)
3067
+ r2.extend(DoubleQuoted1)
3078
3068
  if r2
3079
3069
  r2 = SyntaxNode.new(input, (index-1)...index) if r2 == true
3080
3070
  r0 = r2
@@ -3150,6 +3140,9 @@ module EDNGRAMMAR
3150
3140
  end
3151
3141
 
3152
3142
  module SingleQuoted2
3143
+ def SQUOTE
3144
+ elements[1]
3145
+ end
3153
3146
  end
3154
3147
 
3155
3148
  module SingleQuoted3
@@ -3202,13 +3195,7 @@ module EDNGRAMMAR
3202
3195
  end
3203
3196
  s3 << r4
3204
3197
  if r4
3205
- if (match_len = has_terminal?("'", false, index))
3206
- r5 = true
3207
- @index += match_len
3208
- else
3209
- terminal_parse_failure('"\'"')
3210
- r5 = nil
3211
- end
3198
+ r5 = _nt_SQUOTE
3212
3199
  s3 << r5
3213
3200
  end
3214
3201
  if s3.last
@@ -4319,6 +4306,30 @@ module EDNGRAMMAR
4319
4306
  r0
4320
4307
  end
4321
4308
 
4309
+ def _nt_SQUOTE
4310
+ start_index = index
4311
+ if node_cache[:SQUOTE].has_key?(index)
4312
+ cached = node_cache[:SQUOTE][index]
4313
+ if cached
4314
+ node_cache[:SQUOTE][index] = cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
4315
+ @index = cached.interval.end
4316
+ end
4317
+ return cached
4318
+ end
4319
+
4320
+ if (match_len = has_terminal?("'", false, index))
4321
+ r0 = instantiate_node(SyntaxNode,input, index...(index + match_len))
4322
+ @index += match_len
4323
+ else
4324
+ terminal_parse_failure('"\'"')
4325
+ r0 = nil
4326
+ end
4327
+
4328
+ node_cache[:SQUOTE][start_index] = r0
4329
+
4330
+ r0
4331
+ end
4332
+
4322
4333
  def _nt_DIGIT
4323
4334
  start_index = index
4324
4335
  if node_cache[:DIGIT].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.3.3
4
+ version: 0.3.5
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-08-28 00:00:00.000000000 Z
11
+ date: 2025-01-06 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler