Compare commits
No commits in common. "d4cc24239d337de2cae7e16db26c309e18e71633" and "abc4e3ff7018335f8643cc390e704040fbc5b493" have entirely different histories.
d4cc24239d
...
abc4e3ff70
@ -3,7 +3,10 @@ package astGenerator;
|
||||
import abstractSyntaxTree.Class.FieldDecl;
|
||||
import abstractSyntaxTree.Class.MethodDecl;
|
||||
import abstractSyntaxTree.Class.RefType;
|
||||
import abstractSyntaxTree.Expression.*;
|
||||
import abstractSyntaxTree.Expression.BinaryExpression;
|
||||
import abstractSyntaxTree.Expression.IExpression;
|
||||
import abstractSyntaxTree.Expression.IntConstantExpression;
|
||||
import abstractSyntaxTree.Expression.LocalVarIdentifier;
|
||||
import abstractSyntaxTree.Node;
|
||||
import abstractSyntaxTree.Parameter.Parameter;
|
||||
import abstractSyntaxTree.Parameter.ParameterList;
|
||||
@ -173,12 +176,9 @@ public class ASTGenerator extends DecafBaseVisitor<Node> {
|
||||
|
||||
@Override
|
||||
public Node visitAssign(DecafParser.AssignContext ctx) {
|
||||
Node right = visitExpression(ctx.expression());
|
||||
Node left = visitAssignableExpr(ctx.assignableExpr());
|
||||
return new AssignStatementExpression(ctx.Assign().getText(),(IExpression) left, (IExpression) right);
|
||||
return new AssignStatementExpression("", null, null);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public Node visitMethodCall(DecafParser.MethodCallContext ctx) {
|
||||
return super.visitMethodCall(ctx);
|
||||
@ -240,14 +240,13 @@ public class ASTGenerator extends DecafBaseVisitor<Node> {
|
||||
//todo
|
||||
@Override
|
||||
public Node visitDotSubExpr(DecafParser.DotSubExprContext ctx) {
|
||||
if (ctx.IntValue() != null) {
|
||||
int value = Integer.parseInt(ctx.IntValue().getText());
|
||||
return new IntConstantExpression(value);
|
||||
} else if(ctx.Identifier() != null) {
|
||||
// if (ctx.IntValue() != null) {
|
||||
// int value = Integer.parseInt(ctx.IntValue().getText());
|
||||
// return new IntConstantExpression(value);
|
||||
// }
|
||||
if(ctx.Identifier() != null) {
|
||||
String identifier = ctx.Identifier().getText();
|
||||
return new LocalVarIdentifier(identifier);
|
||||
} else if(ctx.instVar() != null) {
|
||||
return visitInstVar(ctx.instVar());
|
||||
}
|
||||
return null;
|
||||
}
|
||||
@ -284,20 +283,4 @@ public class ASTGenerator extends DecafBaseVisitor<Node> {
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Node visitInstVar(DecafParser.InstVarContext ctx) {
|
||||
return super.visitInstVar(ctx);
|
||||
}
|
||||
|
||||
// @Override
|
||||
// public Node visitArgumentList(DecafParser.ArgumentListContext ctx) {
|
||||
// if (ctx.expression().size() == 1) {
|
||||
// return visitExpression(ctx.expression(0));
|
||||
// } else if (ctx.expression().size() >= 2) {
|
||||
// for(DecafParser.ExpressionContext expressionContext: ctx.expression()) {
|
||||
//
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user