2003/05/02 13:30:51
[org.ibex.core.git] / src / org / xwt / js / Lexer.java
index 93586ed..92cb4a6 100644 (file)
@@ -33,13 +33,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 +375,12 @@ 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
+       //if (op == SEMI) throw new Error();
+       return op;
     }
 
     public int _getToken() throws IOException {