# Treetop (http://treetop.rubyforge.org/) grammar for common definitions. # Autogenerated from a Treetop grammar. Edits may be lost. require 'treetop' module Fig module Grammar module Base include Treetop::Runtime def root @root ||= :ws end def _nt_ws start_index = index if node_cache[:ws].has_key?(index) cached = node_cache[:ws][index] if cached cached = SyntaxNode.new(input, index...(index + 1)) if cached == true @index = cached.interval.end end return cached end s0, i0 = [], index loop do if has_terminal?('\G[ \\n\\r\\t]', true, index) r1 = true @index += 1 else r1 = nil end if r1 s0 << r1 else break end end if s0.empty? @index = i0 r0 = nil else r0 = instantiate_node(SyntaxNode,input, i0...index, s0) end node_cache[:ws][start_index] = r0 r0 end def _nt_optional_ws start_index = index if node_cache[:optional_ws].has_key?(index) cached = node_cache[:optional_ws][index] if cached cached = SyntaxNode.new(input, index...(index + 1)) if cached == true @index = cached.interval.end end return cached end s0, i0 = [], index loop do if has_terminal?('\G[ \\n\\r\\t]', true, index) r1 = true @index += 1 else r1 = nil end if r1 s0 << r1 else break end end r0 = instantiate_node(SyntaxNode,input, i0...index, s0) node_cache[:optional_ws][start_index] = r0 r0 end module Comment0 end def _nt_comment start_index = index if node_cache[:comment].has_key?(index) cached = node_cache[:comment][index] if cached cached = SyntaxNode.new(input, index...(index + 1)) if cached == true @index = cached.interval.end end return cached end i0, s0 = index, [] if has_terminal?('#', false, index) r1 = instantiate_node(SyntaxNode,input, index...(index + 1)) @index += 1 else terminal_parse_failure('#') r1 = nil end s0 << r1 if r1 s2, i2 = [], index loop do if has_terminal?('\G[^\\n]', true, index) r3 = true @index += 1 else r3 = nil end if r3 s2 << r3 else break end end r2 = instantiate_node(SyntaxNode,input, i2...index, s2) s0 << r2 if r2 if has_terminal?("\n", false, index) r4 = instantiate_node(SyntaxNode,input, index...(index + 1)) @index += 1 else terminal_parse_failure("\n") r4 = nil end s0 << r4 end end if s0.last r0 = instantiate_node(SyntaxNode,input, i0...index, s0) r0.extend(Comment0) else @index = i0 r0 = nil end node_cache[:comment][start_index] = r0 r0 end def _nt_ws_or_comment start_index = index if node_cache[:ws_or_comment].has_key?(index) cached = node_cache[:ws_or_comment][index] if cached cached = SyntaxNode.new(input, index...(index + 1)) if cached == true @index = cached.interval.end end return cached end i0 = index r1 = _nt_ws if r1 r0 = r1 else r2 = _nt_comment if r2 r0 = r2 else @index = i0 r0 = nil end end node_cache[:ws_or_comment][start_index] = r0 r0 end def _nt_optional_ws_or_comment start_index = index if node_cache[:optional_ws_or_comment].has_key?(index) cached = node_cache[:optional_ws_or_comment][index] if cached cached = SyntaxNode.new(input, index...(index + 1)) if cached == true @index = cached.interval.end end return cached end s0, i0 = [], index loop do r1 = _nt_ws_or_comment if r1 s0 << r1 else break end end r0 = instantiate_node(SyntaxNode,input, i0...index, s0) node_cache[:optional_ws_or_comment][start_index] = r0 r0 end end class BaseParser < Treetop::Runtime::CompiledParser include Base end end end