class Rattler::Compiler::Optimizer::SimplifyTokenMatch
A token wrapping a terminal parser is redundant.
Protected Instance Methods
_applies_to?(parser, context)
click to toggle source
# File lib/rattler/compiler/optimizer/simplify_token_match.rb, line 12 def _applies_to?(parser, context) parser.is_a? Token and terminal? parser.child end
_apply(parser, context)
click to toggle source
# File lib/rattler/compiler/optimizer/simplify_token_match.rb, line 17 def _apply(parser, context) parser.child end
terminal?(parser)
click to toggle source
# File lib/rattler/compiler/optimizer/simplify_token_match.rb, line 21 def terminal?(parser) case parser when Match, Token, BackReference then true else false end end