FileDocCategorySizeDatePackage
TreeWalkerGrammar.javaAPI DocGlassfish v2 API2563Wed Aug 30 15:34:12 BST 2006persistence.antlr

TreeWalkerGrammar

public class TreeWalkerGrammar extends Grammar
Parser-specific grammar subclass

Fields Summary
protected boolean
transform
Constructors Summary
TreeWalkerGrammar(String className_, Tool tool_, String superClass)



          
        super(className_, tool_, superClass);
    
Methods Summary
public voidgenerate()
Top-level call to generate the code for this grammar

        generator.gen(this);
    
protected java.lang.StringgetSuperClass()

        return "TreeParser";
    
public voidprocessArguments(java.lang.String[] args)
Process command line arguments. -trace have all rules call traceIn/traceOut -traceParser have parser rules call traceIn/traceOut -debug generate debugging output for parser debugger

        for (int i = 0; i < args.length; i++) {
            if (args[i].equals("-trace")) {
                traceRules = true;
                antlrTool.setArgOK(i);
            }
            else if (args[i].equals("-traceTreeParser")) {
                traceRules = true;
                antlrTool.setArgOK(i);
            }
//			else if ( args[i].equals("-debug") ) {
//				debuggingOutput = true;
//				superClass = "parseview.DebuggingTreeWalker";
//				Tool.setArgOK(i);
//			}
        }
    
public booleansetOption(java.lang.String key, persistence.antlr.Token value)
Set tree parser options

        if (key.equals("buildAST")) {
            if (value.getText().equals("true")) {
                buildAST = true;
            }
            else if (value.getText().equals("false")) {
                buildAST = false;
            }
            else {
                antlrTool.error("buildAST option must be true or false", getFilename(), value.getLine(), value.getColumn());
            }
            return true;
        }
        if (key.equals("ASTLabelType")) {
            super.setOption(key, value);
            return true;
        }
        if (super.setOption(key, value)) {
            return true;
        }
        antlrTool.error("Invalid option: " + key, getFilename(), value.getLine(), value.getColumn());
        return false;