class Temple::Mixins::GrammarDSL::Root
def after_copy(source)
def after_copy(source) @grammar.const_set(@name, self) super end
def copy_to(grammar)
def copy_to(grammar) grammar.const_defined?(@name) ? grammar.const_get(@name) : super end
def initialize(grammar, name)
def initialize(grammar, name) super(grammar) @name = name.to_sym end
def match(exp, unmatched)
def match(exp, unmatched) success = super unmatched << [@name, exp] unless success success end
def validate!(exp)
def validate!(exp) unmatched = [] unless match(exp, unmatched) require 'pp' entry = unmatched.first unmatched.reverse_each do |u| entry = u if u.flatten.size < entry.flatten.size end raise(InvalidExpression, PP.pp(entry.last, "#{@grammar}::#{entry.first} did not match\n".dup)) end end