Class: TRuby::ParserCombinator::Map
- Defined in:
- lib/t_ruby/parser_combinator.rb
Overview
Map result
Instance Method Summary collapse
-
#initialize(parser, func) ⇒ Map
constructor
A new instance of Map.
- #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, func) ⇒ Map
Returns a new instance of Map.
266 267 268 269 |
# File 'lib/t_ruby/parser_combinator.rb', line 266 def initialize(parser, func) @parser = parser @func = func end |
Instance Method Details
#parse(input, position = 0) ⇒ Object
271 272 273 |
# File 'lib/t_ruby/parser_combinator.rb', line 271 def parse(input, position = 0) @parser.parse(input, position).map(&@func) end |