Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
.idea/
target/
*.iml
src/main/resources/META-INF/
dependency-reduced-pom.xml
Binary file added out/artifacts/Litterbox_jar/Litterbox.jar
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -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.*;

Expand All @@ -105,6 +106,8 @@ public class LeilaVisitor extends PrintVisitor {
private Program program = null;
private Stack<TYPE> expectedTypes = new Stack<>();

private static final Logger log = Logger.getLogger(PrintVisitor.class.getName());

enum TYPE {
INTEGER, FLOAT, ORIGINAL
}
Expand Down Expand Up @@ -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;
Expand Down