Class: TRuby::ParserCombinator::TokenMap
- Inherits:
-
TokenParser
- Object
- TokenParser
- TRuby::ParserCombinator::TokenMap
- Defined in:
- lib/t_ruby/parser_combinator/token/token_map.rb
Overview
Map result
Instance Method Summary collapse
-
#initialize(parser, func) ⇒ TokenMap
constructor
A new instance of TokenMap.
- #parse(tokens, position = 0) ⇒ Object
Methods inherited from TokenParser
#<<, #>>, #label, #many, #many1, #map, #optional, #sep_by, #sep_by1, #|
Constructor Details
#initialize(parser, func) ⇒ TokenMap
Returns a new instance of TokenMap.
7 8 9 10 |
# File 'lib/t_ruby/parser_combinator/token/token_map.rb', line 7 def initialize(parser, func) @parser = parser @func = func end |
Instance Method Details
#parse(tokens, position = 0) ⇒ Object
12 13 14 |
# File 'lib/t_ruby/parser_combinator/token/token_map.rb', line 12 def parse(tokens, position = 0) @parser.parse(tokens, position).map(&@func) end |