Fixed issue: #74
This commit is contained in:
Binary file not shown.
@@ -1393,7 +1393,7 @@ public class LexState extends Constants {
|
||||
return;
|
||||
}
|
||||
default: {
|
||||
this.syntaxerror("unexpected symbol " + t.token + " (" + ((char) t.token) + ")");
|
||||
this.syntaxerror("unexpected symbol near " + txtToken(t.token));
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -189,6 +189,26 @@ public class FragmentsTest extends TestSuite {
|
||||
assertEquals("interrupted", thrown.get().getMessage());
|
||||
}
|
||||
|
||||
public void testBareExpressionReportsReadableToken() {
|
||||
Globals globals = JsePlatform.debugGlobals();
|
||||
try {
|
||||
globals.load("1 + 1", "expr.lua");
|
||||
fail("expected syntax error");
|
||||
} catch (LuaError e) {
|
||||
assertTrue(e.getMessage().contains("unexpected symbol near 1"));
|
||||
}
|
||||
}
|
||||
|
||||
public void testUnfinishedTableReportsEof() {
|
||||
Globals globals = JsePlatform.debugGlobals();
|
||||
try {
|
||||
globals.load("mytab = {", "table.lua");
|
||||
fail("expected syntax error");
|
||||
} catch (LuaError e) {
|
||||
assertTrue(e.getMessage().contains("near <eof>"));
|
||||
}
|
||||
}
|
||||
|
||||
public void testLongIntegerLiteralPrecision() {
|
||||
runFragment(
|
||||
LuaValue.varargsOf(new LuaValue[] {
|
||||
|
||||
Reference in New Issue
Block a user