FileDocCategorySizeDatePackage
GrammarAtom.javaAPI DocGlassfish v2 API1731Wed Aug 30 15:34:08 BST 2006persistence.antlr

GrammarAtom

public abstract class GrammarAtom extends AlternativeElement
A GrammarAtom is either a token ref, a character ref, or string. The analysis doesn't care.

Fields Summary
protected String
label
protected String
atomText
protected int
tokenType
protected boolean
not
protected String
ASTNodeType
Set to type of AST node to create during parse. Defaults to what is set in the TokenSymbol.
Constructors Summary
public GrammarAtom(Grammar g, Token t, int autoGenType)


           
        super(g, t, autoGenType);
        atomText = t.getText();
    
Methods Summary
public java.lang.StringgetASTNodeType()

        return ASTNodeType;
    
public java.lang.StringgetLabel()

        return label;
    
public java.lang.StringgetText()

        return atomText;
    
public intgetType()

        return tokenType;
    
public voidsetASTNodeType(java.lang.String type)

        ASTNodeType = type;
    
public voidsetLabel(java.lang.String label_)

        label = label_;
    
public voidsetOption(persistence.antlr.Token option, persistence.antlr.Token value)

        if (option.getText().equals("AST")) {
            setASTNodeType(value.getText());
        }
        else {
            grammar.antlrTool.error("Invalid element option:" + option.getText(),
                               grammar.getFilename(), option.getLine(), option.getColumn());
        }
    
public java.lang.StringtoString()

        String s = " ";
        if (label != null) s += label + ":";
        if (not) s += "~";
        return s + atomText;