module WikiCreole include Treetop::Runtime def root @root || :Text end def _nt_Text start_index = index if node_cache[:Text].has_key?(index) cached = node_cache[:Text][index] @index = cached.interval.end if cached return cached end s0, i0 = [], index loop do r1 = _nt_TextLine if r1 s0 << r1 else break end end if s0.empty? self.index = i0 r0 = nil else r0 = instantiate_node(SyntaxNode,input, i0...index, s0) end node_cache[:Text][start_index] = r0 return r0 end module TextLine0 def LineStart elements[0] end def TextPart elements[1] end def LineEnd elements[2] end end def _nt_TextLine start_index = index if node_cache[:TextLine].has_key?(index) cached = node_cache[:TextLine][index] @index = cached.interval.end if cached return cached end i0, s0 = index, [] r1 = _nt_LineStart s0 << r1 if r1 r2 = _nt_TextPart s0 << r2 if r2 r3 = _nt_LineEnd s0 << r3 end end if s0.last r0 = instantiate_node(SyntaxNode,input, i0...index, s0) r0.extend(TextLine0) else self.index = i0 r0 = nil end node_cache[:TextLine][start_index] = r0 return r0 end def _nt_TextPart start_index = index if node_cache[:TextPart].has_key?(index) cached = node_cache[:TextPart][index] @index = cached.interval.end if cached return cached end s0, i0 = [], index loop do if input.index(Regexp.new('[^\\n]'), index) == index r1 = instantiate_node(SyntaxNode,input, index...(index + 1)) @index += 1 else r1 = nil end if r1 s0 << r1 else break end end r0 = instantiate_node(SyntaxNode,input, i0...index, s0) node_cache[:TextPart][start_index] = r0 return r0 end def _nt_LineStart start_index = index if node_cache[:LineStart].has_key?(index) cached = node_cache[:LineStart][index] @index = cached.interval.end if cached return cached end if input.index("\n", index) == index r0 = instantiate_node(SyntaxNode,input, index...(index + 1)) @index += 1 else terminal_parse_failure("\n") r0 = nil end node_cache[:LineStart][start_index] = r0 return r0 end def _nt_LineEnd start_index = index if node_cache[:LineEnd].has_key?(index) cached = node_cache[:LineEnd][index] @index = cached.interval.end if cached return cached end if input.index("\n", index) == index r0 = instantiate_node(SyntaxNode,input, index...(index + 1)) @index += 1 else terminal_parse_failure("\n") r0 = nil end node_cache[:LineEnd][start_index] = r0 return r0 end end class WikiCreoleParser < Treetop::Runtime::CompiledParser include WikiCreole end