raabro 1.3.3 → 1.4.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +6 -0
- data/lib/raabro.rb +33 -13
- data/raabro.gemspec +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 6c97c1720256a9bd016f9a3644bf6a0a407afde36122fe666a415f65d8f11fa2
|
4
|
+
data.tar.gz: 0e52242404f2309cbccfd92f7ee1d4ef06777c883d1c40254bddcf033a63752e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: fa0aebdcbfaeadd23dfd1ac8c442e52b839bced502c0ae144c5562bc97fc0e2a54c3114b0e048f47fdcb46c8ac2a7def92b7cd6169256195957bb7acbd65a9a6
|
7
|
+
data.tar.gz: e9c3eab148ede2853cafa1ec3fceec9967af83b4c3453017666f01741a0d51cb5eb200dde64e5d7c62ede442768b5f861a3a8bdb5587ded9a6a5afde73844b05
|
data/CHANGELOG.md
CHANGED
@@ -2,6 +2,12 @@
|
|
2
2
|
# raabro CHANGELOG.md
|
3
3
|
|
4
4
|
|
5
|
+
## raabro 1.4.0 released 2020-10-06
|
6
|
+
|
7
|
+
* Ensure that jseq, for n elts, parses n-1 separators
|
8
|
+
* Introduce Tree #symbol, #symbod, #strind and #strinpd
|
9
|
+
|
10
|
+
|
5
11
|
## raabro 1.3.3 released 2020-09-24
|
6
12
|
|
7
13
|
* Merge Henrik's rewrite_ optimization
|
data/lib/raabro.rb
CHANGED
@@ -1,7 +1,8 @@
|
|
1
|
+
# frozen_string_literal: true
|
1
2
|
|
2
3
|
module Raabro
|
3
4
|
|
4
|
-
VERSION = '1.
|
5
|
+
VERSION = '1.4.0'
|
5
6
|
|
6
7
|
class Input
|
7
8
|
|
@@ -79,10 +80,19 @@ module Raabro
|
|
79
80
|
end
|
80
81
|
|
81
82
|
def string; @input.string[@offset, @length]; end
|
82
|
-
def strinp;
|
83
|
+
def strinp; string.strip; end
|
83
84
|
alias strim strinp
|
84
85
|
def nonstring(l=7); @input.string[@offset, l]; end
|
85
86
|
|
87
|
+
def stringd; string.downcase; end
|
88
|
+
alias strind stringd
|
89
|
+
def stringpd; strinp.downcase; end
|
90
|
+
alias strinpd stringpd
|
91
|
+
|
92
|
+
def symbol; strinp.to_sym; end
|
93
|
+
def symbold; symbol.downcase; end
|
94
|
+
alias symbod symbold
|
95
|
+
|
86
96
|
def lookup(name=nil)
|
87
97
|
|
88
98
|
name = name ? name.to_s : nil
|
@@ -466,26 +476,36 @@ module Raabro
|
|
466
476
|
|
467
477
|
if r.result == 1
|
468
478
|
|
469
|
-
|
479
|
+
on_elt = false
|
480
|
+
count = 0
|
481
|
+
empty_stack = 0
|
470
482
|
|
471
483
|
loop do
|
472
484
|
|
473
|
-
|
474
|
-
et = st == nil || st.result == 1 ? _parse(eltpa, input) : nil
|
485
|
+
on_elt = ! on_elt
|
475
486
|
|
476
|
-
|
477
|
-
break if st && et && st.empty? && et.empty?
|
487
|
+
cr = _parse(on_elt ? eltpa : seppa, input)
|
478
488
|
|
479
|
-
|
480
|
-
|
489
|
+
empty_stack = cr.empty? ? empty_stack + 1 : 0
|
490
|
+
cr.result = 0 if empty_stack > 1
|
491
|
+
#
|
492
|
+
# prevent "no progress"
|
481
493
|
|
482
|
-
|
483
|
-
|
494
|
+
r.children.push(cr)
|
495
|
+
|
496
|
+
if cr.result != 1
|
497
|
+
if on_elt && count > 0
|
498
|
+
lsep = r.children[-2]
|
499
|
+
lsep.result = 0
|
500
|
+
input.offset = lsep.offset
|
501
|
+
end
|
502
|
+
break
|
503
|
+
end
|
484
504
|
|
485
|
-
|
505
|
+
count += 1
|
486
506
|
end
|
487
507
|
|
488
|
-
r.result = 0 if jseq &&
|
508
|
+
r.result = 0 if jseq && count < 1
|
489
509
|
end
|
490
510
|
|
491
511
|
if r.result == 1 && endpa
|
data/raabro.gemspec
CHANGED
@@ -10,7 +10,7 @@ Gem::Specification.new do |s|
|
|
10
10
|
s.platform = Gem::Platform::RUBY
|
11
11
|
s.authors = [ 'John Mettraux' ]
|
12
12
|
s.email = [ 'jmettraux+flor@gmail.com' ]
|
13
|
-
s.homepage = '
|
13
|
+
s.homepage = 'https://github.com/floraison/raabro'
|
14
14
|
s.license = 'MIT'
|
15
15
|
s.summary = 'a very dumb PEG parser library'
|
16
16
|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: raabro
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.4.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- John Mettraux
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-
|
11
|
+
date: 2020-10-05 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rspec
|
@@ -38,7 +38,7 @@ files:
|
|
38
38
|
- README.md
|
39
39
|
- lib/raabro.rb
|
40
40
|
- raabro.gemspec
|
41
|
-
homepage:
|
41
|
+
homepage: https://github.com/floraison/raabro
|
42
42
|
licenses:
|
43
43
|
- MIT
|
44
44
|
metadata: {}
|