[antlr-interest] Syntax I do not understand
ahwkong2000
anthony.kong at ufjia.com
Fri Jun 20 01:35:05 PDT 2003
Hi, all,
I think the list has grown rather quiet last few days. :-)
I am new to antlr and would like to know more about how to build a
lexer and parser. I am studying the TinyBasic.g
In the file I encountered:
functionDefinition
options {defaultErrorHandler = true;} // let ANTLR handle
errors
{
int fnType=0;
Vector pVector=null;
}
: p:"function"^ fnType=n:newFunction
{#p.setType(FUNCTION_DEF);}
{
theContext.pushScope(new
FunctionScope(theContext.getCurrentScope()));
}
pVector=params:parameters eol!
// now parse the body of the class
cb:procedureBlock
quit:"end" "function"! eol!
{
#quit.setType(EXIT_MODULE);
DTCodeType fnc;
fnc=new
DTFunction(fnType,#params,#cb,theContext.getCurren
tScope(),pVector,#n.getText());
#functionDefinition =
#(#[FUNCTION_DEF,"FUNCTION_DEF"],#functionDefinition);
theContext.popScope();
theContext.insertFunction(#n.getText(),fnc);
}
I do not quite understand the line:
#functionDefinition =
#(#[FUNCTION_DEF,"FUNCTION_DEF"],#functionDefinition);
What does it suppose to do here?
Any help is appreciated!
Anthony
Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/
More information about the antlr-interest
mailing list