class Rattler::Compiler::Optimizer::FlattenCapturingSequence
Nested sequence expressions can be flattened without affecting how they parse if the nested sequence expressions are not multi-capturing.
Protected Instance Methods
_applies_to?(parser, context)
click to toggle source
Calls superclass method
# File lib/rattler/compiler/optimizer/flatten_sequence.rb, line 32 def _applies_to?(parser, context) context.capturing? and parser.is_a?(Sequence) and super end
eligible_child?(child)
click to toggle source
# File lib/rattler/compiler/optimizer/flatten_sequence.rb, line 38 def eligible_child?(child) child.is_a?(Sequence) and child.capture_count <= 1 end