diff -c -r -N orig/ASCII_UCodeESC_CharStream.java new/ASCII_UCodeESC_CharStream.java *** orig/ASCII_UCodeESC_CharStream.java Wed Feb 10 21:17:27 1999 --- new/ASCII_UCodeESC_CharStream.java Wed Feb 10 21:17:24 1999 *************** *** 251,257 **** if (++bufpos == available) AdjustBuffSize(); ! if (((buffer[bufpos] = c = (char)((char)0xff & ReadByte())) == '\\')) { UpdateLineColumn(c); --- 251,257 ---- if (++bufpos == available) AdjustBuffSize(); ! if ((buffer[bufpos] = c = ReadByte()) == '\\') { UpdateLineColumn(c); *************** *** 264,270 **** try { ! if ((buffer[bufpos] = c = (char)((char)0xff & ReadByte())) != '\\') { UpdateLineColumn(c); // found a non-backslash char. --- 264,270 ---- try { ! if ((buffer[bufpos] = c = ReadByte()) != '\\') { UpdateLineColumn(c); // found a non-backslash char. *************** *** 295,307 **** // Here, we have seen an odd number of backslash's followed by a 'u' try { ! while ((c = (char)((char)0xff & ReadByte())) == 'u') ++column; buffer[bufpos] = c = (char)(hexval(c) << 12 | ! hexval((char)((char)0xff & ReadByte())) << 8 | ! hexval((char)((char)0xff & ReadByte())) << 4 | ! hexval((char)((char)0xff & ReadByte()))); column += 4; } --- 295,307 ---- // Here, we have seen an odd number of backslash's followed by a 'u' try { ! while ((c = ReadByte()) == 'u') ++column; buffer[bufpos] = c = (char)(hexval(c) << 12 | ! hexval(ReadByte()) << 8 | ! hexval(ReadByte()) << 4 | ! hexval(ReadByte())); column += 4; } diff -c -r -N orig/UCode_CharStream.java new/UCode_CharStream.java *** orig/UCode_CharStream.java Wed Feb 10 21:17:27 1999 --- new/UCode_CharStream.java Fri Feb 12 12:11:29 1999 *************** *** 114,136 **** if (++nextCharInd >= maxNextCharInd) FillBuff(); ! char c = (char)(((char)nextCharBuf[nextCharInd]) << 8); ! ! if (++nextCharInd >= maxNextCharInd) ! FillBuff(); ! ! return (char)(c | ((char)0xff & nextCharBuf[nextCharInd])); } ! public char BeginToken() throws java.io.IOException { ! tokenBegin = -1; ! char c = readChar(); ! tokenBegin = bufpos; ! return c; } private final void UpdateLineColumn(char c) { column++; --- 114,157 ---- if (++nextCharInd >= maxNextCharInd) FillBuff(); ! return nextCharBuf[nextCharInd]; } ! public final char BeginToken() throws java.io.IOException { ! if (inBuf > 0) ! { ! --inBuf; ! return buffer[tokenBegin = (bufpos == bufsize - 1) ? (bufpos = 0) ! : ++bufpos]; ! } ! ! tokenBegin = 0; ! bufpos = -1; ! return readChar(); } + private final void AdjustBuffSize() + { + if (available == bufsize) + { + if (tokenBegin > 2048) + { + bufpos = 0; + available = tokenBegin; + } + else + ExpandBuff(false); + } + else if (available > tokenBegin) + available = bufsize; + else if ((tokenBegin - available) < 2048) + ExpandBuff(true); + else + available = tokenBegin; + } + private final void UpdateLineColumn(char c) { column++; *************** *** 166,171 **** --- 187,195 ---- default : break; } + + bufline[bufpos] = line; + bufcolumn[bufpos] = column; } private int inBuf = 0; *************** *** 174,208 **** if (inBuf > 0) { --inBuf; ! return (char)buffer[(bufpos == bufsize - 1) ? (bufpos = 0) : ++bufpos]; } ! char c = ReadChar(); ! UpdateLineColumn(c); if (++bufpos == available) ! { ! if (available == bufsize) ! { ! if (tokenBegin > 2048) ! { ! bufpos = 0; ! available = tokenBegin; ! } ! else if (tokenBegin < 0) ! bufpos = 0; ! else ! ExpandBuff(false); ! } ! else if (available > tokenBegin) ! available = bufsize; ! else if ((tokenBegin - available) < 2048) ! ExpandBuff(true); ! else ! available = tokenBegin; ! } ! return (buffer[bufpos] = c); } /** --- 198,214 ---- if (inBuf > 0) { --inBuf; ! return buffer[(bufpos == bufsize - 1) ? (bufpos = 0) : ++bufpos]; } ! char c; if (++bufpos == available) ! AdjustBuffSize(); ! buffer[bufpos] = c = ReadChar(); ! UpdateLineColumn(c); ! return (c); } /** *************** *** 255,261 **** available = bufsize = buffersize; buffer = new char[buffersize]; ! nextCharBuf = new char[buffersize]; bufline = new int[buffersize]; bufcolumn = new int[buffersize]; } --- 261,267 ---- available = bufsize = buffersize; buffer = new char[buffersize]; ! nextCharBuf = new char[4096]; bufline = new int[buffersize]; bufcolumn = new int[buffersize]; } *************** *** 277,286 **** { available = bufsize = buffersize; buffer = new char[buffersize]; ! nextCharBuf = new char[buffersize]; bufline = new int[buffersize]; bufcolumn = new int[buffersize]; } } public void ReInit(java.io.Reader dstream, --- 283,295 ---- { available = bufsize = buffersize; buffer = new char[buffersize]; ! nextCharBuf = new char[4096]; bufline = new int[buffersize]; bufcolumn = new int[buffersize]; } + prevCharIsLF = prevCharIsCR = false; + tokenBegin = inBuf = maxNextCharInd = 0; + nextCharInd = bufpos = -1; } public void ReInit(java.io.Reader dstream, diff -c -r -N orig/UCode_UCodeESC_CharStream.java new/UCode_UCodeESC_CharStream.java *** orig/UCode_UCodeESC_CharStream.java Wed Feb 10 21:17:27 1999 --- new/UCode_UCodeESC_CharStream.java Fri Feb 12 12:14:50 1999 *************** *** 158,169 **** if (++nextCharInd >= maxNextCharInd) FillBuff(); ! char c = (char)(((char)nextCharBuf[nextCharInd]) << 8); ! ! if (++nextCharInd >= maxNextCharInd) ! FillBuff(); ! ! return (char)(c | ((char)0xff & nextCharBuf[nextCharInd])); } public final char BeginToken() throws java.io.IOException --- 158,164 ---- if (++nextCharInd >= maxNextCharInd) FillBuff(); ! return nextCharBuf[nextCharInd]; } public final char BeginToken() throws java.io.IOException *************** *** 406,411 **** --- 401,409 ---- bufcolumn = new int[buffersize]; nextCharBuf = new char[4096]; } + prevCharIsLF = prevCharIsCR = false; + tokenBegin = inBuf = maxNextCharInd = 0; + nextCharInd = bufpos = -1; } public void ReInit(java.io.Reader dstream,