001/* 002 * Copyright (C) 2009-2011 Mathias Doenitz 003 * 004 * Licensed under the Apache License, Version 2.0 (the "License"); 005 * you may not use this file except in compliance with the License. 006 * You may obtain a copy of the License at 007 * 008 * http://www.apache.org/licenses/LICENSE-2.0 009 * 010 * Unless required by applicable law or agreed to in writing, software 011 * distributed under the License is distributed on an "AS IS" BASIS, 012 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 013 * See the License for the specific language governing permissions and 014 * limitations under the License. 015 */ 016 017package org.parboiled; 018 019import org.parboiled.matchers.Matcher; 020import org.parboiled.trees.TreeNode; 021import org.parboiled.matchers.Matcher; 022 023/** 024 * Represents a node in the parse tree created during a parsing run. 025 */ 026public interface Node<V> extends TreeNode<Node<V>> { 027 028 /** 029 * Returns the matcher that created this node. 030 * 031 * @return the matcher that created this node. 032 */ 033 Matcher getMatcher(); 034 035 /** 036 * Returns the label of this node which is equal to the name of the rule that created this node 037 * 038 * @return the label of this node 039 */ 040 String getLabel(); 041 042 /** 043 * Returns the start index of this nodes text in the underlying input buffer. 044 * 045 * @return the start index 046 */ 047 int getStartIndex(); 048 049 /** 050 * Returns the end index of this nodes text in the underlying input buffer, i.e. the index of the character 051 * immediately following the last character matched by this node. 052 * 053 * @return the end index 054 */ 055 int getEndIndex(); 056 057 /** 058 * Returns the value object attached to this node. 059 * 060 * @return the value object 061 */ 062 V getValue(); 063 064 /** 065 * @return true if there were parse errors in the input range covered by this node 066 */ 067 boolean hasError(); 068}