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

📄 namespace.java

📁 SRI international 发布的OAA框架软件
💻 JAVA
字号:
package antlr_oaa;

/**
 * ANTLR Translator Generator
 * Project led by Terence Parr at http://www.jGuru.com
 * Software rights: http://www.antlr.org/RIGHTS.html
 *
 * Container for a C++ namespace specification.  Namespaces can be
 * nested, so this contains a vector of all the nested names.
 *
 * @author David Wagner (JPL/Caltech) 8-12-00
 *
 * $Id: NameSpace.java,v 1.1 2002/11/08 17:37:51 agno Exp $
 */

import java.util.Vector;
import java.util.Enumeration;
import java.io.PrintWriter;
import java.util.StringTokenizer;

public class NameSpace
{
	private Vector names = new Vector();

	public NameSpace(String name)
	{
		parse(name);
	}

	/**
	 * Parse a C++ namespace declaration into seperate names
	 * splitting on ::  We could easily parameterize this to make
	 * the delimiter a language-specific parameter, or use subclasses
	 * to support C++ namespaces versus java packages. -DAW
	 */
	protected void parse(String name)
	{
		StringTokenizer tok = new StringTokenizer(name, "::");
		while (tok.hasMoreTokens())
			names.addElement(tok.nextToken());
	}

	/**
	 * Method to generate the required C++ namespace declarations
	 */
	void emitDeclarations(PrintWriter out)
	{
		for( Enumeration n = names.elements(); n.hasMoreElements(); )
		{
			String s = (String)n.nextElement();
			out.println("ANTLR_BEGIN_NAMESPACE("+s+")");
		}
	}

	/**
	 * Method to generate the required C++ namespace closures
	 */
	void emitClosures(PrintWriter out)
	{
		for(int i=0; i < names.size(); ++i)
			out.println("ANTLR_END_NAMESPACE");
	}
}

⌨️ 快捷键说明

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