Merge branch 'master' into new-conflicting-alts

This commit is contained in:
Terence Parr 2012-10-14 18:47:32 -07:00
commit a0ffc84952
2 changed files with 5 additions and 5 deletions

View File

@ -79,9 +79,9 @@ public interface IntStream {
* filtering streams (e.g. {@link CommonTokenStream} which distinguishes * filtering streams (e.g. {@link CommonTokenStream} which distinguishes
* between "on-channel" and "off-channel" tokens). * between "on-channel" and "off-channel" tokens).
* *
* @throws IllegalStateException if an attempt is made to consume past * @throws IllegalStateException if an attempt is made to consume the the
* end of the stream (i.e. if last char == {@link #EOF EOF} before calling * end of the stream (i.e. if {@code LA(1)==}{@link #EOF EOF} before calling
* {@code consume}). Sometimes need to match EOF during prediction. * {@code consume}).
*/ */
void consume(); void consume();

View File

@ -75,7 +75,7 @@ public class UnbufferedCharStream implements CharStream {
/** /**
* This is the {@code LA(-1)} character for the current position. * This is the {@code LA(-1)} character for the current position.
*/ */
protected int lastChar = -2; // can't be -1 (EOF) protected int lastChar = -1;
/** /**
* When {@code numMarkers > 0}, this is the {@code LA(-1)} character for the * When {@code numMarkers > 0}, this is the {@code LA(-1)} character for the
@ -129,7 +129,7 @@ public class UnbufferedCharStream implements CharStream {
@Override @Override
public void consume() { public void consume() {
if ( lastChar == CharStream.EOF ) { if (LA(1) == CharStream.EOF) {
throw new IllegalStateException("cannot consume EOF"); throw new IllegalStateException("cannot consume EOF");
} }