Class: Chomsky::ParserGenerator::Some
- Inherits:
-
Chomsky::ParserGenerator
- Object
- Chomsky::ParserGenerator
- Chomsky::ParserGenerator::Some
- Defined in:
- lib/chomsky/parser_generators/some.rb
Instance Method Summary collapse
Methods inherited from Chomsky::ParserGenerator
Methods included from Combinators
#!, #%, #&, #*, #+, #-, #<, #>, #>=, #>>, #[], #_?, #capture, #reference, #|
Constructor Details
This class inherits a constructor from Chomsky::ParserGenerator
Instance Method Details
#call(string) ⇒ Object
6 7 8 9 10 11 12 13 14 15 16 17 18 |
# File 'lib/chomsky/parser_generators/some.rb', line 6 def call string head, rest = @parser.(string) if head more = "" until more.nil? more, rest = @parser.(rest) head += more if more end [head, rest] else [nil, string] end end |