class Rattler::Compiler::Optimizer::OptimizeChildren
Optimizes all of the children of a parser model in the appropriate context.
Protected Instance Methods
_applies_to?(parser, context)
click to toggle source
# File lib/rattler/compiler/optimizer/optimize_children.rb, line 13 def _applies_to?(parser, context) !parser.children.empty? and (parser.any? do |_| optimizations.applies_to? _, child_context(parser, context) end) end
_apply(parser, context)
click to toggle source
# File lib/rattler/compiler/optimizer/optimize_children.rb, line 20 def _apply(parser, context) parser.with_children(parser.map do |_| optimizations.apply _, child_context(parser, context) end) end
Private Instance Methods
child_context(parser, context)
click to toggle source
# File lib/rattler/compiler/optimizer/optimize_children.rb, line 28 def child_context(parser, context) case parser when Assert, Disallow, Token, Skip context.with :type => :matching else context end end