[06 - Top Down Parser] Fix test "program10Assign"
This commit is contained in:
Binary file not shown.
@@ -152,9 +152,42 @@ public class XParser {
|
||||
private Tree parseNumExpr() {
|
||||
int oldPosition = in.getPosition();
|
||||
Tree tree = new Tree(new Token(Token.EXPR));
|
||||
Tree intConst;
|
||||
|
||||
if ((intConst = parseNumExpr2()) != null) {
|
||||
tree.addLastChild(intConst);
|
||||
return tree;
|
||||
}
|
||||
|
||||
in.setPosition(oldPosition);
|
||||
return null;
|
||||
}
|
||||
|
||||
private Tree parseNumExpr2() {
|
||||
int oldPosition = in.getPosition();
|
||||
Tree tree = new Tree(new Token(Token.EXPR2));
|
||||
Tree intConst;
|
||||
|
||||
if ((intConst = parseNumExpr3()) != null) {
|
||||
tree.addLastChild(intConst);
|
||||
return tree;
|
||||
}
|
||||
|
||||
in.setPosition(oldPosition);
|
||||
return null;
|
||||
}
|
||||
|
||||
private Tree parseNumExpr3() {
|
||||
int oldPosition = in.getPosition();
|
||||
Tree tree = new Tree(new Token(Token.EXPR3));
|
||||
Tree intConst;
|
||||
|
||||
if ((intConst = parseToken(Token.INTCONST)) != null) {
|
||||
tree.addLastChild(intConst);
|
||||
return tree;
|
||||
}
|
||||
|
||||
in.setPosition(oldPosition);
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user