edn-abnf 0.0.2 → 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/edn-abnf.gemspec +2 -1
  3. data/lib/edn-abnf.rb +4 -3
  4. metadata +16 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: a615ce8070270a4a91acb7e811e2b9417d1245b3378e5376ea9f74e1a9d8249f
4
- data.tar.gz: f14064f8de13e5322832a07ed1af364041d05e9b4c030288cc5fb0653cbbd847
3
+ metadata.gz: 8eb52693cd7d9aef79f242492135b2e923c156d91aac9d193023ba8ee5c3f5b3
4
+ data.tar.gz: 76c8893695b10b13c351d93de8132c63238d295c95eb6b8aec565ae73a2169df
5
5
  SHA512:
6
- metadata.gz: 98ab91da990ea04a56ef83fd07b90c1a4b32a83814a8d66366167a5f2c3f053cfb3967a0d1a362a5c6a9829b7f09ee91121b9a9d0873122862bfb778c4394676
7
- data.tar.gz: dbf862919dcf4cb41bb0e4359aaf0d4ae43c7c78958abad6806a6a5c2ae8a72dbd8b7f593519ee00ba5bf87d3ed7457740919c97b1f8ea7ab6bce1356f2c574d
6
+ metadata.gz: fc9855abe0afd6f8fda6026d31a2f611ebabfce7125278604c1c6e1a56093ded138b9e0cf5e34bba73a4365cc66fad21cf185fb09a3d7ca4f393683d76c14214
7
+ data.tar.gz: d83a6154649f595a6da5e3f8f4ae40445157c7face9e54fae984df32b6e1e22e0c8c276aa2e04e9587a7ac4b7114f340d485c0d1e73016737bf61485be143c85
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.0.2"
3
+ s.version = "0.0.4"
4
4
  s.summary = "CDDL (Concise Data Definition Language) converters and miscellaneous tools"
5
5
  s.description = %q{edn-abnf implements converters and miscellaneous tools for CBOR EDN's ABNF}
6
6
  s.author = "Carsten Bormann"
@@ -14,6 +14,7 @@ Gem::Specification.new do |s|
14
14
  s.require_paths = ["lib"]
15
15
 
16
16
  s.add_development_dependency 'bundler', '~>1'
17
+ s.add_development_dependency 'abnftt', '~>0.2'
17
18
  s.add_dependency 'treetop', '~>1'
18
19
  s.add_dependency 'json', '~>2'
19
20
  s.add_dependency 'neatjson', '~>0.10'
data/lib/edn-abnf.rb CHANGED
@@ -5,9 +5,10 @@ class EDN
5
5
 
6
6
  def self.reason(parser, s)
7
7
  reason = [parser.failure_reason]
8
- parser.failure_reason =~ /^(Expected .+) after/m
9
- reason << "#{$1.gsub("\n", '<<<NEWLINE>>>')}:" if $1
8
+ parser.failure_reason =~ /^(Expected .+) after ./m
9
+ expected = $1
10
10
  if line = s.lines.to_a[parser.failure_line - 1]
11
+ reason << "#{$1.gsub("\n", '<<<NEWLINE>>>')}:" if expected
11
12
  reason << line
12
13
  reason << "#{'~' * (parser.failure_column - 1)}^"
13
14
  end
@@ -17,7 +18,7 @@ class EDN
17
18
  def self.from_edn(s)
18
19
  ast = @@parser.parse s
19
20
  if !ast
20
- fail self.reason(@@parser, s)
21
+ raise ArgumentError, "Parse Error:\n" << self.reason(@@parser, s)
21
22
  end
22
23
  ret = EDN.new(ast)
23
24
  ret
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.0.2
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: 2023-08-24 00:00:00.000000000 Z
11
+ date: 2023-08-26 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -24,6 +24,20 @@ dependencies:
24
24
  - - "~>"
25
25
  - !ruby/object:Gem::Version
26
26
  version: '1'
27
+ - !ruby/object:Gem::Dependency
28
+ name: abnftt
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - "~>"
32
+ - !ruby/object:Gem::Version
33
+ version: '0.2'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - "~>"
39
+ - !ruby/object:Gem::Version
40
+ version: '0.2'
27
41
  - !ruby/object:Gem::Dependency
28
42
  name: treetop
29
43
  requirement: !ruby/object:Gem::Requirement