raabro 1.0.4 → 1.0.5
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGELOG.txt +6 -0
- data/README.md +7 -0
- data/lib/raabro.rb +8 -9
- data/raabro.gemspec +1 -1
- metadata +3 -3
data/CHANGELOG.txt
CHANGED
data/README.md
CHANGED
@@ -73,6 +73,13 @@ The first parameter is the name used by rewrite rules.
|
|
73
73
|
The second parameter is a `Raabro::Input` instance, mostly a wrapped string.
|
74
74
|
|
75
75
|
```ruby
|
76
|
+
def str(name, input, string)
|
77
|
+
# matching a string
|
78
|
+
|
79
|
+
def rex(name, input, regex_or_string)
|
80
|
+
# matching a regexp
|
81
|
+
# no need for ^ or \A, checks the match occurs at current offset
|
82
|
+
|
76
83
|
def seq(name, input, *parsers)
|
77
84
|
# a sequence of parsers
|
78
85
|
|
data/lib/raabro.rb
CHANGED
@@ -26,7 +26,7 @@
|
|
26
26
|
|
27
27
|
module Raabro
|
28
28
|
|
29
|
-
VERSION = '1.0.
|
29
|
+
VERSION = '1.0.5'
|
30
30
|
|
31
31
|
class Input
|
32
32
|
|
@@ -174,15 +174,9 @@ module Raabro
|
|
174
174
|
|
175
175
|
def _narrow(parser)
|
176
176
|
|
177
|
-
|
177
|
+
fail ArgumentError.new("lone quantifier #{parser}") if _quantify(parser)
|
178
178
|
|
179
|
-
|
180
|
-
return method(parser) if parser.is_a?(Symbol)
|
181
|
-
|
182
|
-
k, m = parser.to_s.split('.')
|
183
|
-
k, m = [ Object, k ] unless m
|
184
|
-
|
185
|
-
Kernel.const_get(k).method(m)
|
179
|
+
method(parser.to_sym)
|
186
180
|
end
|
187
181
|
|
188
182
|
def _parse(parser, input)
|
@@ -401,6 +395,11 @@ module Raabro
|
|
401
395
|
|
402
396
|
def parse(input, opts={})
|
403
397
|
|
398
|
+
d = opts[:debug].to_i
|
399
|
+
opts[:rewrite] = false if d > 0
|
400
|
+
opts[:all] = false if d > 1
|
401
|
+
opts[:prune] = false if d > 2
|
402
|
+
|
404
403
|
opts[:prune] = true unless opts.has_key?(:prune)
|
405
404
|
|
406
405
|
root = self.respond_to?(:root) ? :root : @last
|
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@gmail.com' ]
|
13
|
-
s.homepage = 'http://github.com/jmettraux/
|
13
|
+
s.homepage = 'http://github.com/jmettraux/raabro'
|
14
14
|
s.rubyforge_project = 'rufus'
|
15
15
|
s.license = 'MIT'
|
16
16
|
s.summary = 'a very dumb PEG parser library'
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: raabro
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.5
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2015-09-
|
12
|
+
date: 2015-09-25 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rake
|
@@ -68,7 +68,7 @@ files:
|
|
68
68
|
- CHANGELOG.txt
|
69
69
|
- LICENSE.txt
|
70
70
|
- README.md
|
71
|
-
homepage: http://github.com/jmettraux/
|
71
|
+
homepage: http://github.com/jmettraux/raabro
|
72
72
|
licenses:
|
73
73
|
- MIT
|
74
74
|
post_install_message:
|