Class: TRuby::ParserCombinator::Fail

Inherits:
Parser
  • Object
show all
Defined in:
lib/t_ruby/parser_combinator.rb

Overview

Always fail

Instance Method Summary collapse

Methods inherited from Parser

#<<, #>>, #between, #flat_map, #label, #lookahead, #many, #many1, #map, #not_followed_by, #optional, #sep_by, #sep_by1, #|

Constructor Details

#initialize(message) ⇒ Fail

Returns a new instance of Fail.



203
204
205
# File 'lib/t_ruby/parser_combinator.rb', line 203

def initialize(message)
  @message = message
end

Instance Method Details

#parse(input, position = 0) ⇒ Object



207
208
209
# File 'lib/t_ruby/parser_combinator.rb', line 207

def parse(input, position = 0)
  ParseResult.failure(@message, input, position)
end