public final class JavaRecognizer extends Recognizer
Recognizer.ParseException| Modifier and Type | Field and Description |
|---|---|
static int |
JDK_1_3
Indicates JDK version 1.3.
|
static int |
JDK_1_4
Indicates JDK version 1.4.
|
lexer, parser, UNKNOWN_FILE| Constructor and Description |
|---|
JavaRecognizer()
Creates a new JavaRecognizer object.
|
| Modifier and Type | Method and Description |
|---|---|
void |
attachAnnotations(java.util.List annotations)
Attaches the given annotations to the current input source.
|
java.util.List |
detachAnnotations()
Detaches all annotations.
|
java.lang.String |
getPackageName()
Returns the package name of the parsed source file.
|
de.hunsicker.antlr.collections.AST |
getParseTree()
Returns the root node of the generated parse tree.
|
Position |
getPosition()
Returns the tracked position information.
|
boolean |
hasAnnotations()
Indicates whether the current tree contains annotations.
|
boolean |
hasPosition()
Determines whether the current tree contains a node that needs its position to be
tracked.
|
void |
parse(java.io.Reader in,
java.lang.String filename)
Parses the given stream.
|
void |
setPosition(int line,
int column)
Sets a position in the given input source that should be tracked.
|
getColumn, getFileFormat, getLexer, getLine, getParser, isFinished, isRunning, parse, parse, reset, setColumn, setLinepublic static final int JDK_1_3
public static final int JDK_1_4
public java.lang.String getPackageName()
java.lang.IllegalStateException - if the parser is still running or wasn't started
yet.public de.hunsicker.antlr.collections.AST getParseTree()
As we don't use checked exceptions to indicate runtime failures, one may check successful execution of the transformations prior to perform further processing:
if (myJalopyInstance.getState() == Jalopy.State.ERROR)
{
// transformation failed, errors were already issued; perform
// any custom error handling code you need
}
else
{
// perform further logic
}
getParseTree in class Recognizer<JavaNode>).java.lang.IllegalStateException - if the parser is still running or wasn't started
yet.Jalopy.getState()public void setPosition(int line,
int column)
line - a valid line number (>= 1).column - a valid column offset (>= 1).java.lang.IllegalArgumentException - if either line or column
< 1public Position getPosition()
null if no position should have been
tracked.public void attachAnnotations(java.util.List annotations)
annotations - list with annotations (of type <Annotation>).Annotation,
detachAnnotations()public java.util.List detachAnnotations()
<Annotation>). Returns an
empty list in case no annotations were attached for the input source.attachAnnotations(java.util.List)public boolean hasAnnotations()
true if the tree contains annotations.public boolean hasPosition()
true if the tree contains a node that needs its position to
be tracked.public void parse(java.io.Reader in,
java.lang.String filename)
parse in class Recognizerin - stream we read from.filename - name of the file we parse.
Submit a bug or feature.
For further information and documentation, visit the official Jalopy website.
This page generated: March 30 2013