diff --git a/.gitignore b/.gitignore index 68dfbc03f..ddab61f99 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,5 @@ .idea/ target/ *.iml +src/main/resources/META-INF/ dependency-reduced-pom.xml diff --git a/out/artifacts/Litterbox_jar/Litterbox.jar b/out/artifacts/Litterbox_jar/Litterbox.jar new file mode 100644 index 000000000..27067b47d Binary files /dev/null and b/out/artifacts/Litterbox_jar/Litterbox.jar differ diff --git a/src/main/java/de/uni_passau/fim/se2/litterbox/ast/visitor/LeilaVisitor.java b/src/main/java/de/uni_passau/fim/se2/litterbox/ast/visitor/LeilaVisitor.java index ca372297c..a2834081c 100644 --- a/src/main/java/de/uni_passau/fim/se2/litterbox/ast/visitor/LeilaVisitor.java +++ b/src/main/java/de/uni_passau/fim/se2/litterbox/ast/visitor/LeilaVisitor.java @@ -89,6 +89,7 @@ import java.io.PrintStream; import java.util.*; import java.util.regex.Pattern; +import java.util.logging.Logger; import static de.uni_passau.fim.se2.litterbox.ast.visitor.LeilaVisitor.TYPE.*; @@ -105,6 +106,8 @@ public class LeilaVisitor extends PrintVisitor { private Program program = null; private Stack expectedTypes = new Stack<>(); + private static final Logger log = Logger.getLogger(PrintVisitor.class.getName()); + enum TYPE { INTEGER, FLOAT, ORIGINAL } @@ -1638,19 +1641,13 @@ public void visit(NumberLiteral number) { double value = number.getValue(); switch (expectedType) { case ORIGINAL: - if (isInteger(value)) { - emitAsLong(value); - } else { - emitAsDouble(value); - } - break; case INTEGER: - if (isInteger(value)) { - emitAsLong(value); - } else { - throw new RuntimeException("Expected type integer but got " + value); + if (!isInteger(value)) { + log.warning("Value " + value + " cast as integer"); } + emitAsLong(value); break; + //throw new RuntimeException("Expected type integer but got " + value); case FLOAT: emitAsDouble(value); break;