# Autogenerated from a Treetop grammar. Edits may be lost. require "hemingway/block/list/list_nodes" module Hemingway module Block module List include Treetop::Runtime def root @root ||= :list end def _nt_list start_index = index if node_cache[:list].has_key?(index) cached = node_cache[:list][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_item 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[:list][start_index] = r0 r0 end def _nt_list_type start_index = index if node_cache[:list_type].has_key?(index) cached = node_cache[:list_type][index] if cached cached = SyntaxNode.new(input, index...(index + 1)) if cached == true @index = cached.interval.end end return cached end i0 = index if has_terminal?("itemize", false, index) r1 = instantiate_node(ItemizeListNode,input, index...(index + 7)) @index += 7 else terminal_parse_failure("itemize") r1 = nil end if r1 r0 = r1 else if has_terminal?("enumerate", false, index) r2 = instantiate_node(EnumerateListNode,input, index...(index + 9)) @index += 9 else terminal_parse_failure("enumerate") r2 = nil end if r2 r0 = r2 else if has_terminal?("description", false, index) r3 = instantiate_node(DescriptionListNode,input, index...(index + 11)) @index += 11 else terminal_parse_failure("description") r3 = nil end if r3 r0 = r3 else @index = i0 r0 = nil end end end node_cache[:list_type][start_index] = r0 r0 end module Item0 def label elements[2] end def sequence elements[3] end end def _nt_item start_index = index if node_cache[:item].has_key?(index) cached = node_cache[:item][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?("\\item", false, index) r1 = instantiate_node(SyntaxNode,input, index...(index + 5)) @index += 5 else terminal_parse_failure("\\item") r1 = nil end s0 << r1 if r1 r3 = _nt_whitespace if r3 r2 = r3 else r2 = instantiate_node(SyntaxNode,input, index...index) end s0 << r2 if r2 r5 = _nt_label if r5 r4 = r5 else r4 = instantiate_node(SyntaxNode,input, index...index) end s0 << r4 if r4 s6, i6 = [], index loop do i7 = index r8 = _nt_content if r8 r7 = r8 else r9 = _nt_whitespace if r9 r7 = r9 else @index = i7 r7 = nil end end if r7 s6 << r7 else break end end r6 = instantiate_node(SyntaxNode,input, i6...index, s6) s0 << r6 end end end if s0.last r0 = instantiate_node(ItemNode,input, i0...index, s0) r0.extend(Item0) else @index = i0 r0 = nil end node_cache[:item][start_index] = r0 r0 end module Label0 def label_start elements[0] end def sequence elements[1] end def label_end elements[2] end end def _nt_label start_index = index if node_cache[:label].has_key?(index) cached = node_cache[:label][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_label_start s0 << r1 if r1 s2, i2 = [], index loop do r3 = _nt_label_content if r3 s2 << r3 else break end end r2 = instantiate_node(SyntaxNode,input, i2...index, s2) s0 << r2 if r2 r4 = _nt_label_end s0 << r4 end end if s0.last r0 = instantiate_node(LabelNode,input, i0...index, s0) r0.extend(Label0) else @index = i0 r0 = nil end node_cache[:label][start_index] = r0 r0 end def _nt_label_content start_index = index if node_cache[:label_content].has_key?(index) cached = node_cache[:label_content][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_special if r1 r0 = r1 else r2 = _nt_tag if r2 r0 = r2 else r3 = _nt_block if r3 r0 = r3 else r4 = _nt_math if r4 r0 = r4 else r5 = _nt_label_text if r5 r0 = r5 else @index = i0 r0 = nil end end end end end node_cache[:label_content][start_index] = r0 r0 end module LabelText0 end def _nt_label_text start_index = index if node_cache[:label_text].has_key?(index) cached = node_cache[:label_text][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 i1, s1 = index, [] i2 = index i3 = index r4 = _nt_non_text if r4 r3 = r4 else r5 = _nt_label_end if r5 r3 = r5 else @index = i3 r3 = nil end end if r3 r2 = nil else @index = i2 r2 = instantiate_node(SyntaxNode,input, index...index) end s1 << r2 if r2 if index < input_length r6 = instantiate_node(SyntaxNode,input, index...(index + 1)) @index += 1 else terminal_parse_failure("any character") r6 = nil end s1 << r6 end if s1.last r1 = instantiate_node(SyntaxNode,input, i1...index, s1) r1.extend(LabelText0) else @index = i1 r1 = nil end if r1 s0 << r1 else break end end if s0.empty? @index = i0 r0 = nil else r0 = instantiate_node(TextNode,input, i0...index, s0) end node_cache[:label_text][start_index] = r0 r0 end def _nt_label_start start_index = index if node_cache[:label_start].has_key?(index) cached = node_cache[:label_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[:label_start][start_index] = r0 r0 end def _nt_label_end start_index = index if node_cache[:label_end].has_key?(index) cached = node_cache[:label_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[:label_end][start_index] = r0 r0 end end class ListParser < Treetop::Runtime::CompiledParser include List end end end