engine crashes on hexadecimal numbers

Issue #5 resolved
mezzodrinker created an issue
variable = 0x123;
-- engine crashes
variable = 0x192.2;
-- engine crashes

Stacktrace:

Exception in thread "main" java.lang.NumberFormatException: For input string: "0x123"
        at sun.misc.FloatingDecimal.parseHexString(Unknown Source)
        at sun.misc.FloatingDecimal.readJavaFormatString(Unknown Source)
        at java.lang.Double.parseDouble(Unknown Source)
        at mobtalkerscript.mts.v2.compiler.MtsCompiler.parseNumber(Unknown Source)
        at mobtalkerscript.mts.v2.compiler.antlr.AntlrCompilerAdapter.visitNumberLiteral(Unknown Source)
        at mobtalkerscript.mts.v2.compiler.antlr.AntlrCompilerAdapter.visitNumberLiteral(Unknown Source)
        at mobtalkerscript.mts.v2.compiler.antlr.MtsParser$NumberLiteralContext.accept(Unknown Source)
        at org.antlr.v4.runtime.tree.AbstractParseTreeVisitor.visit(AbstractParseTreeVisitor.java:44)
        at mobtalkerscript.mts.v2.compiler.antlr.AntlrCompilerAdapter.adjustExprListResults(Unknown Source)
        at mobtalkerscript.mts.v2.compiler.antlr.AntlrCompilerAdapter.visitSimpleAssignmentStmt(Unknown Source)
        at mobtalkerscript.mts.v2.compiler.antlr.AntlrCompilerAdapter.visitSimpleAssignmentStmt(Unknown Source)
        at mobtalkerscript.mts.v2.compiler.antlr.MtsParser$SimpleAssignmentStmtContext.accept(Unknown Source)
        at org.antlr.v4.runtime.tree.AbstractParseTreeVisitor.visitChildren(AbstractParseTreeVisitor.java:72)
        at mobtalkerscript.mts.v2.compiler.antlr.MtsBaseVisitor.visitAssignmentStmt(Unknown Source)
        at mobtalkerscript.mts.v2.compiler.antlr.MtsParser$AssignmentStmtContext.accept(Unknown Source)
        at org.antlr.v4.runtime.tree.AbstractParseTreeVisitor.visitChildren(AbstractParseTreeVisitor.java:72)
        at mobtalkerscript.mts.v2.compiler.antlr.MtsBaseVisitor.visitBlock(Unknown Source)
        at mobtalkerscript.mts.v2.compiler.antlr.MtsParser$BlockContext.accept(Unknown Source)
        at org.antlr.v4.runtime.tree.AbstractParseTreeVisitor.visitChildren(AbstractParseTreeVisitor.java:72)
        at mobtalkerscript.mts.v2.compiler.antlr.AntlrCompilerAdapter.visitChunk(Unknown Source)
        at mobtalkerscript.mts.v2.compiler.antlr.AntlrCompilerAdapter.visitChunk(Unknown Source)
        at mobtalkerscript.mts.v2.compiler.antlr.MtsParser$ChunkContext.accept(Unknown Source)
        at org.antlr.v4.runtime.tree.AbstractParseTreeVisitor.visit(AbstractParseTreeVisitor.java:44)
        at mobtalkerscript.mts.v2.compiler.antlr.AntlrCompilerAdapter.compile(Unknown Source)
        at mobtalkerscript.mts.v2.compiler.MtsCompiler.load(Unknown Source)
        at mobtalkerscript.mts.v2.compiler.MtsCompiler.loadString(Unknown Source)
        at mobtalkerscript.MobTalkerScript.main(Unknown Source)

Comments (3)

  1. Chimaine

    Huh. That's strange... I thought I tested Double.parseDouble that it accepts hex numbers. Will look into it.

  2. Log in to comment