| java.lang.Object org.codehaus.groovy.control.ProcessingUnit org.codehaus.groovy.control.SourceUnit
SourceUnit | public class SourceUnit extends ProcessingUnit (Code) | | Provides an anchor for a single source unit (usually a script file)
as it passes through the compiler system.
author: Chris Poirier author: Bing Ran version: $Id: SourceUnit.java 4098 2006-10-10 16:09:48Z blackdrag $ |
Constructor Summary | |
public | SourceUnit(String name, ReaderSource source, CompilerConfiguration flags, GroovyClassLoader loader, ErrorCollector er) Initializes the SourceUnit from existing machinery. | public | SourceUnit(File source, CompilerConfiguration configuration, GroovyClassLoader loader, ErrorCollector er) Initializes the SourceUnit from the specified file. | public | SourceUnit(URL source, CompilerConfiguration configuration, GroovyClassLoader loader, ErrorCollector er) Initializes the SourceUnit from the specified URL. | public | SourceUnit(String name, String source, CompilerConfiguration configuration, GroovyClassLoader loader, ErrorCollector er) Initializes the SourceUnit for a string of source. |
Method Summary | |
public void | addError(SyntaxException se) | public void | addException(Exception e) | public void | convert() Generates an AST from the CST. | public static SourceUnit | create(String name, String source) A convenience routine to create a standalone SourceUnit on a String
with defaults for almost everything that is configurable. | public static SourceUnit | create(String name, String source, int tolerance) A convenience routine to create a standalone SourceUnit on a String
with defaults for almost everything that is configurable. | public boolean | failedWithUnexpectedEOF() Convenience routine, primarily for use by the InteractiveShell,
that returns true if parse() failed with an unexpected EOF. | public ModuleNode | getAST() Returns the Abstract Syntax Tree produced during parse()ing
and expanded during later phases. | public Reduction | getCST() Returns the Concrete Syntax Tree produced during parse()ing. | public String | getName() Returns the name for the SourceUnit. | public String | getSample(int line, int column, Janitor janitor) Returns a sampling of the source at the specified line and column,
of null if it is unavailable. | public SourceSummary | getSourceSummary() | protected boolean | isEofToken(antlr.Token token) | public void | parse() Parses the source to a CST. |
ast | protected ModuleNode ast(Code) | | The root of the Abstract Syntax Tree for the source
|
name | protected String name(Code) | | A descriptive name of the source unit. This name shouldn't
be used for controling the SourceUnit, it is only for error
messages
|
create | public static SourceUnit create(String name, String source)(Code) | | A convenience routine to create a standalone SourceUnit on a String
with defaults for almost everything that is configurable.
|
create | public static SourceUnit create(String name, String source, int tolerance)(Code) | | A convenience routine to create a standalone SourceUnit on a String
with defaults for almost everything that is configurable.
|
failedWithUnexpectedEOF | public boolean failedWithUnexpectedEOF()(Code) | | Convenience routine, primarily for use by the InteractiveShell,
that returns true if parse() failed with an unexpected EOF.
|
getAST | public ModuleNode getAST()(Code) | | Returns the Abstract Syntax Tree produced during parse()ing
and expanded during later phases.
|
getCST | public Reduction getCST()(Code) | | Returns the Concrete Syntax Tree produced during parse()ing.
|
getName | public String getName()(Code) | | Returns the name for the SourceUnit. This name shouldn't
be used for controling the SourceUnit, it is only for error
messages
|
getSample | public String getSample(int line, int column, Janitor janitor)(Code) | | Returns a sampling of the source at the specified line and column,
of null if it is unavailable.
|
isEofToken | protected boolean isEofToken(antlr.Token token)(Code) | | |
|
|