From 8318defd3051f3c14482508900bcaafd18aaa348 Mon Sep 17 00:00:00 2001 From: laurenz Date: Wed, 15 May 2024 16:58:58 +0200 Subject: [PATCH] minor change in ExpressionGenerator --- src/main/java/de/maishai/ExpressionGenerator.java | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/main/java/de/maishai/ExpressionGenerator.java b/src/main/java/de/maishai/ExpressionGenerator.java index 4f4dcfc..756c142 100644 --- a/src/main/java/de/maishai/ExpressionGenerator.java +++ b/src/main/java/de/maishai/ExpressionGenerator.java @@ -53,10 +53,12 @@ public class ExpressionGenerator extends DecafBaseVisitor { } public static Expression generateConstant(DecafParser.LiteralContext ctx) { - if (ctx.NUMBER() != null) + if (ctx.NUMBER() != null) { return new IntLiteral(Integer.valueOf(ctx.NUMBER().getText())); - if (ctx.BOOLEANLITERAL() != null) + } + if (ctx.BOOLEANLITERAL() != null) { return new BoolLiteral(Boolean.valueOf(ctx.BOOLEANLITERAL().getText())); + } if (ctx.CHARLITERAL() != null) { if (ctx.CHARLITERAL().getText().length() != 3) { throw new RuntimeException("Wrong format for Char literal. Good format: 'c' Bad format: " + ctx.CHARLITERAL().getText());