⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 treenodestream.java

📁 antlr最新版本V3源代码
💻 JAVA
字号:
/*[The "BSD licence"]Copyright (c) 2005-2006 Terence ParrAll rights reserved.Redistribution and use in source and binary forms, with or withoutmodification, are permitted provided that the following conditionsare met:1. Redistributions of source code must retain the above copyrightnotice, this list of conditions and the following disclaimer.2. Redistributions in binary form must reproduce the above copyrightnotice, this list of conditions and the following disclaimer in thedocumentation and/or other materials provided with the distribution.3. The name of the author may not be used to endorse or promote productsderived from this software without specific prior written permission.THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS ORIMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIESOF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUTNOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANYTHEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OFTHIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.*/package org.antlr.runtime.tree;import org.antlr.runtime.IntStream;import org.antlr.runtime.TokenStream;/** A stream of tree nodes, accessing nodes from a tree of some kind */public interface TreeNodeStream extends IntStream {	/** Get a tree node at an absolute index i; 0..n-1.	 *  If you don't want to buffer up nodes, then this method makes no	 *  sense for you.	 */	public Object get(int i);	/** Get tree node at current input pointer + i ahead where i=1 is next node.	 *  i<0 indicates nodes in the past.  So LT(-1) is previous node, but	 *  implementations are not required to provide results for k < -1.	 *  LT(0) is undefined.  For i>=n, return null.	 *  Return null for LT(0) and any index that results in an absolute address	 *  that is negative.	 *	 *  This is analogus to the LT() method of the TokenStream, but this	 *  returns a tree node instead of a token.  Makes code gen identical	 *  for both parser and tree grammars. :)	 */	public Object LT(int k);	/** Where is this stream pulling nodes from?  This is not the name, but	 *  the object that provides node objects.	 */	public Object getTreeSource();	/** If the tree associated with this stream was created from a TokenStream,	 *  you can specify it here.  Used to do rule $text attribute in tree	 *  parser.  Optional unless you use tree parser rule text attribute	 *  or output=template and rewrite=true options.	 */	public TokenStream getTokenStream();	/** What adaptor can tell me how to interpret/navigate nodes and	 *  trees.  E.g., get text of a node.	 */	public TreeAdaptor getTreeAdaptor();	/** As we flatten the tree, we use UP, DOWN nodes to represent	 *  the tree structure.  When debugging we need unique nodes	 *  so we have to instantiate new ones.  When doing normal tree	 *  parsing, it's slow and a waste of memory to create unique	 *  navigation nodes.  Default should be false;	 */	public void setUniqueNavigationNodes(boolean uniqueNavigationNodes);	/** Return the text of all nodes from start to stop, inclusive.	 *  If the stream does not buffer all the nodes then it can still	 *  walk recursively from start until stop.  You can always return	 *  null or "" too, but users should not access $ruleLabel.text in	 *  an action of course in that case.	 */	public String toString(Object start, Object stop);}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -