From: brian Date: Fri, 30 Jan 2004 07:44:04 +0000 (+0000) Subject: 2004/01/03 04:27:27 X-Git-Tag: RC3~195 X-Git-Url: http://git.megacz.com/?p=org.ibex.core.git;a=commitdiff_plain;h=6261c41b2ac9d182d8c3541e8e0e5fd00062fa43;ds=sidebyside 2004/01/03 04:27:27 darcs-hash:20040130074404-aa32f-96a933a67ea5a594a6d50b1ce47bb63220182367.gz --- diff --git a/src/org/xwt/js/Parser.java b/src/org/xwt/js/Parser.java index b2e2fb1..b67b59c 100644 --- a/src/org/xwt/js/Parser.java +++ b/src/org/xwt/js/Parser.java @@ -133,7 +133,16 @@ class Parser extends Lexer implements ByteCodes { /** gets a token and throws an exception if it is not code */ private void consume(int code) throws IOException { - if (getToken() != code) throw pe("expected " + codeToString[code] + ", got " + (op == -1 ? "EOF" : codeToString[op])); + if (getToken() != code) { + if(code == NAME) switch(op) { + case RETURN: case TYPEOF: case BREAK: case CONTINUE: case TRY: case THROW: + case ASSERT: case NULL: case TRUE: case FALSE: case IN: case IF: case ELSE: + case SWITCH: case CASE: case DEFAULT: case WHILE: case VAR: case WITH: + case CATCH: case FINALLY: + throw pe("Bad variable name; '" + codeToString[op].toLowerCase() + "' is a javascript keyword"); + } + throw pe("expected " + codeToString[code] + ", got " + (op == -1 ? "EOF" : codeToString[op])); + } } /**