projects
/
org.ibex.core.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
2003/06/26 01:53:37
[org.ibex.core.git]
/
src
/
org
/
xwt
/
js
/
Lexer.java
diff --git
a/src/org/xwt/js/Lexer.java
b/src/org/xwt/js/Lexer.java
index
f08ebce
..
81066bb
100644
(file)
--- a/
src/org/xwt/js/Lexer.java
+++ b/
src/org/xwt/js/Lexer.java
@@
-342,6
+342,8
@@
class Lexer implements Tokens {
public void unread() throws IOException { unread((char)lastread); }
public void unread(char c) throws IOException {
reader.unread(c);
public void unread() throws IOException { unread((char)lastread); }
public void unread(char c) throws IOException {
reader.unread(c);
+ if(c == '\n') col = -1;
+ else col--;
if (accumulator != null) accumulator.setLength(accumulator.length() - 1);
}
public boolean match(char c) throws IOException { if (peek() == c) { reader.read(); return true; } else return false; }
if (accumulator != null) accumulator.setLength(accumulator.length() - 1);
}
public boolean match(char c) throws IOException { if (peek() == c) { reader.read(); return true; } else return false; }
@@
-354,7
+356,11
@@
class Lexer implements Tokens {
lastread = reader.read();
if (accumulator != null) accumulator.append((char)lastread);
if (lastread != '\n' && lastread != '\r') col++;
lastread = reader.read();
if (accumulator != null) accumulator.append((char)lastread);
if (lastread != '\n' && lastread != '\r') col++;
- if (lastread == '\n') { parserLine = ++line; col = 0; }
+ if (lastread == '\n') {
+ // col is -1 if we just unread a newline, this is sort of ugly
+ if (col != -1) parserLine = ++line;
+ col = 0;
+ }
return lastread;
}
return lastread;
}