static int available;
static int tokenBegin;
static public int bufpos = -1;
+
+ //Added by Matthieu Casanova
+ public static int position = 0;
+
static protected int bufline[];
static protected int bufcolumn[];
static protected boolean prevCharIsLF = false;
static protected java.io.Reader inputStream;
+ static protected StringBuffer currentBuffer = new StringBuffer();
static protected char[] buffer;
static protected int maxNextCharInd = 0;
{
if (tokenBegin > 2048)
{
+ position += bufpos;
bufpos = maxNextCharInd = 0;
available = tokenBegin;
}
- else if (tokenBegin < 0)
+ else if (tokenBegin < 0) {
+ position += bufpos;
bufpos = maxNextCharInd = 0;
- else
+ } else
ExpandBuff(false);
}
else if (available > tokenBegin)
inputStream.close();
throw new java.io.IOException();
}
- else
+ else {
maxNextCharInd += i;
+ }
+ currentBuffer.append(buffer);
return;
}
catch(java.io.IOException e) {
{
--inBuf;
- if (++bufpos == bufsize)
+ if (++bufpos == bufsize) {
+ position += bufpos;
bufpos = 0;
+ }
return buffer[bufpos];
}
- if (++bufpos >= maxNextCharInd)
- FillBuff();
+ if (++bufpos >= maxNextCharInd) {
+ FillBuff();
+ }
char c = buffer[bufpos];
" either use ReInit() or set the JavaCC option STATIC to false\n" +
" during the generation of this class.");
inputStream = dstream;
+ currentBuffer = new StringBuffer();
line = startline;
column = startcolumn - 1;
int startcolumn, int buffersize)
{
inputStream = dstream;
+ currentBuffer = new StringBuffer();
line = startline;
column = startcolumn - 1;
prevCharIsLF = prevCharIsCR = false;
tokenBegin = inBuf = maxNextCharInd = 0;
bufpos = -1;
+ position = 0;
}
public void ReInit(java.io.Reader dstream, int startline,
column = bufcolumn[j];
}
+ //hack
+ public static int getPosition() {
+ return position + bufpos;
+ }
}