Class: TRuby::ParserCombinator::Pure
- Defined in:
- lib/t_ruby/parser_combinator.rb
Overview
Always succeed with a value
Instance Method Summary collapse
-
#initialize(value) ⇒ Pure
constructor
A new instance of Pure.
- #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(value) ⇒ Pure
Returns a new instance of Pure.
192 193 194 |
# File 'lib/t_ruby/parser_combinator.rb', line 192 def initialize(value) @value = value end |
Instance Method Details
#parse(input, position = 0) ⇒ Object
196 197 198 |
# File 'lib/t_ruby/parser_combinator.rb', line 196 def parse(input, position = 0) ParseResult.success(@value, input, position) end |