# Autogenerated from a Treetop grammar. Edits may be lost. require "hemingway/math/math_nodes" module Hemingway module Math include Treetop::Runtime def root @root ||= :math end module Math0 def math_start elements[0] end def symbol elements[1] end def math_end elements[2] end end def _nt_math start_index = index if node_cache[:math].has_key?(index) cached = node_cache[:math][index] if cached cached = SyntaxNode.new(input, index...(index + 1)) if cached == true @index = cached.interval.end end return cached end i0, s0 = index, [] r1 = _nt_math_start s0 << r1 if r1 r2 = _nt_symbol s0 << r2 if r2 r3 = _nt_math_end s0 << r3 end end if s0.last r0 = instantiate_node(MathNode,input, i0...index, s0) r0.extend(Math0) else @index = i0 r0 = nil end node_cache[:math][start_index] = r0 r0 end def _nt_symbol start_index = index if node_cache[:symbol].has_key?(index) cached = node_cache[:symbol][index] if cached cached = SyntaxNode.new(input, index...(index + 1)) if cached == true @index = cached.interval.end end return cached end r0 = _nt_math_symbol node_cache[:symbol][start_index] = r0 r0 end def _nt_math_start start_index = index if node_cache[:math_start].has_key?(index) cached = node_cache[:math_start][index] if cached cached = SyntaxNode.new(input, index...(index + 1)) if cached == true @index = cached.interval.end end return cached end if has_terminal?("$", false, index) r0 = instantiate_node(SyntaxNode,input, index...(index + 1)) @index += 1 else terminal_parse_failure("$") r0 = nil end node_cache[:math_start][start_index] = r0 r0 end def _nt_math_end start_index = index if node_cache[:math_end].has_key?(index) cached = node_cache[:math_end][index] if cached cached = SyntaxNode.new(input, index...(index + 1)) if cached == true @index = cached.interval.end end return cached end if has_terminal?("$", false, index) r0 = instantiate_node(SyntaxNode,input, index...(index + 1)) @index += 1 else terminal_parse_failure("$") r0 = nil end node_cache[:math_end][start_index] = r0 r0 end end class MathParser < Treetop::Runtime::CompiledParser include Math end end