class Rattler::Compiler::Optimizer::InlineRegularRules

References to regular parse rules can be inlined without affecting how they parse, assuming the referenced rule does not change. This optimization is only applied if the referenced rule is regular and marked for inlining.

Protected Instance Methods

_applies_to?(parser, context) click to toggle source
# File lib/rattler/compiler/optimizer/inline_regular_rules.rb, line 14
def _applies_to?(parser, context)
  parser.is_a? Apply and
  context.inlineable? parser.rule_name
end
_apply(parser, context) click to toggle source
# File lib/rattler/compiler/optimizer/inline_regular_rules.rb, line 19
def _apply(parser, context)
  context.rules[parser.rule_name].expr
end