|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||
java.lang.Object
|
+--de.hunsicker.jalopy.language.Recognizer
|
+--de.hunsicker.jalopy.language.JavaRecognizer
The Java-specific recognizer. @author Marco Hunsicker@version $Revision: 1.7.2.14 $
| Nested Class Summary |
| Nested classes inherited from class de.hunsicker.jalopy.language.Recognizer |
Recognizer.ParseException |
| Field Summary | |
static int |
JDK_1_3
Indicates JDK version 1.3. |
static int |
JDK_1_4
Indicates JDK version 1.4. |
protected antlr.collections.AST |
root
DOCUMENT ME! |
| Fields inherited from class de.hunsicker.jalopy.language.Recognizer |
lexer, parser, UNKNOWN_FILE |
| Constructor Summary | |
JavaRecognizer(CompositeFactory factory)
Creates a new JavaRecognizer object. |
|
| Method Summary | |
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. |
antlr.collections.AST |
getParseTree()
Returns the root node of the generated parse tree. |
Position |
getPosition()
Returns the tracked position information. |
antlr.collections.AST |
getRoot()
DOCUMENT ME! |
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. |
| Methods inherited from class de.hunsicker.jalopy.language.Recognizer |
getColumn, getFileFormat, getLexer, getLine, getParser, getStartColumn, getStartLine, isFinished, isRunning, parse, parse, reset, set_startLine, setColumn, setLine |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
public static final int JDK_1_3
public static final int JDK_1_4
protected antlr.collections.AST root
| Constructor Detail |
public JavaRecognizer(CompositeFactory factory)
factory - DOCUMENT ME!| Method Detail |
public java.lang.String getPackageName()
java.lang.IllegalStateException - If an error occurspublic 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>). @throws
IllegalStateException if the parser is still running or wasn't started
yet. @see de.hunsicker.jalopy.Jalopy#getState
java.lang.IllegalStateException - DOCUMENT ME!
public void setPosition(int line,
int column)
>= 1). @param column a valid
column offset (>= 1). @throws IllegalArgumentException
if either line or column < 1@since
1.0b9
line - DOCUMENT ME!column - DOCUMENT ME!
java.lang.IllegalArgumentException - DOCUMENT ME!public Position getPosition()
null if no position should have been tracked. @since 1.0b9
public void attachAnnotations(java.util.List annotations)
<Annotation>).
annotations - DOCUMENT ME!@see #detachAnnotationspublic java.util.List detachAnnotations()
<Annotation>). Returns an
empty list in case no annotations were attached for the input source.
@since 1.0b9public boolean hasAnnotations()
true if the tree contains annotations. @since 1.0b9
public boolean hasPosition()
true if the tree contains a
node that needs its position to be tracked. @since 1.0b9
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.
java.lang.IllegalStateException - DOCUMENT ME!
ParseException - DOCUMENT ME!public antlr.collections.AST getRoot()
|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||