Package org.codehaus.groovy.syntax
Class ASTHelper
- java.lang.Object
-
- org.codehaus.groovy.syntax.ASTHelper
-
- Direct Known Subclasses:
AntlrParserPlugin
public class ASTHelper extends Object
A common base class of AST helper methods which can be shared across the classic and new parsers
-
-
Field Summary
Fields Modifier and Type Field Description protected ModuleNode
output
protected static Map
resolutions
-
Constructor Summary
Constructors Constructor Description ASTHelper()
ASTHelper(SourceUnit controller, ClassLoader classLoader)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description protected void
addImport(ClassNode type, String name, String aliasName)
protected void
addImport(ClassNode type, String name, String aliasName, List<AnnotationNode> annotations)
protected void
addStarImport(String importPackage)
protected void
addStarImport(String importPackage, List<AnnotationNode> annotations)
protected void
addStaticImport(ClassNode type, String name, String alias)
protected void
addStaticImport(ClassNode type, String name, String alias, List<AnnotationNode> annotations)
protected void
addStaticStarImport(ClassNode type, String importClass)
protected void
addStaticStarImport(ClassNode type, String importClass, List<AnnotationNode> annotations)
protected String
dot(String base)
A synonym fordot( base, "" )
.static String
dot(String base, String name)
ClassLoader
getClassLoader()
Returns our class loader (as supplied on construction).SourceUnit
getController()
String
getPackageName()
protected void
makeModule()
void
setClassLoader(ClassLoader classLoader)
void
setController(SourceUnit controller)
PackageNode
setPackage(String packageName, List<AnnotationNode> annotations)
void
setPackageName(String packageName)
-
-
-
Field Detail
-
output
protected ModuleNode output
-
resolutions
protected static Map resolutions
-
-
Constructor Detail
-
ASTHelper
public ASTHelper(SourceUnit controller, ClassLoader classLoader)
-
ASTHelper
public ASTHelper()
-
-
Method Detail
-
getPackageName
public String getPackageName()
-
setPackageName
public void setPackageName(String packageName)
-
setPackage
public PackageNode setPackage(String packageName, List<AnnotationNode> annotations)
-
getClassLoader
public ClassLoader getClassLoader()
Returns our class loader (as supplied on construction).
-
setClassLoader
public void setClassLoader(ClassLoader classLoader)
-
getController
public SourceUnit getController()
-
setController
public void setController(SourceUnit controller)
-
dot
public static String dot(String base, String name)
- Parameters:
base
- typically a packagename
- typically a simple unqualified class name- Returns:
- Two names joined by a dot. If the base name is empty, returns the name unchanged.
-
makeModule
protected void makeModule()
-
addImport
protected void addImport(ClassNode type, String name, String aliasName, List<AnnotationNode> annotations)
-
addStaticImport
protected void addStaticImport(ClassNode type, String name, String alias, List<AnnotationNode> annotations)
-
addStaticStarImport
protected void addStaticStarImport(ClassNode type, String importClass, List<AnnotationNode> annotations)
-
addStarImport
protected void addStarImport(String importPackage)
-
addStarImport
protected void addStarImport(String importPackage, List<AnnotationNode> annotations)
-
-