Class: TRuby::ParserCombinator::NotFollowedBy
- Defined in:
- lib/t_ruby/parser_combinator/combinators/not_followed_by.rb
Overview
Not followed by
Instance Method Summary collapse
-
#initialize(parser) ⇒ NotFollowedBy
constructor
A new instance of NotFollowedBy.
- #parse(input, position = 0) ⇒ Object
Methods inherited from Parser
#<<, #>>, #between, #flat_map, #label, #lookahead, #many, #many1, #map, #not_followed_by, #optional, #sep_by, #sep_by1, #|
Constructor Details
#initialize(parser) ⇒ NotFollowedBy
Returns a new instance of NotFollowedBy.
7 8 9 |
# File 'lib/t_ruby/parser_combinator/combinators/not_followed_by.rb', line 7 def initialize(parser) @parser = parser end |
Instance Method Details
#parse(input, position = 0) ⇒ Object
11 12 13 14 15 16 17 18 |
# File 'lib/t_ruby/parser_combinator/combinators/not_followed_by.rb', line 11 def parse(input, position = 0) result = @parser.parse(input, position) if result.failure? ParseResult.success(nil, input, position) else ParseResult.failure("Unexpected match", input, position) end end |