|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object BaseAST org.prorefactor.core.JPNode
public class JPNode
Extension to antlr.BaseAST, which allows us to extract an external "antlr" AST view of a Proparse AST, which we can then run tree parsers against. Note that tree transformation functions are currently (Feb 2004) untested and unused, since we tend to only use the AST for analysis and not for code motion.
Field Summary | |
---|---|
static int |
AK_ABBREVIATED
|
static int |
AK_FROMUSERDICT
|
static int |
AK_FULLTEXT
|
static int |
AK_INLINEVARDEF
|
static int |
AK_KEYWORD
|
static int |
AK_OPERATOR
|
static int |
AK_PROPARSEDIRECTIVE
|
static int |
AK_QUALIFIEDCLASS
|
static int |
AK_SOURCENUM
|
static int |
AK_STATE2
|
static int |
AK_STATEHEAD
|
static int |
AK_STORETYPE
|
static int |
AV_FALSE
|
static int |
AV_ST_DBTABLE
|
static int |
AV_ST_TTABLE
|
static int |
AV_ST_VARIABLE
|
static int |
AV_ST_WTABLE
|
static int |
AV_TRUE
|
static int |
BLOCK
A valid value for setLink() and getLink(). |
static int |
BUFFERSCOPE
A valid value for setLink() and getLink(). |
static int |
CONTEXT_QUALIFIER
Just a shortcut to IConstants.CONTEXT_QUALIFIER |
static int |
FILE_NAME_ARRAY
A value for setLink() and getLink(). |
static int |
STATE2
Just a shortcut to IConstants.STATE2 |
static int |
SUPER_CLASS_TREE
A value for setLink() and getLink(). |
static int |
SYMBOL
A valid value for setLink() and getLink() |
static int |
TETNode
A valid value for setLink() and getLink() |
Constructor Summary | |
---|---|
JPNode()
|
|
JPNode(int type)
Create an node with a given token type. |
|
JPNode(int file,
int line,
int column)
For temporary nodes for comparison in set of nodes sorted by position |
|
JPNode(int type,
JPNode original)
If this AST is constructed from another, then create with link to the original. |
|
JPNode(int type,
java.lang.String text)
|
|
JPNode(ProToken t)
|
Method Summary | |
---|---|
java.lang.String |
allLeadingHiddenText()
|
int |
attrGet(int key)
|
java.lang.String |
attrGetS(int attrNum)
|
java.lang.String |
attrGetS(java.lang.String attrName)
|
void |
attrSet(int key,
int val)
|
void |
attrSet(int key,
java.lang.String value)
|
void |
attrSetS(java.lang.String key,
java.lang.String value)
|
static void |
finalizeTrailingHidden(JPNode root)
|
JPNode |
findDirectChild(int nodeType)
Find the first direct child with a given node type. |
JPNode |
firstChild()
|
JPNode |
firstNaturalChild()
First Natural Child is found by repeating firstChild() until a natural node is found. |
Call |
getCall()
Some nodes like RUN, USER_FUNC, LOCAL_METHOD_REF have a Call object linked to them by TreeParser01. |
int |
getColumn()
|
java.lang.String |
getComments()
Get the comments that precede this node. |
java.util.ArrayList<JPNode> |
getDirectChildren()
Get an ArrayList of the direct children of this node. |
FieldContainer |
getFieldContainer()
Get the FieldContainer (Frame or Browse) for a statement head node or a frame field reference. |
int |
getFileIndex()
|
java.lang.String |
getFilename()
|
java.lang.String[] |
getFilenames()
Get the array of file names. |
ProToken |
getHiddenAfter()
|
ProToken |
getHiddenBefore()
|
ProToken |
getHiddenFirst()
|
java.util.List<ProToken> |
getHiddenTokens()
|
static JPNode |
getLastDescendant(JPNode top)
Find the last child of the last child of the... |
int |
getLine()
|
java.lang.Object |
getLink(java.lang.Integer key)
Get a link to an arbitrary object. |
int |
getNodeNum()
Node number, as counted in the syntax tree. |
JPNode |
getOriginal()
If this AST was constructed from another, then get the original. |
int[] |
getPos()
Return int[3] of nodes file/line/col. |
int |
getSourceNum()
Source number in the macro tree. |
int |
getState2()
Attribute "state2" is necessary for the tree parsers, so it is one attribute which must always be available. |
JPNode |
getStatement()
Return self if statehead, otherwise returns enclosing statehead. |
int |
getSubtypeIndex()
Every JPNode subtype has its own index. |
Symbol |
getSymbol()
Certain nodes will have a link to a Symbol, set by TreeParser01. |
java.lang.String |
getText()
|
int |
getType()
|
void |
initialize(AST t)
|
void |
initialize(int t,
java.lang.String txt)
|
boolean |
isNatural()
Is this a natural node (from real source text)? If not, then it is a synthetic node, added just for tree structure. |
boolean |
isStateHead()
Does this node have the Proparse STATEHEAD attribute? |
JPNode |
lastChild()
Return the last immediate child (no grandchildren). |
JPNode |
lastDescendant()
|
JPNode |
nextNode()
First child if there is one, otherwise next sibling. |
JPNode |
nextSibling()
|
JPNode |
parent()
|
JPNode |
prevNode()
Previous sibling if there is one, otherwise parent. |
java.util.ArrayList<JPNode> |
query(int findType)
Get an array of all descendant nodes (including this node) of a given type. |
void |
setCall(Call call)
Some nodes like RUN, USER_FUNC, LOCAL_METHOD_REF have a Call object linked to them by TreeParser01. |
void |
setColumn(int column)
Used when re-loading serialized nodes. |
void |
setComments(java.lang.String comments)
Set the comments preceding this node. |
void |
setFieldContainer(FieldContainer fieldContainer)
|
void |
setFileIndex(int fileIndex)
Used when re-loading serialized nodes. |
void |
setFilenameList(IntegerIndex<java.lang.String> filenameList)
A reference to the collection of filenames from the parse. |
void |
setFirstChild(JPNode child)
|
void |
setHiddenAfter(ProToken t)
|
void |
setHiddenBefore(ProToken t)
|
void |
setLine(int line)
Used when re-loading serialized nodes. |
void |
setLink(java.lang.Integer key,
java.lang.Object value)
|
void |
setNextSibling(JPNode sibling)
|
void |
setNextSiblingWithLinks(AST n)
|
void |
setNodeNum(int nodeNum)
For use by the JPNode tree construction classes only. |
void |
setParent(JPNode parent)
|
void |
setParentInChildren()
|
void |
setPrevSibling(JPNode n)
|
void |
setSourceNum(int n)
Used when re-loading serialized nodes. |
void |
setSymbol(Symbol symbol)
Assigned by the tree parser. |
void |
setText(java.lang.String text)
|
void |
setType(int type)
|
java.lang.String |
toString()
|
java.lang.String |
toStringFulltext()
Get the full, preprocessed text from a node. |
void |
walk(ICallback callback)
Walk the tree from the input node down. |
void |
writeXferBytes(DataXferStream out)
Implement Xferable. |
void |
writeXferSchema(DataXferStream out)
Implement Xferable. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
public static final int STATE2
public static final int CONTEXT_QUALIFIER
public static final int SYMBOL
public static final int TETNode
public static final int BUFFERSCOPE
public static final int BLOCK
BlockNode
,
Constant Field Valuespublic static final int SUPER_CLASS_TREE
public static final int FILE_NAME_ARRAY
public static final int AK_STORETYPE
public static final int AK_OPERATOR
public static final int AK_STATE2
public static final int AK_STATEHEAD
public static final int AK_PROPARSEDIRECTIVE
public static final int AK_KEYWORD
public static final int AK_ABBREVIATED
public static final int AK_FULLTEXT
public static final int AK_FROMUSERDICT
public static final int AK_INLINEVARDEF
public static final int AK_SOURCENUM
public static final int AK_QUALIFIEDCLASS
public static final int AV_FALSE
public static final int AV_TRUE
public static final int AV_ST_VARIABLE
public static final int AV_ST_DBTABLE
public static final int AV_ST_TTABLE
public static final int AV_ST_WTABLE
Constructor Detail |
---|
public JPNode()
public JPNode(ProToken t)
public JPNode(int type)
public JPNode(int type, JPNode original)
public JPNode(int type, java.lang.String text)
public JPNode(int file, int line, int column)
Method Detail |
---|
public java.lang.String allLeadingHiddenText()
public int attrGet(int key)
public java.lang.String attrGetS(int attrNum)
public java.lang.String attrGetS(java.lang.String attrName)
public void attrSet(int key, java.lang.String value)
public void attrSet(int key, int val)
public void attrSetS(java.lang.String key, java.lang.String value)
public static void finalizeTrailingHidden(JPNode root)
public JPNode firstChild()
public JPNode findDirectChild(int nodeType)
public JPNode firstNaturalChild()
TokenTypes.isNatural(int)
public Call getCall()
public int getColumn()
public java.lang.String getComments()
public java.util.ArrayList<JPNode> getDirectChildren()
public FieldContainer getFieldContainer()
public java.lang.String getFilename()
public java.lang.String[] getFilenames()
public int getFileIndex()
public ProToken getHiddenAfter()
public ProToken getHiddenBefore()
public ProToken getHiddenFirst()
public java.util.List<ProToken> getHiddenTokens()
public static JPNode getLastDescendant(JPNode top)
public int getLine()
public java.lang.Object getLink(java.lang.Integer key)
public int getNodeNum()
public JPNode getOriginal()
public int[] getPos()
public int getSourceNum()
ListingParser.sourceArray()
public int getState2()
IJPNode
getState2
in interface IJPNode
public JPNode getStatement()
public int getSubtypeIndex()
public Symbol getSymbol()
public java.lang.String getText()
public int getType()
public void initialize(int t, java.lang.String txt)
public void initialize(AST t)
public boolean isNatural()
TokenTypes.isNatural(int)
public boolean isStateHead()
public JPNode lastChild()
public JPNode lastDescendant()
public JPNode nextNode()
public JPNode nextSibling()
public JPNode parent()
public JPNode prevNode()
public java.util.ArrayList<JPNode> query(int findType)
public void setCall(Call call)
public void setColumn(int column)
public void setComments(java.lang.String comments)
public void setFieldContainer(FieldContainer fieldContainer)
getFieldContainer()
public void setFileIndex(int fileIndex)
public void setFilenameList(IntegerIndex<java.lang.String> filenameList)
public void setLine(int line)
public void setLink(java.lang.Integer key, java.lang.Object value)
getLink(Integer)
public void setNodeNum(int nodeNum)
public void setParent(JPNode parent)
public void setParentInChildren()
public void setSourceNum(int n)
public void setSymbol(Symbol symbol)
public void setFirstChild(JPNode child)
public void setHiddenAfter(ProToken t)
public void setHiddenBefore(ProToken t)
public void setNextSibling(JPNode sibling)
public void setPrevSibling(JPNode n)
public void setNextSiblingWithLinks(AST n)
public void setText(java.lang.String text)
public void setType(int type)
public java.lang.String toString()
public java.lang.String toStringFulltext()
public void walk(ICallback callback)
public void writeXferBytes(DataXferStream out) throws java.io.IOException
writeXferBytes
in interface Xferable
java.io.IOException
public void writeXferSchema(DataXferStream out) throws java.io.IOException
writeXferSchema
in interface Xferable
java.io.IOException
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |