-// 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
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 //////////////////////////////////////////////////////////
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 {