|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.codehaus.groovy.syntax.parser.ASTHelper
org.codehaus.groovy.syntax.parser.ASTBuilder
Builds an Abstract Syntax Tree from the Concrete Syntax Tree produced
by the Parser. The resulting AST is very preliminary, and must still
be validated and massaged before it is ready to be used.
build()
is the primary entry point.
Field Summary | |
static int[] |
EXPRESSION_HANDLERS
|
Fields inherited from class org.codehaus.groovy.syntax.parser.ASTHelper |
output, resolutions |
Constructor Summary | |
ASTBuilder(SourceUnit sourceUnit,
ClassLoader classLoader)
|
Method Summary | |
protected void |
addPropertyDeclaration(ClassNode classNode,
CSTNode reduction)
A synonym for addPropertyDeclaration( classNode, reduction, 0 ) . |
protected void |
addPropertyDeclaration(ClassNode classNode,
CSTNode reduction,
int extraModifiers)
Processes the Reduction produced by Parser.propertyDeclaration(). |
protected AssertStatement |
assertStatement(CSTNode reduction)
Processes the Reduction produced by Parser.assertStatement(). |
protected BreakStatement |
breakStatement(CSTNode reduction)
Processes the Reduction produced by Parser.breakStatement(). |
ModuleNode |
build(CSTNode input)
Builds an AST ModuleNode from a Parser.module() Reduction. |
protected CaseStatement |
caseStatement(CSTNode reduction)
Processes the Reduction produced by Parser.switchStatement() for cases. |
protected ClassNode |
classDeclaration(ClassNode context,
CSTNode reduction)
Processes the Reduction produced by Parser.classDeclaration(). |
protected ClassExpression |
classExpression(CSTNode reduction)
Converts a CSTNode into a ClassExpression. |
protected ClosureExpression |
closureExpression(CSTNode reduction)
Processes the Reduction produced by Parser.closureExpression(). |
protected ContinueStatement |
continueStatement(CSTNode reduction)
Processes the Reduction produced by Parser.continueStatement(). |
protected DoWhileStatement |
doWhileStatement(CSTNode reduction)
Processes the Reduction produced by Parser.doWhileStatement(). |
protected void |
error(String description,
CSTNode node)
Throws a ParserException . |
protected Expression |
expression(CSTNode reduction)
Processes the CSTNode produced by Parser.expression(). |
protected Expression[] |
expressions(CSTNode reduction)
Processes a series of expression to an Expression[]. |
protected Statement |
expressionStatement(CSTNode node)
Processes any expression that forms a complete statement. |
protected ForStatement |
forStatement(CSTNode reduction)
Processes the Reduction produced by Parser.forStatement(). |
protected Expression |
gstringExpression(CSTNode reduction)
Processes the Reduction produced by Parser.gstring(). |
protected String |
identifier(CSTNode identifier)
Returns the text of an identifier. |
protected IfStatement |
ifStatement(CSTNode reduction)
Processes the Reduction produced by Parser.ifStatement(). |
protected void |
importStatement(CSTNode reduction)
Processes the Reduction produced by Parser.importStatement(). |
protected void |
importStatements(CSTNode container)
Processes the imports Reduction produced by Parser.module(). |
Expression |
infixExpression(CSTNode reduction)
Processes most infix operators. |
protected ClassNode |
interfaceDeclaration(ClassNode context,
CSTNode reduction)
Processes the Reduction produced by Parser.interfaceDeclaration(). |
protected ListExpression |
listExpression(CSTNode reduction)
Processes one of the Reductions produced by Parser.listOrMapExpression(). |
protected String |
makeName(CSTNode root)
A synonym for makeName( root, "java.lang.Object" ) . |
protected String |
makeName(CSTNode root,
String defaultName)
Converts a CSTNode representation of a type name back into a string. |
protected MapExpression |
mapExpression(CSTNode reduction)
Processes the other Reduction produced by Parser.listOrMapExpression(). |
protected MethodCallExpression |
methodCallExpression(CSTNode reduction)
Processes a SYNTH_METHOD_CALL Reduction produced by Parser.expression(). |
protected MethodNode |
methodDeclaration(ClassNode classNode,
CSTNode reduction)
A synonym for methodDeclaration( classNode, reduction, 0 ) . |
protected MethodNode |
methodDeclaration(ClassNode classNode,
CSTNode reduction,
int extraModifiers)
Processes the Reduction produced by Parser.methodDeclaration(). |
protected int |
modifiers(CSTNode list)
Returns the ASM Constant bits for the specified modifiers. |
protected Expression |
newExpression(CSTNode reduction)
Processes the Reduction produced by Parser.newExpression(). |
Expression |
numericExpression(CSTNode reduction,
boolean negate)
Processes numeric literals. |
protected String |
packageDeclaration(CSTNode reduction)
Processes the Reduction produced by Parser.packageDeclaration(). |
protected Parameter[] |
parameterDeclarations(CSTNode reduction)
Processes the Reduction produced by Parser.parameterDeclarationList(). |
protected Expression |
parameterList(CSTNode reduction)
Processes the Reduction produced by Parser.parameterList(). |
Expression |
prefixExpression(CSTNode reduction)
Processes most prefix operators. |
protected String |
resolveName(CSTNode root)
A synonym for resolveName( root, true ) . |
protected String |
resolveName(CSTNode root,
boolean safe)
Builds a name from a CSTNode, then resolves it. |
protected ReturnStatement |
returnStatement(CSTNode reduction)
Processes the Reduction produced by Parser.returnStatement(). |
Expression |
simpleExpression(CSTNode reduction)
Processes most simple expressions. |
protected Statement |
statement(CSTNode reduction)
Processes the Reduction produced by Parser.statement(). |
protected BlockStatement |
statementBlock(CSTNode reduction)
Processes any statement block. |
protected BlockStatement |
statementBody(CSTNode reduction)
Processes the Reduction that results from Parser.statementBody(). |
protected BlockStatement |
statements(CSTNode reduction,
int first)
Processes any series of statements, starting at the specified offset and running to the end of the CSTNode. |
protected SwitchStatement |
switchStatement(CSTNode reduction)
Processes the Reduction produced by Parser.switchStatement(). |
protected SynchronizedStatement |
synchronizedStatement(CSTNode reduction)
Processes the Reduction produced by Parser.synchronizedStatement(). |
Expression |
syntheticExpression(CSTNode reduction)
Processes most synthetic expressions. |
protected ThrowStatement |
throwStatement(CSTNode reduction)
Processes the Reduction produced by Parser.throwStatement(). |
protected void |
topLevelStatement(ModuleNode module,
CSTNode reduction)
Processes the Reduction produced by Parser.topLevelStatement(). |
protected TryCatchStatement |
tryStatement(CSTNode reduction)
Processes the Reduction produced by Parser.tryStatement(). |
protected TupleExpression |
tupleExpression(CSTNode reduction)
Processes the Reduction produced by Parser.newArrayInitializer(). |
protected void |
typeBody(ClassNode classNode,
CSTNode body,
int propertyModifiers,
int methodModifiers)
Processes a type body for classDeclaration() and others. |
protected Type |
typeExpression(CSTNode reduction)
Converts an (possibly optional) type expression to a Type. |
protected Expression |
variableDeclarationExpression(CSTNode reduction)
Processes the Reduction produced by parsing a typed variable declaration. |
protected VariableExpression |
variableExpression(CSTNode reduction)
Converts a (typically IDENTIFIER) CSTNode to a VariableExpression, if valid. |
protected VariableExpression |
variableExpression(CSTNode reduction,
String type)
|
protected Expression |
variableOrClassExpression(CSTNode reduction)
Converts a (typically IDENTIFIER) CSTNode to a ClassExpression, if valid, or a VariableExpression otherwise. |
protected WhileStatement |
whileStatement(CSTNode reduction)
Processes the Reduction produced by Parser.whileStatement(). |
Methods inherited from class org.codehaus.groovy.syntax.parser.ASTHelper |
addNewClassName, dot, dot, getClassLoader, getController, getPackageName, importClass, importPackageWithStar, isDatatype, makeModule, resolveName, resolveNewClassOrName, setClassLoader, setController, setPackageName |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
public static final int[] EXPRESSION_HANDLERS
Constructor Detail |
public ASTBuilder(SourceUnit sourceUnit, ClassLoader classLoader)
Method Detail |
public ModuleNode build(CSTNode input) throws ParserException
ParserException
protected String packageDeclaration(CSTNode reduction)
protected void importStatements(CSTNode container)
protected void importStatement(CSTNode reduction)
protected void topLevelStatement(ModuleNode module, CSTNode reduction) throws ParserException
ParserException
protected ClassNode classDeclaration(ClassNode context, CSTNode reduction) throws ParserException
ParserException
protected void typeBody(ClassNode classNode, CSTNode body, int propertyModifiers, int methodModifiers) throws ParserException
ParserException
protected void addPropertyDeclaration(ClassNode classNode, CSTNode reduction, int extraModifiers) throws ParserException
ParserException
protected void addPropertyDeclaration(ClassNode classNode, CSTNode reduction) throws ParserException
addPropertyDeclaration( classNode, reduction, 0 )
.
ParserException
protected MethodNode methodDeclaration(ClassNode classNode, CSTNode reduction, int extraModifiers) throws ParserException
ParserException
protected MethodNode methodDeclaration(ClassNode classNode, CSTNode reduction) throws ParserException
methodDeclaration( classNode, reduction, 0 )
.
ParserException
protected Parameter[] parameterDeclarations(CSTNode reduction) throws ParserException
ParserException
protected ClassNode interfaceDeclaration(ClassNode context, CSTNode reduction) throws ParserException
ParserException
protected BlockStatement statementBody(CSTNode reduction) throws ParserException
ParserException
protected BlockStatement statements(CSTNode reduction, int first) throws ParserException
ParserException
protected BlockStatement statementBlock(CSTNode reduction) throws ParserException
ParserException
protected Statement statement(CSTNode reduction) throws ParserException
ParserException
protected AssertStatement assertStatement(CSTNode reduction) throws ParserException
ParserException
protected BreakStatement breakStatement(CSTNode reduction) throws ParserException
ParserException
protected ContinueStatement continueStatement(CSTNode reduction) throws ParserException
ParserException
protected IfStatement ifStatement(CSTNode reduction) throws ParserException
ParserException
protected ReturnStatement returnStatement(CSTNode reduction) throws ParserException
ParserException
protected SwitchStatement switchStatement(CSTNode reduction) throws ParserException
ParserException
protected CaseStatement caseStatement(CSTNode reduction) throws ParserException
ParserException
protected SynchronizedStatement synchronizedStatement(CSTNode reduction) throws ParserException
ParserException
protected ThrowStatement throwStatement(CSTNode reduction) throws ParserException
ParserException
protected TryCatchStatement tryStatement(CSTNode reduction) throws ParserException
ParserException
protected ForStatement forStatement(CSTNode reduction) throws ParserException
ParserException
protected DoWhileStatement doWhileStatement(CSTNode reduction) throws ParserException
ParserException
protected WhileStatement whileStatement(CSTNode reduction) throws ParserException
ParserException
protected Statement expressionStatement(CSTNode node) throws ParserException
ParserException
protected Expression[] expressions(CSTNode reduction) throws ParserException
ParserException
protected Expression expression(CSTNode reduction) throws ParserException
ParserException
public Expression infixExpression(CSTNode reduction) throws ParserException
ParserException
public Expression prefixExpression(CSTNode reduction) throws ParserException
ParserException
public Expression simpleExpression(CSTNode reduction) throws ParserException
ParserException
public Expression numericExpression(CSTNode reduction, boolean negate) throws ParserException
ParserException
public Expression syntheticExpression(CSTNode reduction) throws ParserException
ParserException
protected Expression variableOrClassExpression(CSTNode reduction) throws ParserException
ParserException
protected ClassExpression classExpression(CSTNode reduction) throws ParserException
ParserException
protected VariableExpression variableExpression(CSTNode reduction)
protected VariableExpression variableExpression(CSTNode reduction, String type)
protected Type typeExpression(CSTNode reduction)
protected Expression variableDeclarationExpression(CSTNode reduction) throws ParserException
ParserException
protected MethodCallExpression methodCallExpression(CSTNode reduction) throws ParserException
ParserException
protected ClosureExpression closureExpression(CSTNode reduction) throws ParserException
ParserException
protected Expression parameterList(CSTNode reduction) throws ParserException
ParserException
protected Expression newExpression(CSTNode reduction) throws ParserException
ParserException
protected TupleExpression tupleExpression(CSTNode reduction) throws ParserException
ParserException
protected Expression gstringExpression(CSTNode reduction) throws ParserException
ParserException
protected ListExpression listExpression(CSTNode reduction) throws ParserException
ParserException
protected MapExpression mapExpression(CSTNode reduction) throws ParserException
ParserException
protected String makeName(CSTNode root, String defaultName)
protected String makeName(CSTNode root)
makeName( root, "java.lang.Object" )
.
protected String identifier(CSTNode identifier)
protected String resolveName(CSTNode root, boolean safe)
protected String resolveName(CSTNode root)
resolveName( root, true )
.
protected int modifiers(CSTNode list)
protected void error(String description, CSTNode node) throws ParserException
ParserException
.
ParserException
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |