|
Oracle Fusion Middleware Java API Reference for Oracle Extension SDK Reference 11g Release 1 (11.1.1.1.0) E13403-02 |
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectoracle.javatools.parser.java.v1.symbol.JavaSymbolFactory
public class JavaSymbolFactory
The JavaSymbolFactory
is the layer between the
JavaTreeGenerator and the Java API. It completely hides the parse
data structure from the TreeGenerator. The abstraction also works
the other way. The JavaTreeGenerator hides the syntax stream from
the data structure. The JavaSymbolFactory is heavily dependent on
the JavaTreeGenerator. If the TreeGenerator is changed to support
different children for certain nodes, the JavaSymbolFactory should
be inspected to ascertain if there is any impact.
A lot of this code could be taken care of by having a JavaSymbol.wireSelfIntoTree method, but there are some useless nodes that are created during the tree generation. These nodes serve as necessary placeholders during the parsing stage but are useless afterwards. Thus, I decided not to create custom JavaSymbol subclasses for them. There is not really any appropriate place to put the code for wiring them into the tree, so all the node-to-node communication is here instead of being 70% in the nodes and 30% in here.
The factory basically two calls: create and finish. The create call creates an empty node and sets the parent node. The finish call wires the node into the parent node. The parse tree generation process works in depth-first fashion by creating skeletal structures while going down to the leaves and filling out and wiring up these structures on the way up. So, the create and finish simply map to enter and leave abstract operations on a tree node.
Field Summary |
---|
Constructor Summary | |
---|---|
JavaSymbolFactory(ReadTextBuffer buffer,
Scope scope)
|
Method Summary | |
---|---|
JavaSymbol |
createAndFinishErrorSymbol(SyntaxToken token,
CommonRoot root)
|
JavaSymbol |
createSymbol(int syntaxCode,
int startOffset,
int endOffset,
JavaSymbol parent)
Creates an empty symbol. |
JavaSymbol |
createSymbol(SyntaxToken token,
JavaSymbol parent)
Creates an empty symbol. |
void |
finishSymbol(JavaSymbol symbol)
Finishes a symbol's setup by looking at the symbol's syntax code and doing the appropriate wiring. |
void |
finishSymbol(JavaSymbol symbol,
SyntaxToken token)
Finishes a symbol's setup by looking at the symbol's syntax code and doing the appropriate wiring. |
boolean |
forceFinishSymbol(JavaSymbol symbol,
int endOffset)
Attempts to finish a symbol. |
static void |
postProcess(RootSymbol rootSym)
|
static void |
processJavadoc(RootSymbol rootSymbol)
Traverses the parse tree processing deprecated flags. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public JavaSymbolFactory(ReadTextBuffer buffer, Scope scope)
Method Detail |
---|
public JavaSymbol createAndFinishErrorSymbol(SyntaxToken token, CommonRoot root)
token
- The offending syntax token in the parse.error
- The string message for this errorroot
- The RootSymbol for this parse.
public JavaSymbol createSymbol(SyntaxToken token, JavaSymbol parent)
token
- The syntax token to be used for creation parameters.parent
- The parent node for this symbol. If unknown, set to null.
public JavaSymbol createSymbol(int syntaxCode, int startOffset, int endOffset, JavaSymbol parent)
syntaxCode
- The syntax code of this symbolstartOffset
- The start offset into the ReadTextBuffer. (inclusive)endOffset
- The end offset into the ReadTextBuffer. (exclusive)
If unknown, set to -1.parent
- The parent node for this symbol. If unknown, set to null.
public void finishSymbol(JavaSymbol symbol, SyntaxToken token)
In some case, especially during parsing, the end offset of the symbol is not known until the innards have been hooked up. Thus, this finishSymbol sets the end offset and wires up the symbol.
The buffer is used only to create the name string for the NameSymbols.
symbol
- The symbol to be finished.token
- The syntax token to be referenced for the end offset.buffer
- The ReadTextBuffer that this symbol was parsed from.public boolean forceFinishSymbol(JavaSymbol symbol, int endOffset)
public void finishSymbol(JavaSymbol symbol)
The buffer is used only to create the name string for the NameSymbols.
symbol
- The symbol to be finished.buffer
- The ReadTextBuffer that this symbol was parsed from.public static void postProcess(RootSymbol rootSym)
public static void processJavadoc(RootSymbol rootSymbol)
|
Oracle Fusion Middleware Java API Reference for Oracle Extension SDK Reference 11g Release 1 (11.1.1.1.0) E13403-02 |
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |