aboutsummaryrefslogtreecommitdiffstats
path: root/src/java/org/anarres/cpp/LexerSource.java
diff options
context:
space:
mode:
Diffstat (limited to 'src/java/org/anarres/cpp/LexerSource.java')
-rw-r--r--src/java/org/anarres/cpp/LexerSource.java20
1 files changed, 14 insertions, 6 deletions
diff --git a/src/java/org/anarres/cpp/LexerSource.java b/src/java/org/anarres/cpp/LexerSource.java
index d252569..90869bc 100644
--- a/src/java/org/anarres/cpp/LexerSource.java
+++ b/src/java/org/anarres/cpp/LexerSource.java
@@ -151,20 +151,25 @@ public class LexerSource extends Source {
private int read()
throws IOException,
LexerException {
+ int c;
assert ucount <= 2 : "Illegal ucount: " + ucount;
switch (ucount) {
case 2:
ucount = 1;
- return u1;
+ c = u1;
+ break;
case 1:
ucount = 0;
- return u0;
+ c = u0;
+ break;
+ default:
+ if (reader == null)
+ c = -1;
+ else
+ c = reader.read();
+ break;
}
- if (reader == null)
- return -1;
-
- int c = reader.read();
switch (c) {
case '\r':
cr = true;
@@ -188,6 +193,9 @@ public class LexerSource extends Source {
lastcolumn = column;
column = 0;
break;
+ case -1:
+ cr = false;
+ break;
default:
cr = false;
column++;