Class: Farseer::Any
Instance Method Summary collapse
- #helper(input, tokens) ⇒ Object
-
#initialize(parser) ⇒ Any
constructor
A new instance of Any.
- #parse(input) ⇒ Object
Methods included from MapFactory
Constructor Details
#initialize(parser) ⇒ Any
Returns a new instance of Any.
7 8 9 10 |
# File 'lib/farseer/any.rb', line 7 def initialize(parser) @parser = parser freeze end |
Instance Method Details
#helper(input, tokens) ⇒ Object
16 17 18 19 20 |
# File 'lib/farseer/any.rb', line 16 def helper(input, tokens) @parser.parse(input) .bind { |r| helper(r.rest, tokens + r.token) } .map_none { Result.new(tokens, input) } end |
#parse(input) ⇒ Object
12 13 14 |
# File 'lib/farseer/any.rb', line 12 def parse(input) helper(input, '') end |