Add additional newline character at the end of every EcmaScript reader.
Otherwise, a // comment in the last line throws a parsing error (bug 169)
This commit is contained in:
parent
b93edfdc4d
commit
0aa65b8683
1 changed files with 11 additions and 3 deletions
|
@ -13,6 +13,7 @@ public final class ASCII_CharStream
|
|||
int available;
|
||||
int tokenBegin;
|
||||
public int bufpos = -1;
|
||||
boolean addedNewline = false;
|
||||
private int bufline[];
|
||||
private int bufcolumn[];
|
||||
|
||||
|
@ -107,9 +108,15 @@ public final class ASCII_CharStream
|
|||
if ((i = inputStream.read(buffer, maxNextCharInd,
|
||||
available - maxNextCharInd)) == -1)
|
||||
{
|
||||
if (!addedNewline) {
|
||||
addedNewline = true;
|
||||
buffer[maxNextCharInd] = '\n';
|
||||
i = 1;
|
||||
} else {
|
||||
inputStream.close();
|
||||
throw new java.io.IOException();
|
||||
}
|
||||
}
|
||||
else
|
||||
maxNextCharInd += i;
|
||||
return;
|
||||
|
@ -265,6 +272,7 @@ public final class ASCII_CharStream
|
|||
prevCharIsLF = prevCharIsCR = false;
|
||||
tokenBegin = inBuf = maxNextCharInd = 0;
|
||||
bufpos = -1;
|
||||
addedNewline = false;
|
||||
}
|
||||
|
||||
public void ReInit(java.io.Reader dstream, int startline,
|
||||
|
|
Loading…
Add table
Reference in a new issue