mirror of
https://github.com/JonathanFleischmann/CompilerULTIMATE.git
synced 2024-12-28 01:38:03 +00:00
Add Exception Messages
This commit is contained in:
parent
7d1b7bc5b0
commit
d35aadf36c
@ -81,7 +81,7 @@ public class ASTGenerator {
|
||||
type.setObjectType(new Id(ctx.id().getText()));
|
||||
return type;
|
||||
}
|
||||
throw new RuntimeException();
|
||||
throw new RuntimeException("No type found!");
|
||||
}
|
||||
|
||||
public static ReturnType getReturnType(DecafParser.ReturntypeContext ctx) {
|
||||
@ -99,6 +99,6 @@ public class ASTGenerator {
|
||||
type.setObjectType(new Id(ctx.type().id().getText()));
|
||||
return type;
|
||||
}
|
||||
throw new RuntimeException();
|
||||
throw new RuntimeException("No return type found!");
|
||||
}
|
||||
}
|
||||
|
@ -26,7 +26,7 @@ public class ExpressionGenerator extends DecafBaseVisitor<Expression> {
|
||||
if (ctx.unaryOp().SUB() != null) {
|
||||
return new Unary(UnaryOperator.SUB, expr);
|
||||
}
|
||||
throw new RuntimeException();
|
||||
throw new RuntimeException("No unary operator found.");
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -59,7 +59,7 @@ public class ExpressionGenerator extends DecafBaseVisitor<Expression> {
|
||||
return new BoolLiteral(Boolean.valueOf(ctx.BOOLEANLITERAL().getText()));
|
||||
if (ctx.CHARLITERAL() != null)
|
||||
return new CharLiteral(ctx.CHARLITERAL().getText().charAt(0));
|
||||
throw new RuntimeException();
|
||||
throw new RuntimeException("No literal found!");
|
||||
}
|
||||
|
||||
public static Binary generateBinary(DecafParser.BinaryOperationContext ctx) {
|
||||
@ -81,7 +81,7 @@ public class ExpressionGenerator extends DecafBaseVisitor<Expression> {
|
||||
if (ctx.NE() != null) return Operator.NE;
|
||||
if (ctx.AND() != null) return Operator.AND;
|
||||
if (ctx.OR() != null) return Operator.OR;
|
||||
throw new RuntimeException();
|
||||
throw new RuntimeException("No operator found!");
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -110,6 +110,6 @@ public class StatementGenerator extends DecafBaseVisitor<Statement> {
|
||||
return new Binary(id, Operator.SUB, expression);
|
||||
if (ctx.MUL_ASSIGN() != null)
|
||||
return new Binary(id, Operator.MUL, expression);
|
||||
throw new RuntimeException();
|
||||
throw new RuntimeException("No assign sign found!");
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user