class Rattler::Parsers::Token
Token
decorates a parser to return the entire matched string
Public Instance Methods
parse(scanner, rules, scope = ParserScope.empty)
click to toggle source
If the decorated parser matches return the entire matched string, otherwise return a false value.
@param (see Match#parse
)
@return (see Match#parse
)
# File lib/rattler/parsers/token.rb, line 15 def parse(scanner, rules, scope = ParserScope.empty) p = scanner.pos child.parse(scanner, rules, scope) && scanner.string[p...(scanner.pos)] end