|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Object
|
+--edu.mit.ai.psg.jeva.SimpleNode
|
+--edu.mit.ai.psg.jeva.JevaNode
JevaNode extends SimpleNode so each node can echo back its token stream of Java code. Adds first and last+1 token of the parsed syntax, so the syntax can be regenerated, and adds print methods to echo back the parsed java code, with or without comments. (This is an extension class so that it is easier to upgrade to new versions of JavaCC that generate new versions of SimpleNode.)
| Fields inherited from class edu.mit.ai.psg.jeva.SimpleNode |
children,
id,
parent |
| Constructor Summary | |
JevaNode(int id)
|
|
| Method Summary | |
static void |
checkInsertionPoint(Token beginHole,
IJevaNode node,
int index)
check that beginHole is a valid insertion point for inserting child tokens into node's tokens for a new child at index |
static Token |
find2ndTokenBeforeEndBody(IJevaNode bodyNode)
find token before last '}' of a body node. |
static int |
findChildIndex(IJevaNode parent,
IJevaNode child)
|
static Token |
findPrecedingToken(Token startToken,
Token findToken)
search token chain starting from startToken, returning token just before findToken |
static Token |
findTokenBeforeChild(IJevaNode parent,
IJevaNode child)
find the token just before this child's beginToken by walking up parse tree to find previous leaf. |
static Token |
findTokenBeforeChild(IJevaNode parent,
IJevaNode child,
int childIndex)
|
static Token |
findTokenBeforeEnd(IJevaNode node)
find the token just before the end token of this node. |
Token |
getBeginToken()
|
Token |
getEndToken()
|
static void |
insertChildTokens(IJevaNode parent,
IJevaNode newChild,
int index,
Token beginHole)
Insert tokens of new child into token chain after token beginHole. |
void |
insertNewChildAfter(IJevaNode newChild,
IJevaNode oldChild)
Insert new child, linking in token stream just after old child. |
void |
insertNewChildAt(IJevaNode newChild,
int index,
Token beginHole)
insert new child, linking in token stream just after beginHole. |
void |
insertNewChildBefore(IJevaNode newChild,
IJevaNode oldChild)
Insert new child, linking in token stream just before old child. |
Object |
jjtAccept(IJevaVisitor visitor,
Object data)
Accept a visitor. |
IJevaNode |
jnGetChild(int i)
jnGetChild is like Node.jjtGetChild except it returns an IJevaNode |
IJevaNode |
jnGetParent()
jnGetParent is like Node.jjtGetParent except it returns an IJevaNode |
protected static IllegalStateException |
notVerified()
called from eval methods if node hasn't been verified first |
void |
print(PrintWriter stream)
Print tokens of parsed node's syntax, including children, to stream. |
void |
print(PrintWriter stream,
boolean includeSpecialTokens)
|
static void |
printSpecialTokens(Token t,
PrintWriter stream)
|
static void |
printToken(Token t,
PrintWriter stream,
boolean includeSpecialTokens)
|
String |
printToString()
Print tokens of parsed node's syntax, including children, to string. |
String |
printToString(boolean includeSpecialTokens)
|
void |
removeChild(IJevaNode child)
remove a child node and remove its tokens from token chain. |
static void |
removeChildTokens(IJevaNode parent,
IJevaNode child,
int childIndex)
Remove tokens of child from token chain. |
void |
replaceChild(IJevaNode oldChild,
IJevaNode newChild)
remove a child node and replace it with new child; also in token chain |
void |
replaceChild(int index,
IJevaNode oldChild,
IJevaNode newChild)
|
void |
setBeginToken(Token t)
Called by the parser to set the first token of the parsed syntax |
void |
setEndToken(Token t)
Called by the parser to set the last+1 token of the parsed syntax |
protected static Error |
shouldNotHappen(String explain)
calls EvalMethods.shouldNotHappen(String); |
protected static Error |
shouldNotHappen(String explain,
Throwable e)
calls EvalMethods.shouldNotHappen(String,Throwable); |
protected static Error |
shouldNotHappen(Throwable e)
calls EvalMethods.shouldNotHappen(Throwable); |
static void |
updateEndTokens(IJevaNode node,
Token oldEndToken,
Token newEndToken)
if node's end token is oldEndToken, update it to newEndToken. |
static void |
updateEndTokensPriorChild(IJevaNode parent,
int childIndex,
Token oldEndToken,
Token newEndToken)
update the endTokens of node preceding node at childIndex of parent |
static void |
updateEndTokensPriorNode(IJevaNode parent,
int index,
Token oldEndToken,
Token newEndToken)
|
static void |
updateEndTokensPriorNode(IJevaNode node,
Token oldEndToken,
Token newEndToken)
update preceding nodes that used to have endHole as their end token set parent* node begin tokens as needed. |
| Methods inherited from class edu.mit.ai.psg.jeva.SimpleNode |
dump,
jjtAddChild,
jjtClose,
jjtGetChild,
jjtGetNumChildren,
jjtGetParent,
jjtOpen,
jjtSetParent,
toString,
toString |
| Methods inherited from class java.lang.Object |
clone,
equals,
finalize,
getClass,
hashCode,
notify,
notifyAll,
wait,
wait,
wait |
| Constructor Detail |
public JevaNode(int id)
| Method Detail |
public final Token getBeginToken()
public final Token getEndToken()
public final void setBeginToken(Token t)
public final void setEndToken(Token t)
public void print(PrintWriter stream)
public void print(PrintWriter stream,
boolean includeSpecialTokens)
public static final void printToken(Token t,
PrintWriter stream,
boolean includeSpecialTokens)
public static final void printSpecialTokens(Token t,
PrintWriter stream)
public String printToString()
public String printToString(boolean includeSpecialTokens)
public Object jjtAccept(IJevaVisitor visitor,
Object data)
public IJevaNode jnGetChild(int i)
public IJevaNode jnGetParent()
public void removeChild(IJevaNode child)
public void replaceChild(IJevaNode oldChild,
IJevaNode newChild)
public void replaceChild(int index,
IJevaNode oldChild,
IJevaNode newChild)
public void insertNewChildAfter(IJevaNode newChild,
IJevaNode oldChild)
public void insertNewChildBefore(IJevaNode newChild,
IJevaNode oldChild)
public void insertNewChildAt(IJevaNode newChild,
int index,
Token beginHole)
public static void removeChildTokens(IJevaNode parent,
IJevaNode child,
int childIndex)
public static void insertChildTokens(IJevaNode parent,
IJevaNode newChild,
int index,
Token beginHole)
public static void updateEndTokensPriorNode(IJevaNode node,
Token oldEndToken,
Token newEndToken)
public static void updateEndTokensPriorNode(IJevaNode parent,
int index,
Token oldEndToken,
Token newEndToken)
public static void updateEndTokens(IJevaNode node,
Token oldEndToken,
Token newEndToken)
public static void updateEndTokensPriorChild(IJevaNode parent,
int childIndex,
Token oldEndToken,
Token newEndToken)
public static Token findTokenBeforeChild(IJevaNode parent,
IJevaNode child)
public static Token findTokenBeforeChild(IJevaNode parent,
IJevaNode child,
int childIndex)
public static Token findTokenBeforeEnd(IJevaNode node)
public static Token findPrecedingToken(Token startToken,
Token findToken)
public static Token find2ndTokenBeforeEndBody(IJevaNode bodyNode)
public static int findChildIndex(IJevaNode parent,
IJevaNode child)
public static void checkInsertionPoint(Token beginHole,
IJevaNode node,
int index)
protected static Error shouldNotHappen(String explain,
Throwable e)
EvalMethods.shouldNotHappen(String,Throwable);protected static Error shouldNotHappen(Throwable e)
EvalMethods.shouldNotHappen(Throwable);protected static Error shouldNotHappen(String explain)
EvalMethods.shouldNotHappen(String);protected static IllegalStateException notVerified()
|
Copyright (c) 1996-1999 Massachusetts Institute of Technology Feedback: jeva-feedback@ai.mit.edu |
||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||