X-Git-Url: http://secure.phpeclipse.com diff --git a/net.sourceforge.phpeclipse/src/test/SimpleCharStream.java b/net.sourceforge.phpeclipse/src/test/SimpleCharStream.java index 4a1c194..1187798 100644 --- a/net.sourceforge.phpeclipse/src/test/SimpleCharStream.java +++ b/net.sourceforge.phpeclipse/src/test/SimpleCharStream.java @@ -13,6 +13,10 @@ public class SimpleCharStream 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[]; @@ -86,12 +90,14 @@ public class SimpleCharStream { 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) @@ -110,8 +116,9 @@ public class SimpleCharStream inputStream.close(); throw new java.io.IOException(); } - else + else { maxNextCharInd += i; + } return; } catch(java.io.IOException e) { @@ -178,14 +185,17 @@ public class SimpleCharStream { --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]; @@ -278,6 +288,7 @@ public class SimpleCharStream prevCharIsLF = prevCharIsCR = false; tokenBegin = inBuf = maxNextCharInd = 0; bufpos = -1; + position = 0; } public void ReInit(java.io.Reader dstream, int startline, @@ -402,4 +413,8 @@ public class SimpleCharStream column = bufcolumn[j]; } + //hack + public static int getPosition() { + return position + bufpos; + } }