FileDocCategorySizeDatePackage
NameSpace.javaAPI DocGlassfish v2 API1733Wed Aug 30 15:34:08 BST 2006persistence.antlr

NameSpace

public class NameSpace extends Object
ANTLR Translator Generator Project led by Terence Parr at http://www.jGuru.com Software rights: http://www.antlr.org/license.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

Fields Summary
private Vector
names
private String
_name
Constructors Summary
public NameSpace(String name)


       
    	  _name = new String(name);
        parse(name);
    
Methods Summary
voidemitClosures(java.io.PrintWriter out)
Method to generate the required C++ namespace closures

        for (int i = 0; i < names.size(); ++i)
            out.println("ANTLR_END_NAMESPACE");
    
voidemitDeclarations(java.io.PrintWriter out)
Method to generate the required C++ namespace declarations

        for (Enumeration n = names.elements(); n.hasMoreElements();) {
            String s = (String)n.nextElement();
            out.println("ANTLR_BEGIN_NAMESPACE(" + s + ")");
        }
    
public java.lang.StringgetName()

	 	return _name;
	 
protected voidparse(java.lang.String 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

        StringTokenizer tok = new StringTokenizer(name, "::");
        while (tok.hasMoreTokens())
            names.addElement(tok.nextToken());