|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.prorefactor.refactor.source.Token
public class Token
A token is a handle to a bunch of source file IAtom objects, which contain the actual text/line/column. A macro or .i reference is also a token. Tokens may be nested, in the case where there are macro or .i references embedded in a token. We don't have to look to the embedded tokens to find all of the text though - the outer token points to all of the atoms. There is one special token type: AMPIF_CONDITIONAL. In that case, it only points to an "&ENDIF" atom, and there are two or more "expansions" which must be traversed to find the "&IF" and all code between. This special exception allows us to plug a tree structure for &IF branches into an otherwise flat token list.
Field Summary | |
---|---|
static int |
AMPIF_CONDITIONAL
There is one special token type: AMPIF_CONDITIONAL. |
Constructor Summary | |
---|---|
Token(TETNode parent)
|
|
Token(Token orig)
Copy constructor. |
Method Summary | |
---|---|
void |
addExpansion(java.lang.Object obj)
|
void |
addNestedToken(Token nestedToken)
|
java.util.List |
getExpansions()
The expansions list is a list of Expansion objects, in the case of a curly expansion. |
java.util.List |
getNestedTokens()
Our model keeps embedded curlies as embedded (nested) Token objects. |
java.io.File |
nearestEnclosingFile()
Find the nearest enclosing File, ignoring that the *actual* text for the Token may have come from a Declaration some number of layers higher. |
int |
numExpansions()
|
int |
numNestedTokens()
|
java.lang.String |
toString()
|
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
public static final int AMPIF_CONDITIONAL
Constructor Detail |
---|
public Token(TETNode parent)
getParent()
public Token(Token orig)
Method Detail |
---|
public void addExpansion(java.lang.Object obj)
getExpansions()
public void addNestedToken(Token nestedToken)
getNestedTokens()
public java.util.List getExpansions()
public java.util.List getNestedTokens()
public java.io.File nearestEnclosingFile()
TETNode
nearestEnclosingFile
in interface TETNode
TETNode.nearestEnclosingFile()
public int numExpansions()
public int numNestedTokens()
public java.lang.String toString()
toString
in class java.lang.Object
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |