Additive Expression implementieren

This commit is contained in:
JanUlrich 2018-02-21 11:40:54 +01:00
parent ed3a3909c0
commit c747ab0885

View File

@ -599,8 +599,8 @@ public class StatementGenerator {
}
private BinaryExpr.Operator convertBinaryOperator(String operator) {
return null;
//return BinaryExpr.Operator.ADD;
throw new NotImplementedException();
}
private Expression convert(Java8Parser.ShiftExpressionContext expression) {
@ -612,12 +612,15 @@ public class StatementGenerator {
}
private Expression convert(Java8Parser.AdditiveExpressionContext expression) {
if(expression.additiveExpression() != null){
return convert(expression.additiveExpression());
}else if(expression.multiplicativeExpression() != null){
if(expression.additiveExpression() == null){
return convert(expression.multiplicativeExpression());
}else{
throw new NotImplementedException();
}else {
Expression leftSide = convert(expression.additiveExpression());
Expression rightSide = convert(expression.multiplicativeExpression());
BinaryExpr.Operator op = convertBinaryOperator(expression.getChild(1).getText());
Token offset = expression.getStart();
return new BinaryExpr(op, TypePlaceholder.fresh(expression.getStart()), leftSide, rightSide, offset);
}
}