X-Git-Url: http://git.megacz.com/?a=blobdiff_plain;f=src%2Forg%2Fxwt%2Fjs%2FLexer.java;h=dfc83e010888b16cbd2087ea242da09f219ecf4f;hb=395d61dea4f5f7b22120e8b0b3fd9b75351c0a98;hp=93586edf4b6f86a59f74a75a65d57dd095d42057;hpb=26425831523e621df99c1a75312f9eaf61ed90cc;p=org.ibex.core.git diff --git a/src/org/xwt/js/Lexer.java b/src/org/xwt/js/Lexer.java index 93586ed..dfc83e0 100644 --- a/src/org/xwt/js/Lexer.java +++ b/src/org/xwt/js/Lexer.java @@ -1,5 +1,4 @@ -// This file was derived from org.mozilla.javascript.TokenStream; it -// is covered by the NPL 1.1. +// Derived from org.mozilla.javascript.TokenStream [NPL] /** * The contents of this file are subject to the Netscape Public @@ -33,13 +32,15 @@ class Lexer { private SmartReader in; private boolean pushedBack = false; - private int op; + public int op; + public int twoBack; public Number number; public String string; public Lexer(Reader r) throws IOException { in = new SmartReader(r); } public int peekToken() throws IOException { int ret = getToken(); pushBackToken(); return ret; } - public void pushBackToken() { if (pushedBack) throw new Error("can't push back twice"); pushedBack = true; } + public void pushBackToken() { pushBackToken(op); } + public void pushBackToken(int i) { if (pushedBack) throw new Error("can't push back twice"); pushedBack = true; op = i; } // Token Constants ////////////////////////////////////////////////////////// @@ -373,7 +374,11 @@ class Lexer { public int getToken() throws IOException { if (pushedBack) { pushedBack = false; return op; } - return (op = _getToken()); + do { + if (op != EOL) twoBack = op; + op = _getToken(); + } while (op == EOL); // FIXME + return op; } public int _getToken() throws IOException {