abnftt 0.2.2 → 0.2.4

Sign up to get free protection for your applications and to get access to all the features.
Files changed (5) hide show
  1. checksums.yaml +4 -4
  2. data/abnftt.gemspec +1 -1
  3. data/bin/abnftt +1 -1
  4. data/lib/abnftt.rb +4 -0
  5. metadata +3 -3
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: b6def221a1f39479205c5ae0941b016e8e9b264cbd22f3052d6d62efba94ec05
4
- data.tar.gz: 9ff420d1bb6fae9272704bea9a77141d02cf70638831aa883a88bb4cdbbcf27b
3
+ metadata.gz: 152ef34be3428f0a7cda4f157ec08a1986f5cf295436be8186ee53d61eddb386
4
+ data.tar.gz: fdc3504304d4e9c5244dcfce7a2e103e2801d3f6087de307bcd976a099fe0b5d
5
5
  SHA512:
6
- metadata.gz: b29184a28e14f98168290f3638c371d92448deff1fbd686d6016eee875c7b5943ac8b9a6aabfb16f23d482f2ec7ca7b1fa0210e754410ab8b26bf4937be9175d
7
- data.tar.gz: 011fcd33ac63105e3a4f9ea247841611be6bf9b60430786fab5ad2a9f63c6988ca67b84aca0016428107874bd486989653710b1014384f4877dd9adc34ebeda5
6
+ metadata.gz: e5b786e95c96464bf516e2d6ba00f1363a6a720d0dfd01b83401fef3ade2dc51116fda365881fb770fa9756f0ec71a14e7c6e85e7e3a7bc3589a930e8b9e5381
7
+ data.tar.gz: '08eb748abf720cfdfe4a742e675e7b5b0144a60cdd2fce90f85783a2b7eac2d856e138f6536394dcccc123e72eb6fa8439b472b1e8ff26fff7630938445b2316'
data/abnftt.gemspec CHANGED
@@ -1,6 +1,6 @@
1
1
  Gem::Specification.new do |s|
2
2
  s.name = "abnftt"
3
- s.version = "0.2.2"
3
+ s.version = "0.2.4"
4
4
  s.summary = "RFC 5234+7405 ABNF to Treetop"
5
5
  s.description = %q{Less shifty support for tools based on IETF's ABNF}
6
6
  s.author = "Carsten Bormann"
data/bin/abnftt CHANGED
@@ -24,7 +24,7 @@ if ast
24
24
  end
25
25
  # pp ast.ast
26
26
  File.open("#{outfn}.treetop", "w") do |f|
27
- modname = File.basename(outfn).gsub("-", "_").gsub(/[^_a-zA-Z]/, "").upcase
27
+ modname = File.basename(outfn).gsub("-", "_").gsub(/[^_a-zA-Z0-9]/, "").upcase
28
28
  f.puts abnf.to_treetop(modname)
29
29
  end
30
30
  File.open("#{outfn}.abnf", "w") do |f|
data/lib/abnftt.rb CHANGED
@@ -143,6 +143,7 @@ class ABNF
143
143
  FIXUP_NAMES = Hash.new {|h, k| k}
144
144
  FIXUP_NAMES.merge!({
145
145
  "rule" => "r__rule",
146
+ "end" => "r__end",
146
147
  })
147
148
  def to_treetop1(ast)
148
149
  case ast
@@ -156,6 +157,9 @@ class ABNF
156
157
  "(#{ast[1..-1].map {|x| to_treetop1(x)}.join(" ")})"
157
158
  when "rep" # ["rep", s, e, a]
158
159
  t = to_treetop1(ast[3]) || "@@@"
160
+ if ast[3][0] == "rep"
161
+ t = "(#{t})"
162
+ end
159
163
  case [ast[1], ast[2]]
160
164
  when [0, 1]
161
165
  t + "?"
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: abnftt
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.2
4
+ version: 0.2.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-02-26 00:00:00.000000000 Z
11
+ date: 2023-08-26 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description: Less shifty support for tools based on IETF's ABNF
14
14
  email: cabo@tzi.org
@@ -42,7 +42,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
42
42
  - !ruby/object:Gem::Version
43
43
  version: '0'
44
44
  requirements: []
45
- rubygems_version: 3.2.3
45
+ rubygems_version: 3.4.10
46
46
  signing_key:
47
47
  specification_version: 4
48
48
  summary: RFC 5234+7405 ABNF to Treetop