2003/06/16 06:24:31
[org.ibex.core.git] / src / org / xwt / js / Lexer.java
index f4c386e..eb3f69a 100644 (file)
@@ -44,8 +44,11 @@ class Lexer implements Tokens {
     /** if the token just parsed was a NAME or STRING, this is the string value */
     protected String string = null;
 
-    /** the line number of the current token */
-    protected int line = 0;
+    /** the line number of the most recently <i>lexed</i> token */
+    private int line = 0;
+
+    /** the line number of the most recently <i>parsed</i> token */
+    protected int parserLine = 0;
 
     /** the column number of the current token */
     protected int col = 0;
@@ -57,6 +60,7 @@ class Lexer implements Tokens {
     public Lexer(Reader r, String sourceName, int line) throws IOException {
        this.sourceName = sourceName;
        this.line = line;
+       this.parserLine = line;
        in = new SmartReader(r);
     }
 
@@ -352,7 +356,7 @@ class Lexer implements Tokens {
             lastread = reader.read();
             if (accumulator != null) accumulator.append((char)lastread);
            if (lastread != '\n' && lastread != '\r') col++;
-           if (lastread == '\n') { line++; col = 0; }
+           if (lastread == '\n') { parserLine = ++line; col = 0; }
             return lastread;
         }