class Rattler::Compiler::Optimizer::JoinMatchChoice
A choice of Regexp matches can be joined into a single Regexp match without affecting how it parses.
Protected Instance Methods
_applies_to?(parser, context)
click to toggle source
Calls superclass method
# File lib/rattler/compiler/optimizer/join_match_choice.rb, line 14 def _applies_to?(parser, context) parser.is_a?(Choice) and super end
eligible_child?(child)
click to toggle source
# File lib/rattler/compiler/optimizer/join_match_choice.rb, line 23 def eligible_child?(child) child.is_a? Match end
join_patterns(patterns)
click to toggle source
# File lib/rattler/compiler/optimizer/join_match_choice.rb, line 19 def join_patterns(patterns) patterns.join '|' end