[prev in list] [next in list] [prev in thread] [next in thread]
List: jedit-cvs
Subject: [ jEdit-commits ] SF.net SVN: jedit:[23429] plugins/XML/trunk
From: kerik-sf () users ! sourceforge ! net
Date: 2014-03-06 21:06:55
Message-ID: E1WLfVL-0007nr-4o () sfs-ml-1 ! v29 ! ch3 ! sourceforge ! com
[Download RAW message or body]
Revision: 23429
http://sourceforge.net/p/jedit/svn/23429
Author: kerik-sf
Date: 2014-03-06 21:06:53 +0000 (Thu, 06 Mar 2014)
Log Message:
-----------
fix pb #1775 XML javacc parser prints out lots of crap to stdout
Modified Paths:
--------------
plugins/XML/trunk/docs/CHANGES.txt
plugins/XML/trunk/xml/parser/javacc/ParseException.java
plugins/XML/trunk/xml/parser/javacc/SimpleCharStream.java
plugins/XML/trunk/xml/parser/javacc/Token.java
plugins/XML/trunk/xml/parser/javacc/TokenMgrError.java
plugins/XML/trunk/xml/parser/javacc/XmlParser.java
plugins/XML/trunk/xml/parser/javacc/XmlParser.jj
plugins/XML/trunk/xml/parser/javacc/XmlParserConstants.java
plugins/XML/trunk/xml/parser/javacc/XmlParserTokenManager.java
Modified: plugins/XML/trunk/docs/CHANGES.txt
===================================================================
--- plugins/XML/trunk/docs/CHANGES.txt 2014-03-06 13:23:38 UTC (rev 23428)
+++ plugins/XML/trunk/docs/CHANGES.txt 2014-03-06 21:06:53 UTC (rev 23429)
@@ -5,6 +5,8 @@
Fix #3614106: XML plugin: Missing Hyperlinks to xref linkend= elements (Alan \
Ezust, Eric Le Lay)
Fix pb #1763: XML Plugin unexpected asset type (Matthieu Casanova, Eric Le \
Lay) + Fix pb #1775 XML javacc parser prints out lots of crap to stdout (Alan
+ Ezeust, Eric Le Lay)
Version 2.8.5
Fix #3533666: Attribute completion after self-closed tag (Alan Ezust,
Modified: plugins/XML/trunk/xml/parser/javacc/ParseException.java
===================================================================
--- plugins/XML/trunk/xml/parser/javacc/ParseException.java 2014-03-06 13:23:38 UTC \
(rev 23428)
+++ plugins/XML/trunk/xml/parser/javacc/ParseException.java 2014-03-06 21:06:53 UTC \
(rev 23429) @@ -1,4 +1,5 @@
-/* Generated By:JavaCC: Do not edit this line. ParseException.java Version 3.0 */
+/* Generated By:JavaCC: Do not edit this line. ParseException.java Version 5.0 */
+/* JavaCCOptions:KEEP_LINE_COL=null */
package xml.parser.javacc;
/**
@@ -13,24 +14,24 @@
public class ParseException extends Exception {
/**
+ * The version identifier for this Serializable class.
+ * Increment only if the <i>serialized</i> form of the
+ * class changes.
+ */
+ private static final long serialVersionUID = 1L;
+
+ /**
* This constructor is used by the method "generateParseException"
* in the generated parser. Calling this constructor generates
* a new object of this type with the fields "currentToken",
- * "expectedTokenSequences", and "tokenImage" set. The boolean
- * flag "specialConstructor" is also set to true to indicate that
- * this constructor was used to create this object.
- * This constructor calls its super class with the empty string
- * to force the "toString" method of parent class "Throwable" to
- * print the error message in the form:
- * ParseException: <result of getMessage>
+ * "expectedTokenSequences", and "tokenImage" set.
*/
public ParseException(Token currentTokenVal,
int[][] expectedTokenSequencesVal,
String[] tokenImageVal
)
{
- super("");
- specialConstructor = true;
+ super(initialise(currentTokenVal, expectedTokenSequencesVal, tokenImageVal));
currentToken = currentTokenVal;
expectedTokenSequences = expectedTokenSequencesVal;
tokenImage = tokenImageVal;
@@ -48,20 +49,13 @@
public ParseException() {
super();
- specialConstructor = false;
}
+ /** Constructor with message. */
public ParseException(String message) {
super(message);
- specialConstructor = false;
}
- /**
- * This variable determines which constructor was used to create
- * this object and thereby affects the semantics of the
- * "getMessage" method (see below).
- */
- protected boolean specialConstructor;
/**
* This is the last token that has been consumed successfully. If
@@ -85,19 +79,16 @@
public String[] tokenImage;
/**
- * This method has the standard behavior when this object has been
- * created using the standard constructors. Otherwise, it uses
- * "currentToken" and "expectedTokenSequences" to generate a parse
+ * It uses "currentToken" and "expectedTokenSequences" to generate a parse
* error message and returns it. If this object has been created
* due to a parse error, and you do not catch it (it gets thrown
- * from the parser), then this method is called during the printing
- * of the final stack trace, and hence the correct error message
+ * from the parser) the correct error message
* gets displayed.
*/
- public String getMessage() {
- if (!specialConstructor) {
- return super.getMessage();
- }
+ private static String initialise(Token currentToken,
+ int[][] expectedTokenSequences,
+ String[] tokenImage) {
+ String eol = System.getProperty("line.separator", "\n");
StringBuffer expected = new StringBuffer();
int maxSize = 0;
for (int i = 0; i < expectedTokenSequences.length; i++) {
@@ -105,7 +96,7 @@
maxSize = expectedTokenSequences[i].length;
}
for (int j = 0; j < expectedTokenSequences[i].length; j++) {
- expected.append(tokenImage[expectedTokenSequences[i][j]]).append(" ");
+ expected.append(tokenImage[expectedTokenSequences[i][j]]).append(' ');
}
if (expectedTokenSequences[i][expectedTokenSequences[i].length - 1] != 0) {
expected.append("...");
@@ -120,8 +111,11 @@
retval += tokenImage[0];
break;
}
+ retval += " " + tokenImage[tok.kind];
+ retval += " \"";
retval += add_escapes(tok.image);
- tok = tok.next;
+ retval += " \"";
+ tok = tok.next;
}
retval += "\" at line " + currentToken.next.beginLine + ", column " + \
currentToken.next.beginColumn; retval += "." + eol;
@@ -138,13 +132,13 @@
* The end of line string for this machine.
*/
protected String eol = System.getProperty("line.separator", "\n");
-
+
/**
* Used to convert raw characters to their escaped version
* when these raw version cannot be used as part of an ASCII
* string literal.
*/
- protected String add_escapes(String str) {
+ static String add_escapes(String str) {
StringBuffer retval = new StringBuffer();
char ch;
for (int i = 0; i < str.length(); i++) {
@@ -190,3 +184,4 @@
}
}
+/* JavaCC - OriginalChecksum=97f45059ca375a155cb6fd7640f415f0 (do not edit this \
line) */
Modified: plugins/XML/trunk/xml/parser/javacc/SimpleCharStream.java
===================================================================
--- plugins/XML/trunk/xml/parser/javacc/SimpleCharStream.java 2014-03-06 13:23:38 UTC \
(rev 23428)
+++ plugins/XML/trunk/xml/parser/javacc/SimpleCharStream.java 2014-03-06 21:06:53 UTC \
(rev 23429) @@ -1,4 +1,5 @@
-/* Generated By:JavaCC: Do not edit this line. SimpleCharStream.java Version 4.0 */
+/* Generated By:JavaCC: Do not edit this line. SimpleCharStream.java Version 5.0 */
+/* JavaCCOptions:STATIC=false,SUPPORT_CLASS_VISIBILITY_PUBLIC=true */
package xml.parser.javacc;
/**
@@ -8,10 +9,12 @@
public class SimpleCharStream
{
+/** Whether parser is static. */
public static final boolean staticFlag = false;
int bufsize;
int available;
int tokenBegin;
+/** Position in buffer. */
public int bufpos = -1;
protected int bufline[];
protected int bufcolumn[];
@@ -35,210 +38,218 @@
protected void ExpandBuff(boolean wrapAround)
{
- char[] newbuffer = new char[bufsize + 2048];
- int newbufline[] = new int[bufsize + 2048];
- int newbufcolumn[] = new int[bufsize + 2048];
+ char[] newbuffer = new char[bufsize + 2048];
+ int newbufline[] = new int[bufsize + 2048];
+ int newbufcolumn[] = new int[bufsize + 2048];
- try
- {
- if (wrapAround)
- {
- System.arraycopy(buffer, tokenBegin, newbuffer, 0, bufsize - tokenBegin);
- System.arraycopy(buffer, 0, newbuffer,
- bufsize - tokenBegin, bufpos);
- buffer = newbuffer;
+ try
+ {
+ if (wrapAround)
+ {
+ System.arraycopy(buffer, tokenBegin, newbuffer, 0, bufsize - tokenBegin);
+ System.arraycopy(buffer, 0, newbuffer, bufsize - tokenBegin, bufpos);
+ buffer = newbuffer;
- System.arraycopy(bufline, tokenBegin, newbufline, 0, bufsize - \
tokenBegin);
- System.arraycopy(bufline, 0, newbufline, bufsize - tokenBegin, bufpos);
- bufline = newbufline;
+ System.arraycopy(bufline, tokenBegin, newbufline, 0, bufsize - tokenBegin);
+ System.arraycopy(bufline, 0, newbufline, bufsize - tokenBegin, bufpos);
+ bufline = newbufline;
- System.arraycopy(bufcolumn, tokenBegin, newbufcolumn, 0, bufsize - \
tokenBegin);
- System.arraycopy(bufcolumn, 0, newbufcolumn, bufsize - tokenBegin, \
bufpos);
- bufcolumn = newbufcolumn;
+ System.arraycopy(bufcolumn, tokenBegin, newbufcolumn, 0, bufsize - \
tokenBegin); + System.arraycopy(bufcolumn, 0, newbufcolumn, bufsize - \
tokenBegin, bufpos); + bufcolumn = newbufcolumn;
- maxNextCharInd = (bufpos += (bufsize - tokenBegin));
- }
- else
- {
- System.arraycopy(buffer, tokenBegin, newbuffer, 0, bufsize - tokenBegin);
- buffer = newbuffer;
+ maxNextCharInd = (bufpos += (bufsize - tokenBegin));
+ }
+ else
+ {
+ System.arraycopy(buffer, tokenBegin, newbuffer, 0, bufsize - tokenBegin);
+ buffer = newbuffer;
- System.arraycopy(bufline, tokenBegin, newbufline, 0, bufsize - \
tokenBegin);
- bufline = newbufline;
+ System.arraycopy(bufline, tokenBegin, newbufline, 0, bufsize - tokenBegin);
+ bufline = newbufline;
- System.arraycopy(bufcolumn, tokenBegin, newbufcolumn, 0, bufsize - \
tokenBegin);
- bufcolumn = newbufcolumn;
+ System.arraycopy(bufcolumn, tokenBegin, newbufcolumn, 0, bufsize - \
tokenBegin); + bufcolumn = newbufcolumn;
- maxNextCharInd = (bufpos -= tokenBegin);
- }
- }
- catch (Throwable t)
- {
- throw new Error(t.getMessage());
- }
+ maxNextCharInd = (bufpos -= tokenBegin);
+ }
+ }
+ catch (Throwable t)
+ {
+ throw new Error(t.getMessage());
+ }
- bufsize += 2048;
- available = bufsize;
- tokenBegin = 0;
+ bufsize += 2048;
+ available = bufsize;
+ tokenBegin = 0;
}
protected void FillBuff() throws java.io.IOException
{
- if (maxNextCharInd == available)
- {
- if (available == bufsize)
+ if (maxNextCharInd == available)
+ {
+ if (available == bufsize)
+ {
+ if (tokenBegin > 2048)
{
- if (tokenBegin > 2048)
- {
- bufpos = maxNextCharInd = 0;
- available = tokenBegin;
- }
- else if (tokenBegin < 0)
- bufpos = maxNextCharInd = 0;
- else
- ExpandBuff(false);
+ bufpos = maxNextCharInd = 0;
+ available = tokenBegin;
}
- else if (available > tokenBegin)
- available = bufsize;
- else if ((tokenBegin - available) < 2048)
- ExpandBuff(true);
+ else if (tokenBegin < 0)
+ bufpos = maxNextCharInd = 0;
else
- available = tokenBegin;
- }
+ ExpandBuff(false);
+ }
+ else if (available > tokenBegin)
+ available = bufsize;
+ else if ((tokenBegin - available) < 2048)
+ ExpandBuff(true);
+ else
+ available = tokenBegin;
+ }
- int i;
- try {
- if ((i = inputStream.read(buffer, maxNextCharInd,
- available - maxNextCharInd)) == -1)
- {
- inputStream.close();
- throw new java.io.IOException();
- }
- else
- maxNextCharInd += i;
- return;
- }
- catch(java.io.IOException e) {
- --bufpos;
- backup(0);
- if (tokenBegin == -1)
- tokenBegin = bufpos;
- throw e;
- }
+ int i;
+ try {
+ if ((i = inputStream.read(buffer, maxNextCharInd, available - maxNextCharInd)) \
== -1) + {
+ inputStream.close();
+ throw new java.io.IOException();
+ }
+ else
+ maxNextCharInd += i;
+ return;
+ }
+ catch(java.io.IOException e) {
+ --bufpos;
+ backup(0);
+ if (tokenBegin == -1)
+ tokenBegin = bufpos;
+ throw e;
+ }
}
+/** Start. */
public char BeginToken() throws java.io.IOException
{
- tokenBegin = -1;
- char c = readChar();
- tokenBegin = bufpos;
+ tokenBegin = -1;
+ char c = readChar();
+ tokenBegin = bufpos;
- return c;
+ return c;
}
protected void UpdateLineColumn(char c)
{
- column++;
+ column++;
- if (prevCharIsLF)
- {
- prevCharIsLF = false;
+ if (prevCharIsLF)
+ {
+ prevCharIsLF = false;
+ line += (column = 1);
+ }
+ else if (prevCharIsCR)
+ {
+ prevCharIsCR = false;
+ if (c == '\n')
+ {
+ prevCharIsLF = true;
+ }
+ else
line += (column = 1);
- }
- else if (prevCharIsCR)
- {
- prevCharIsCR = false;
- if (c == '\n')
- {
- prevCharIsLF = true;
- }
- else
- line += (column = 1);
- }
+ }
- switch (c)
- {
- case '\r' :
- prevCharIsCR = true;
- break;
- case '\n' :
- prevCharIsLF = true;
- break;
- case '\t' :
- column--;
- column += (tabSize - (column % tabSize));
- break;
- default :
- break;
- }
+ switch (c)
+ {
+ case '\r' :
+ prevCharIsCR = true;
+ break;
+ case '\n' :
+ prevCharIsLF = true;
+ break;
+ case '\t' :
+ column--;
+ column += (tabSize - (column % tabSize));
+ break;
+ default :
+ break;
+ }
- bufline[bufpos] = line;
- bufcolumn[bufpos] = column;
+ bufline[bufpos] = line;
+ bufcolumn[bufpos] = column;
}
+/** Read a character. */
public char readChar() throws java.io.IOException
{
- if (inBuf > 0)
- {
- --inBuf;
+ if (inBuf > 0)
+ {
+ --inBuf;
- if (++bufpos == bufsize)
- bufpos = 0;
+ if (++bufpos == bufsize)
+ bufpos = 0;
- return buffer[bufpos];
- }
+ return buffer[bufpos];
+ }
- if (++bufpos >= maxNextCharInd)
- FillBuff();
+ if (++bufpos >= maxNextCharInd)
+ FillBuff();
- char c = buffer[bufpos];
+ char c = buffer[bufpos];
- UpdateLineColumn(c);
- return (c);
+ UpdateLineColumn(c);
+ return c;
}
+ @Deprecated
/**
- * @deprecated
+ * @deprecated
* @see #getEndColumn
*/
public int getColumn() {
- return bufcolumn[bufpos];
+ return bufcolumn[bufpos];
}
+ @Deprecated
/**
- * @deprecated
+ * @deprecated
* @see #getEndLine
*/
public int getLine() {
- return bufline[bufpos];
+ return bufline[bufpos];
}
+ /** Get token end column number. */
public int getEndColumn() {
- return bufcolumn[bufpos];
+ return bufcolumn[bufpos];
}
+ /** Get token end line number. */
public int getEndLine() {
return bufline[bufpos];
}
+ /** Get token beginning column number. */
public int getBeginColumn() {
- return bufcolumn[tokenBegin];
+ return bufcolumn[tokenBegin];
}
+ /** Get token beginning line number. */
public int getBeginLine() {
- return bufline[tokenBegin];
+ return bufline[tokenBegin];
}
+/** Backup a number of characters. */
public void backup(int amount) {
inBuf += amount;
if ((bufpos -= amount) < 0)
- bufpos += bufsize;
+ bufpos += bufsize;
}
+ /** Constructor. */
public SimpleCharStream(java.io.Reader dstream, int startline,
int startcolumn, int buffersize)
{
@@ -252,16 +263,20 @@
bufcolumn = new int[buffersize];
}
+ /** Constructor. */
public SimpleCharStream(java.io.Reader dstream, int startline,
int startcolumn)
{
- this(dstream, startline, startcolumn, 4096);
+ this(dstream, startline, startcolumn, 4096);
}
+ /** Constructor. */
public SimpleCharStream(java.io.Reader dstream)
{
- this(dstream, 1, 1, 4096);
+ this(dstream, 1, 1, 4096);
}
+
+ /** Reinitialise. */
public void ReInit(java.io.Reader dstream, int startline,
int startcolumn, int buffersize)
{
@@ -281,111 +296,128 @@
bufpos = -1;
}
+ /** Reinitialise. */
public void ReInit(java.io.Reader dstream, int startline,
int startcolumn)
{
- ReInit(dstream, startline, startcolumn, 4096);
+ ReInit(dstream, startline, startcolumn, 4096);
}
+ /** Reinitialise. */
public void ReInit(java.io.Reader dstream)
{
- ReInit(dstream, 1, 1, 4096);
+ ReInit(dstream, 1, 1, 4096);
}
+ /** Constructor. */
public SimpleCharStream(java.io.InputStream dstream, String encoding, int \
startline, int startcolumn, int buffersize) throws \
java.io.UnsupportedEncodingException {
- this(encoding == null ? new java.io.InputStreamReader(dstream) : new \
java.io.InputStreamReader(dstream, encoding), startline, startcolumn, buffersize); + \
this(encoding == null ? new java.io.InputStreamReader(dstream) : new \
java.io.InputStreamReader(dstream, encoding), startline, startcolumn, buffersize); }
+ /** Constructor. */
public SimpleCharStream(java.io.InputStream dstream, int startline,
int startcolumn, int buffersize)
{
- this(new java.io.InputStreamReader(dstream), startline, startcolumn, \
buffersize); + this(new java.io.InputStreamReader(dstream), startline, \
startcolumn, buffersize); }
+ /** Constructor. */
public SimpleCharStream(java.io.InputStream dstream, String encoding, int \
startline,
int startcolumn) throws \
java.io.UnsupportedEncodingException {
- this(dstream, encoding, startline, startcolumn, 4096);
+ this(dstream, encoding, startline, startcolumn, 4096);
}
+ /** Constructor. */
public SimpleCharStream(java.io.InputStream dstream, int startline,
int startcolumn)
{
- this(dstream, startline, startcolumn, 4096);
+ this(dstream, startline, startcolumn, 4096);
}
+ /** Constructor. */
public SimpleCharStream(java.io.InputStream dstream, String encoding) throws \
java.io.UnsupportedEncodingException {
- this(dstream, encoding, 1, 1, 4096);
+ this(dstream, encoding, 1, 1, 4096);
}
+ /** Constructor. */
public SimpleCharStream(java.io.InputStream dstream)
{
- this(dstream, 1, 1, 4096);
+ this(dstream, 1, 1, 4096);
}
+ /** Reinitialise. */
public void ReInit(java.io.InputStream dstream, String encoding, int startline,
int startcolumn, int buffersize) throws \
java.io.UnsupportedEncodingException {
- ReInit(encoding == null ? new java.io.InputStreamReader(dstream) : new \
java.io.InputStreamReader(dstream, encoding), startline, startcolumn, buffersize); + \
ReInit(encoding == null ? new java.io.InputStreamReader(dstream) : new \
java.io.InputStreamReader(dstream, encoding), startline, startcolumn, buffersize); }
+ /** Reinitialise. */
public void ReInit(java.io.InputStream dstream, int startline,
int startcolumn, int buffersize)
{
- ReInit(new java.io.InputStreamReader(dstream), startline, startcolumn, \
buffersize); + ReInit(new java.io.InputStreamReader(dstream), startline, \
startcolumn, buffersize); }
+ /** Reinitialise. */
public void ReInit(java.io.InputStream dstream, String encoding) throws \
java.io.UnsupportedEncodingException {
- ReInit(dstream, encoding, 1, 1, 4096);
+ ReInit(dstream, encoding, 1, 1, 4096);
}
+ /** Reinitialise. */
public void ReInit(java.io.InputStream dstream)
{
- ReInit(dstream, 1, 1, 4096);
+ ReInit(dstream, 1, 1, 4096);
}
+ /** Reinitialise. */
public void ReInit(java.io.InputStream dstream, String encoding, int startline,
int startcolumn) throws java.io.UnsupportedEncodingException
{
- ReInit(dstream, encoding, startline, startcolumn, 4096);
+ ReInit(dstream, encoding, startline, startcolumn, 4096);
}
+ /** Reinitialise. */
public void ReInit(java.io.InputStream dstream, int startline,
int startcolumn)
{
- ReInit(dstream, startline, startcolumn, 4096);
+ ReInit(dstream, startline, startcolumn, 4096);
}
+ /** Get token literal value. */
public String GetImage()
{
- if (bufpos >= tokenBegin)
- return new String(buffer, tokenBegin, bufpos - tokenBegin + 1);
- else
- return new String(buffer, tokenBegin, bufsize - tokenBegin) +
- new String(buffer, 0, bufpos + 1);
+ if (bufpos >= tokenBegin)
+ return new String(buffer, tokenBegin, bufpos - tokenBegin + 1);
+ else
+ return new String(buffer, tokenBegin, bufsize - tokenBegin) +
+ new String(buffer, 0, bufpos + 1);
}
+ /** Get the suffix. */
public char[] GetSuffix(int len)
{
- char[] ret = new char[len];
+ char[] ret = new char[len];
- if ((bufpos + 1) >= len)
- System.arraycopy(buffer, bufpos - len + 1, ret, 0, len);
- else
- {
- System.arraycopy(buffer, bufsize - (len - bufpos - 1), ret, 0,
- len - bufpos - 1);
- System.arraycopy(buffer, 0, ret, len - bufpos - 1, bufpos + 1);
- }
+ if ((bufpos + 1) >= len)
+ System.arraycopy(buffer, bufpos - len + 1, ret, 0, len);
+ else
+ {
+ System.arraycopy(buffer, bufsize - (len - bufpos - 1), ret, 0,
+ len - bufpos - 1);
+ System.arraycopy(buffer, 0, ret, len - bufpos - 1, bufpos + 1);
+ }
- return ret;
+ return ret;
}
+ /** Reset buffer when finished. */
public void Done()
{
- buffer = null;
- bufline = null;
- bufcolumn = null;
+ buffer = null;
+ bufline = null;
+ bufcolumn = null;
}
/**
@@ -393,47 +425,47 @@
*/
public void adjustBeginLineColumn(int newLine, int newCol)
{
- int start = tokenBegin;
- int len;
+ int start = tokenBegin;
+ int len;
- if (bufpos >= tokenBegin)
- {
- len = bufpos - tokenBegin + inBuf + 1;
- }
- else
- {
- len = bufsize - tokenBegin + bufpos + 1 + inBuf;
- }
+ if (bufpos >= tokenBegin)
+ {
+ len = bufpos - tokenBegin + inBuf + 1;
+ }
+ else
+ {
+ len = bufsize - tokenBegin + bufpos + 1 + inBuf;
+ }
- int i = 0, j = 0, k = 0;
- int nextColDiff = 0, columnDiff = 0;
+ int i = 0, j = 0, k = 0;
+ int nextColDiff = 0, columnDiff = 0;
- while (i < len &&
- bufline[j = start % bufsize] == bufline[k = ++start % bufsize])
- {
- bufline[j] = newLine;
- nextColDiff = columnDiff + bufcolumn[k] - bufcolumn[j];
- bufcolumn[j] = newCol + columnDiff;
- columnDiff = nextColDiff;
- i++;
- }
+ while (i < len && bufline[j = start % bufsize] == bufline[k = ++start % \
bufsize]) + {
+ bufline[j] = newLine;
+ nextColDiff = columnDiff + bufcolumn[k] - bufcolumn[j];
+ bufcolumn[j] = newCol + columnDiff;
+ columnDiff = nextColDiff;
+ i++;
+ }
- if (i < len)
- {
- bufline[j] = newLine++;
- bufcolumn[j] = newCol + columnDiff;
+ if (i < len)
+ {
+ bufline[j] = newLine++;
+ bufcolumn[j] = newCol + columnDiff;
- while (i++ < len)
- {
- if (bufline[j = start % bufsize] != bufline[++start % bufsize])
- bufline[j] = newLine++;
- else
- bufline[j] = newLine;
- }
- }
+ while (i++ < len)
+ {
+ if (bufline[j = start % bufsize] != bufline[++start % bufsize])
+ bufline[j] = newLine++;
+ else
+ bufline[j] = newLine;
+ }
+ }
- line = bufline[j];
- column = bufcolumn[j];
+ line = bufline[j];
+ column = bufcolumn[j];
}
}
+/* JavaCC - OriginalChecksum=3c0b7d5dae8f412493b9f25b02d5cee5 (do not edit this \
line) */
Modified: plugins/XML/trunk/xml/parser/javacc/Token.java
===================================================================
--- plugins/XML/trunk/xml/parser/javacc/Token.java 2014-03-06 13:23:38 UTC (rev \
23428)
+++ plugins/XML/trunk/xml/parser/javacc/Token.java 2014-03-06 21:06:53 UTC (rev \
23429) @@ -1,25 +1,35 @@
-/* Generated By:JavaCC: Do not edit this line. Token.java Version 3.0 */
+/* Generated By:JavaCC: Do not edit this line. Token.java Version 5.0 */
+/* JavaCCOptions:TOKEN_EXTENDS=,KEEP_LINE_COL=null,SUPPORT_CLASS_VISIBILITY_PUBLIC=true \
*/ package xml.parser.javacc;
/**
* Describes the input token stream.
*/
-public class Token {
+public class Token implements java.io.Serializable {
/**
+ * The version identifier for this Serializable class.
+ * Increment only if the <i>serialized</i> form of the
+ * class changes.
+ */
+ private static final long serialVersionUID = 1L;
+
+ /**
* An integer that describes the kind of this token. This numbering
* system is determined by JavaCCParser, and a table of these numbers is
* stored in the file ...Constants.java.
*/
public int kind;
- /**
- * beginLine and beginColumn describe the position of the first character
- * of this token; endLine and endColumn describe the position of the
- * last character of this token.
- */
- public int beginLine, beginColumn, endLine, endColumn;
+ /** The line number of the first character of this Token. */
+ public int beginLine;
+ /** The column number of the first character of this Token. */
+ public int beginColumn;
+ /** The line number of the last character of this Token. */
+ public int endLine;
+ /** The column number of the last character of this Token. */
+ public int endColumn;
/**
* The string image of the token.
@@ -51,11 +61,45 @@
public Token specialToken;
/**
+ * An optional attribute value of the Token.
+ * Tokens which are not used as syntactic sugar will often contain
+ * meaningful values that will be used later on by the compiler or
+ * interpreter. This attribute value is often different from the image.
+ * Any subclass of Token that actually wants to return a non-null value can
+ * override this method as appropriate.
+ */
+ public Object getValue() {
+ return null;
+ }
+
+ /**
+ * No-argument constructor
+ */
+ public Token() {}
+
+ /**
+ * Constructs a new token for the specified Image.
+ */
+ public Token(int kind)
+ {
+ this(kind, null);
+ }
+
+ /**
+ * Constructs a new token for the specified Image and Kind.
+ */
+ public Token(int kind, String image)
+ {
+ this.kind = kind;
+ this.image = image;
+ }
+
+ /**
* Returns the image.
*/
public String toString()
{
- return image;
+ return image;
}
/**
@@ -63,19 +107,25 @@
* can create and return subclass objects based on the value of ofKind.
* Simply add the cases to the switch for all those special cases.
* For example, if you have a subclass of Token called IDToken that
- * you want to create if ofKind is ID, simlpy add something like :
+ * you want to create if ofKind is ID, simply add something like :
*
- * case MyParserConstants.ID : return new IDToken();
+ * case MyParserConstants.ID : return new IDToken(ofKind, image);
*
* to the following switch statement. Then you can cast matchedToken
- * variable to the appropriate type and use it in your lexical actions.
+ * variable to the appropriate type and use sit in your lexical actions.
*/
- public static final Token newToken(int ofKind)
+ public static Token newToken(int ofKind, String image)
{
- switch(ofKind)
- {
- default : return new Token();
- }
+ switch(ofKind)
+ {
+ default : return new Token(ofKind, image);
+ }
}
+ public static Token newToken(int ofKind)
+ {
+ return newToken(ofKind, null);
+ }
+
}
+/* JavaCC - OriginalChecksum=934022441f2f8f1cb10a20b993c698e7 (do not edit this \
line) */
Modified: plugins/XML/trunk/xml/parser/javacc/TokenMgrError.java
===================================================================
--- plugins/XML/trunk/xml/parser/javacc/TokenMgrError.java 2014-03-06 13:23:38 UTC \
(rev 23428)
+++ plugins/XML/trunk/xml/parser/javacc/TokenMgrError.java 2014-03-06 21:06:53 UTC \
(rev 23429) @@ -1,133 +1,147 @@
-/* Generated By:JavaCC: Do not edit this line. TokenMgrError.java Version 3.0 */
+/* Generated By:JavaCC: Do not edit this line. TokenMgrError.java Version 5.0 */
+/* JavaCCOptions: */
package xml.parser.javacc;
+/** Token Manager Error. */
public class TokenMgrError extends Error
{
- /*
- * Ordinals for various reasons why an Error of this type can be thrown.
- */
- /**
- * Lexical error occured.
- */
- static final int LEXICAL_ERROR = 0;
+ /**
+ * The version identifier for this Serializable class.
+ * Increment only if the <i>serialized</i> form of the
+ * class changes.
+ */
+ private static final long serialVersionUID = 1L;
- /**
- * An attempt wass made to create a second instance of a static token manager.
- */
- static final int STATIC_LEXER_ERROR = 1;
+ /*
+ * Ordinals for various reasons why an Error of this type can be thrown.
+ */
- /**
- * Tried to change to an invalid lexical state.
- */
- static final int INVALID_LEXICAL_STATE = 2;
+ /**
+ * Lexical error occurred.
+ */
+ static final int LEXICAL_ERROR = 0;
- /**
- * Detected (and bailed out of) an infinite loop in the token manager.
- */
- static final int LOOP_DETECTED = 3;
+ /**
+ * An attempt was made to create a second instance of a static token manager.
+ */
+ static final int STATIC_LEXER_ERROR = 1;
- /**
- * Indicates the reason why the exception is thrown. It will have
- * one of the above 4 values.
- */
- int errorCode;
+ /**
+ * Tried to change to an invalid lexical state.
+ */
+ static final int INVALID_LEXICAL_STATE = 2;
- /**
- * Replaces unprintable characters by their espaced (or unicode escaped)
- * equivalents in the given string
- */
- protected static final String addEscapes(String str) {
- StringBuffer retval = new StringBuffer();
- char ch;
- for (int i = 0; i < str.length(); i++) {
- switch (str.charAt(i))
- {
- case 0 :
- continue;
- case '\b':
- retval.append("\\b");
- continue;
- case '\t':
- retval.append("\\t");
- continue;
- case '\n':
- retval.append("\\n");
- continue;
- case '\f':
- retval.append("\\f");
- continue;
- case '\r':
- retval.append("\\r");
- continue;
- case '\"':
- retval.append("\\\"");
- continue;
- case '\'':
- retval.append("\\\'");
- continue;
- case '\\':
- retval.append("\\\\");
- continue;
- default:
- if ((ch = str.charAt(i)) < 0x20 || ch > 0x7e) {
- String s = "0000" + Integer.toString(ch, 16);
- retval.append("\\u" + s.substring(s.length() - 4, s.length()));
- } else {
- retval.append(ch);
- }
- continue;
- }
+ /**
+ * Detected (and bailed out of) an infinite loop in the token manager.
+ */
+ static final int LOOP_DETECTED = 3;
+
+ /**
+ * Indicates the reason why the exception is thrown. It will have
+ * one of the above 4 values.
+ */
+ int errorCode;
+
+ /**
+ * Replaces unprintable characters by their escaped (or unicode escaped)
+ * equivalents in the given string
+ */
+ protected static final String addEscapes(String str) {
+ StringBuffer retval = new StringBuffer();
+ char ch;
+ for (int i = 0; i < str.length(); i++) {
+ switch (str.charAt(i))
+ {
+ case 0 :
+ continue;
+ case '\b':
+ retval.append("\\b");
+ continue;
+ case '\t':
+ retval.append("\\t");
+ continue;
+ case '\n':
+ retval.append("\\n");
+ continue;
+ case '\f':
+ retval.append("\\f");
+ continue;
+ case '\r':
+ retval.append("\\r");
+ continue;
+ case '\"':
+ retval.append("\\\"");
+ continue;
+ case '\'':
+ retval.append("\\\'");
+ continue;
+ case '\\':
+ retval.append("\\\\");
+ continue;
+ default:
+ if ((ch = str.charAt(i)) < 0x20 || ch > 0x7e) {
+ String s = "0000" + Integer.toString(ch, 16);
+ retval.append("\\u" + s.substring(s.length() - 4, s.length()));
+ } else {
+ retval.append(ch);
+ }
+ continue;
}
- return retval.toString();
- }
+ }
+ return retval.toString();
+ }
- /**
- * Returns a detailed message for the Error when it is thrown by the
- * token manager to indicate a lexical error.
- * Parameters :
- * EOFSeen : indicates if EOF caused the lexicl error
- * curLexState : lexical state in which this error occured
- * errorLine : line number when the error occured
- * errorColumn : column number when the error occured
- * errorAfter : prefix that was seen before this error occured
- * curchar : the offending character
- * Note: You can customize the lexical error message by modifying this method.
- */
- protected static String LexicalError(boolean EOFSeen, int lexState, int \
errorLine, int errorColumn, String errorAfter, char curChar) {
- return("Lexical error at line " +
- errorLine + ", column " +
- errorColumn + ". Encountered: " +
- (EOFSeen ? "<EOF> " : ("\"" + addEscapes(String.valueOf(curChar)) + "\"") \
+ " (" + (int)curChar + "), ") +
- "after : \"" + addEscapes(errorAfter) + "\"");
- }
+ /**
+ * Returns a detailed message for the Error when it is thrown by the
+ * token manager to indicate a lexical error.
+ * Parameters :
+ * EOFSeen : indicates if EOF caused the lexical error
+ * curLexState : lexical state in which this error occurred
+ * errorLine : line number when the error occurred
+ * errorColumn : column number when the error occurred
+ * errorAfter : prefix that was seen before this error occurred
+ * curchar : the offending character
+ * Note: You can customize the lexical error message by modifying this method.
+ */
+ protected static String LexicalError(boolean EOFSeen, int lexState, int errorLine, \
int errorColumn, String errorAfter, char curChar) { + return("Lexical error at \
line " + + errorLine + ", column " +
+ errorColumn + ". Encountered: " +
+ (EOFSeen ? "<EOF> " : ("\"" + addEscapes(String.valueOf(curChar)) + "\"") \
+ " (" + (int)curChar + "), ") + + "after : \"" + addEscapes(errorAfter) + \
"\""); + }
- /**
- * You can also modify the body of this method to customize your error messages.
- * For example, cases like LOOP_DETECTED and INVALID_LEXICAL_STATE are not
- * of end-users concern, so you can return something like :
- *
- * "Internal Error : Please file a bug report .... "
- *
- * from this method for such cases in the release version of your parser.
- */
- public String getMessage() {
- return super.getMessage();
- }
+ /**
+ * You can also modify the body of this method to customize your error messages.
+ * For example, cases like LOOP_DETECTED and INVALID_LEXICAL_STATE are not
+ * of end-users concern, so you can return something like :
+ *
+ * "Internal Error : Please file a bug report .... "
+ *
+ * from this method for such cases in the release version of your parser.
+ */
+ public String getMessage() {
+ return super.getMessage();
+ }
- /*
- * Constructors of various flavors follow.
- */
+ /*
+ * Constructors of various flavors follow.
+ */
- public TokenMgrError() {
- }
+ /** No arg constructor. */
+ public TokenMgrError() {
+ }
- public TokenMgrError(String message, int reason) {
- super(message);
- errorCode = reason;
- }
+ /** Constructor with message and reason. */
+ public TokenMgrError(String message, int reason) {
+ super(message);
+ errorCode = reason;
+ }
- public TokenMgrError(boolean EOFSeen, int lexState, int errorLine, int \
errorColumn, String errorAfter, char curChar, int reason) {
- this(LexicalError(EOFSeen, lexState, errorLine, errorColumn, errorAfter, \
curChar), reason);
- }
+ /** Full Constructor. */
+ public TokenMgrError(boolean EOFSeen, int lexState, int errorLine, int \
errorColumn, String errorAfter, char curChar, int reason) { + \
this(LexicalError(EOFSeen, lexState, errorLine, errorColumn, errorAfter, curChar), \
reason); + }
}
+/* JavaCC - OriginalChecksum=752eece05813d43472ba2b34e0279534 (do not edit this \
line) */
Modified: plugins/XML/trunk/xml/parser/javacc/XmlParser.java
===================================================================
--- plugins/XML/trunk/xml/parser/javacc/XmlParser.java 2014-03-06 13:23:38 UTC (rev \
23428)
+++ plugins/XML/trunk/xml/parser/javacc/XmlParser.java 2014-03-06 21:06:53 UTC (rev \
23429) @@ -62,7 +62,7 @@
private void addException(ParseException pe) {
Range range = getExceptionLocation( pe );
parseErrors.add(new ParseError(pe.getMessage(), range));
- pe.printStackTrace();
+ // pe.printStackTrace();
}
public List<ParseError> getParseErrors() {
@@ -72,7 +72,7 @@
// regex to extract line and colun from a ParseException message
// ParseException message look like: "Parse error at line 116, column 5. \
Encountered: }"
- private Pattern pePattern = Pattern.compile( "(.*?)(\\d+)(.*?)(\\d+)(.*?)" );
+ private Pattern pePattern = Pattern.compile( \
"(.*?)(\u005c\u005cd+)(.*?)(\u005c\u005cd+)(.*?)" );
/**
* @return attempts to return a Location indicating the location of a parser
@@ -115,7 +115,7 @@
private Pattern attributePattern = Pattern.compile( "([a-zA-Z0-9.-])*" );
private boolean isProperAttribute(String s) {
// could have double quotes
- if (s.startsWith("\"") && s.endsWith("\"")) {
+ if (s.startsWith("\u005c"") && s.endsWith("\u005c"")) {
return true;
}
// or single quotes
@@ -412,66 +412,70 @@
throw new Error("Missing return statement in function");
}
- final private boolean jj_2_1(int xla) {
+ private boolean jj_2_1(int xla) {
jj_la = xla; jj_lastpos = jj_scanpos = token;
try { return !jj_3_1(); }
catch(LookaheadSuccess ls) { return true; }
finally { jj_save(0, xla); }
}
- final private boolean jj_2_2(int xla) {
+ private boolean jj_2_2(int xla) {
jj_la = xla; jj_lastpos = jj_scanpos = token;
try { return !jj_3_2(); }
catch(LookaheadSuccess ls) { return true; }
finally { jj_save(1, xla); }
}
- final private boolean jj_3_2() {
+ private boolean jj_3_2() {
if (jj_scan_token(TAG_START)) return true;
if (jj_scan_token(LST_ERROR)) return true;
return false;
}
- final private boolean jj_3R_4() {
+ private boolean jj_3R_4() {
if (jj_scan_token(TAG_START)) return true;
if (jj_scan_token(TAG_NAME)) return true;
return false;
}
- final private boolean jj_3_1() {
+ private boolean jj_3_1() {
if (jj_3R_4()) return true;
return false;
}
+ /** Generated Token Manager. */
public XmlParserTokenManager token_source;
SimpleCharStream jj_input_stream;
- public Token token, jj_nt;
+ /** Current token. */
+ public Token token;
+ /** Next token. */
+ public Token jj_nt;
private int jj_ntk;
private Token jj_scanpos, jj_lastpos;
private int jj_la;
- public boolean lookingAhead = false;
- private boolean jj_semLA;
private int jj_gen;
final private int[] jj_la1 = new int[9];
static private int[] jj_la1_0;
static private int[] jj_la1_1;
static {
- jj_la1_0();
- jj_la1_1();
+ jj_la1_init_0();
+ jj_la1_init_1();
}
- private static void jj_la1_0() {
+ private static void jj_la1_init_0() {
jj_la1_0 = new int[] \
{0x1f800,0xb000,0x10800,0x1000000,0x200000,0xc00000,0x80000000,0x80000000,0x40000001,};
}
- private static void jj_la1_1() {
+ private static void jj_la1_init_1() {
jj_la1_1 = new int[] {0x0,0x0,0x0,0x0,0x0,0x0,0x3,0x3,0x0,};
}
final private JJCalls[] jj_2_rtns = new JJCalls[2];
private boolean jj_rescan = false;
private int jj_gc = 0;
+ /** Constructor with InputStream. */
public XmlParser(java.io.InputStream stream) {
this(stream, null);
}
+ /** Constructor with InputStream and supplied encoding */
public XmlParser(java.io.InputStream stream, String encoding) {
try { jj_input_stream = new SimpleCharStream(stream, encoding, 1, 1); } \
catch(java.io.UnsupportedEncodingException e) { throw new RuntimeException(e); } \
token_source = new XmlParserTokenManager(jj_input_stream); @@ -482,9 +486,11 @@
for (int i = 0; i < jj_2_rtns.length; i++) jj_2_rtns[i] = new JJCalls();
}
+ /** Reinitialise. */
public void ReInit(java.io.InputStream stream) {
ReInit(stream, null);
}
+ /** Reinitialise. */
public void ReInit(java.io.InputStream stream, String encoding) {
try { jj_input_stream.ReInit(stream, encoding, 1, 1); } \
catch(java.io.UnsupportedEncodingException e) { throw new RuntimeException(e); } \
token_source.ReInit(jj_input_stream); @@ -495,6 +501,7 @@
for (int i = 0; i < jj_2_rtns.length; i++) jj_2_rtns[i] = new JJCalls();
}
+ /** Constructor. */
public XmlParser(java.io.Reader stream) {
jj_input_stream = new SimpleCharStream(stream, 1, 1);
token_source = new XmlParserTokenManager(jj_input_stream);
@@ -505,6 +512,7 @@
for (int i = 0; i < jj_2_rtns.length; i++) jj_2_rtns[i] = new JJCalls();
}
+ /** Reinitialise. */
public void ReInit(java.io.Reader stream) {
jj_input_stream.ReInit(stream, 1, 1);
token_source.ReInit(jj_input_stream);
@@ -515,6 +523,7 @@
for (int i = 0; i < jj_2_rtns.length; i++) jj_2_rtns[i] = new JJCalls();
}
+ /** Constructor with generated Token Manager. */
public XmlParser(XmlParserTokenManager tm) {
token_source = tm;
token = new Token();
@@ -524,6 +533,7 @@
for (int i = 0; i < jj_2_rtns.length; i++) jj_2_rtns[i] = new JJCalls();
}
+ /** Reinitialise. */
public void ReInit(XmlParserTokenManager tm) {
token_source = tm;
token = new Token();
@@ -533,7 +543,7 @@
for (int i = 0; i < jj_2_rtns.length; i++) jj_2_rtns[i] = new JJCalls();
}
- final private Token jj_consume_token(int kind) throws ParseException {
+ private Token jj_consume_token(int kind) throws ParseException {
Token oldToken;
if ((oldToken = token).next != null) token = token.next;
else token = token.next = token_source.getNextToken();
@@ -559,7 +569,7 @@
static private final class LookaheadSuccess extends java.lang.Error { }
final private LookaheadSuccess jj_ls = new LookaheadSuccess();
- final private boolean jj_scan_token(int kind) {
+ private boolean jj_scan_token(int kind) {
if (jj_scanpos == jj_lastpos) {
jj_la--;
if (jj_scanpos.next == null) {
@@ -580,6 +590,8 @@
return false;
}
+
+/** Get the next Token. */
final public Token getNextToken() {
if (token.next != null) token = token.next;
else token = token.next = token_source.getNextToken();
@@ -588,8 +600,9 @@
return token;
}
+/** Get the specific Token. */
final public Token getToken(int index) {
- Token t = lookingAhead ? jj_scanpos : token;
+ Token t = token;
for (int i = 0; i < index; i++) {
if (t.next != null) t = t.next;
else t = t.next = token_source.getNextToken();
@@ -597,14 +610,14 @@
return t;
}
- final private int jj_ntk() {
+ private int jj_ntk() {
if ((jj_nt=token.next) == null)
return (jj_ntk = (token.next=token_source.getNextToken()).kind);
else
return (jj_ntk = jj_nt.kind);
}
- private java.util.Vector jj_expentries = new java.util.Vector();
+ private java.util.List<int[]> jj_expentries = new java.util.ArrayList<int[]>();
private int[] jj_expentry;
private int jj_kind = -1;
private int[] jj_lasttokens = new int[100];
@@ -619,31 +632,26 @@
for (int i = 0; i < jj_endpos; i++) {
jj_expentry[i] = jj_lasttokens[i];
}
- boolean exists = false;
- for (java.util.Enumeration e = jj_expentries.elements(); e.hasMoreElements();) \
{
- int[] oldentry = (int[])(e.nextElement());
+ jj_entries_loop: for (java.util.Iterator<?> it = jj_expentries.iterator(); \
it.hasNext();) { + int[] oldentry = (int[])(it.next());
if (oldentry.length == jj_expentry.length) {
- exists = true;
for (int i = 0; i < jj_expentry.length; i++) {
if (oldentry[i] != jj_expentry[i]) {
- exists = false;
- break;
+ continue jj_entries_loop;
}
}
- if (exists) break;
+ jj_expentries.add(jj_expentry);
+ break jj_entries_loop;
}
}
- if (!exists) jj_expentries.addElement(jj_expentry);
if (pos != 0) jj_lasttokens[(jj_endpos = pos) - 1] = kind;
}
}
+ /** Generate ParseException. */
public ParseException generateParseException() {
- jj_expentries.removeAllElements();
+ jj_expentries.clear();
boolean[] la1tokens = new boolean[36];
- for (int i = 0; i < 36; i++) {
- la1tokens[i] = false;
- }
if (jj_kind >= 0) {
la1tokens[jj_kind] = true;
jj_kind = -1;
@@ -664,7 +672,7 @@
if (la1tokens[i]) {
jj_expentry = new int[1];
jj_expentry[0] = i;
- jj_expentries.addElement(jj_expentry);
+ jj_expentries.add(jj_expentry);
}
}
jj_endpos = 0;
@@ -672,18 +680,20 @@
jj_add_error_token(0, 0);
int[][] exptokseq = new int[jj_expentries.size()][];
for (int i = 0; i < jj_expentries.size(); i++) {
- exptokseq[i] = (int[])jj_expentries.elementAt(i);
+ exptokseq[i] = jj_expentries.get(i);
}
return new ParseException(token, exptokseq, tokenImage);
}
+ /** Enable tracing. */
final public void enable_tracing() {
}
+ /** Disable tracing. */
final public void disable_tracing() {
}
- final private void jj_rescan_token() {
+ private void jj_rescan_token() {
jj_rescan = true;
for (int i = 0; i < 2; i++) {
try {
@@ -703,7 +713,7 @@
jj_rescan = false;
}
- final private void jj_save(int index, int xla) {
+ private void jj_save(int index, int xla) {
JJCalls p = jj_2_rtns[index];
while (p.gen > jj_gen) {
if (p.next == null) { p = p.next = new JJCalls(); break; }
Modified: plugins/XML/trunk/xml/parser/javacc/XmlParser.jj
===================================================================
--- plugins/XML/trunk/xml/parser/javacc/XmlParser.jj 2014-03-06 13:23:38 UTC (rev \
23428)
+++ plugins/XML/trunk/xml/parser/javacc/XmlParser.jj 2014-03-06 21:06:53 UTC (rev \
23429) @@ -110,7 +110,7 @@
private void addException(ParseException pe) {
Range range = getExceptionLocation( pe );
parseErrors.add(new ParseError(pe.getMessage(), range));
- pe.printStackTrace();
+ // pe.printStackTrace();
}
public List<ParseError> getParseErrors() {
Modified: plugins/XML/trunk/xml/parser/javacc/XmlParserConstants.java
===================================================================
--- plugins/XML/trunk/xml/parser/javacc/XmlParserConstants.java 2014-03-06 13:23:38 \
UTC (rev 23428)
+++ plugins/XML/trunk/xml/parser/javacc/XmlParserConstants.java 2014-03-06 21:06:53 \
UTC (rev 23429) @@ -1,49 +1,94 @@
/* Generated By:JavaCC: Do not edit this line. XmlParserConstants.java */
package xml.parser.javacc;
+
+/**
+ * Token literal values and constants.
+ * Generated by org.javacc.parser.OtherFilesGen#start()
+ */
public interface XmlParserConstants {
+ /** End of File. */
int EOF = 0;
+ /** RegularExpression Id. */
int ALPHA_CHAR = 1;
+ /** RegularExpression Id. */
int NUM_CHAR = 2;
+ /** RegularExpression Id. */
int ALPHANUM_CHAR = 3;
+ /** RegularExpression Id. */
int IDENTIFIER_CHAR = 4;
+ /** RegularExpression Id. */
int IDENTIFIER = 5;
+ /** RegularExpression Id. */
int QUOTED_STRING_NB = 6;
+ /** RegularExpression Id. */
int QUOTED_STRING = 7;
+ /** RegularExpression Id. */
int WHITESPACE = 8;
+ /** RegularExpression Id. */
int NEWLINE = 9;
+ /** RegularExpression Id. */
int QUOTE = 10;
+ /** RegularExpression Id. */
int EOL = 11;
+ /** RegularExpression Id. */
int COMMENT_START = 12;
+ /** RegularExpression Id. */
int ENDTAG_START = 13;
+ /** RegularExpression Id. */
int TAG_START = 14;
+ /** RegularExpression Id. */
int DECL_START = 15;
+ /** RegularExpression Id. */
int PCDATA = 16;
+ /** RegularExpression Id. */
int TAG_NAME = 18;
+ /** RegularExpression Id. */
int LST_ERROR = 19;
+ /** RegularExpression Id. */
int ATTR_NAME = 21;
+ /** RegularExpression Id. */
int TAG_END = 22;
+ /** RegularExpression Id. */
int TAG_SLASHEND = 23;
+ /** RegularExpression Id. */
int ATTR_EQ = 24;
+ /** RegularExpression Id. */
int IMPLICIT_TAG_END = 25;
+ /** RegularExpression Id. */
int LIT_ERROR = 26;
+ /** RegularExpression Id. */
int ATTR_VAL = 28;
+ /** RegularExpression Id. */
int LAV_ERROR = 29;
+ /** RegularExpression Id. */
int COMMENT_END = 30;
+ /** RegularExpression Id. */
int DASH = 31;
+ /** RegularExpression Id. */
int COMMENT_EOL = 32;
+ /** RegularExpression Id. */
int COMMENT_WORD = 33;
+ /** RegularExpression Id. */
int DECL_ANY = 34;
+ /** RegularExpression Id. */
int DECL_END = 35;
+ /** Lexical state. */
int LexDecl = 0;
+ /** Lexical state. */
int LexComment = 1;
+ /** Lexical state. */
int LexAttrVal = 2;
+ /** Lexical state. */
int LexInTag = 3;
+ /** Lexical state. */
int LexStartTag = 4;
+ /** Lexical state. */
int DEFAULT = 5;
+ /** Literal token values. */
String[] tokenImage = {
"<EOF>",
"<ALPHA_CHAR>",
Modified: plugins/XML/trunk/xml/parser/javacc/XmlParserTokenManager.java
===================================================================
--- plugins/XML/trunk/xml/parser/javacc/XmlParserTokenManager.java 2014-03-06 \
13:23:38 UTC (rev 23428)
+++ plugins/XML/trunk/xml/parser/javacc/XmlParserTokenManager.java 2014-03-06 \
21:06:53 UTC (rev 23429) @@ -6,9 +6,13 @@
import sidekick.util.*;
import java.io.Reader;
+/** Token Manager. */
public class XmlParserTokenManager implements XmlParserConstants
{
+
+ /** Debug output. */
public java.io.PrintStream debugStream = System.out;
+ /** Set debug output. */
public void setDebugStream(java.io.PrintStream ds) { debugStream = ds; }
private final int jjStopStringLiteralDfa_5(int pos, long active0)
{
@@ -29,22 +33,14 @@
{
return jjMoveNfa_5(jjStopStringLiteralDfa_5(pos, active0), pos + 1);
}
-private final int jjStopAtPos(int pos, int kind)
+private int jjStopAtPos(int pos, int kind)
{
jjmatchedKind = kind;
jjmatchedPos = pos;
return pos + 1;
}
-private final int jjStartNfaWithStates_5(int pos, int kind, int state)
+private int jjMoveStringLiteralDfa0_5()
{
- jjmatchedKind = kind;
- jjmatchedPos = pos;
- try { curChar = input_stream.readChar(); }
- catch(java.io.IOException e) { return pos + 1; }
- return jjMoveNfa_5(state, pos + 1);
-}
-private final int jjMoveStringLiteralDfa0_5()
-{
switch(curChar)
{
case 60:
@@ -53,7 +49,7 @@
return jjMoveNfa_5(5, 0);
}
}
-private final int jjMoveStringLiteralDfa1_5(long active0)
+private int jjMoveStringLiteralDfa1_5(long active0)
{
try { curChar = input_stream.readChar(); }
catch(java.io.IOException e) {
@@ -71,36 +67,14 @@
}
return jjStartNfa_5(0, active0);
}
-private final void jjCheckNAdd(int state)
+private int jjStartNfaWithStates_5(int pos, int kind, int state)
{
- if (jjrounds[state] != jjround)
- {
- jjstateSet[jjnewStateCnt++] = state;
- jjrounds[state] = jjround;
- }
+ jjmatchedKind = kind;
+ jjmatchedPos = pos;
+ try { curChar = input_stream.readChar(); }
+ catch(java.io.IOException e) { return pos + 1; }
+ return jjMoveNfa_5(state, pos + 1);
}
-private final void jjAddStates(int start, int end)
-{
- do {
- jjstateSet[jjnewStateCnt++] = jjnextStates[start];
- } while (start++ != end);
-}
-private final void jjCheckNAddTwoStates(int state1, int state2)
-{
- jjCheckNAdd(state1);
- jjCheckNAdd(state2);
-}
-private final void jjCheckNAddStates(int start, int end)
-{
- do {
- jjCheckNAdd(jjnextStates[start]);
- } while (start++ != end);
-}
-private final void jjCheckNAddStates(int start)
-{
- jjCheckNAdd(jjnextStates[start]);
- jjCheckNAdd(jjnextStates[start + 1]);
-}
static final long[] jjbitVec0 = {
0xfffffffffffffffeL, 0xffffffffffffffffL, 0xffffffffffffffffL, \
0xffffffffffffffffL };
@@ -114,25 +88,27 @@
0x0L, 0x0L, 0x0L, 0xff7fffffff7fffffL
};
static final long[] jjbitVec5 = {
+ 0x3fffffffffL, 0x0L, 0x0L, 0x0L
+};
+static final long[] jjbitVec6 = {
0x0L, 0xffffffffffffffffL, 0xffffffffffffffffL, 0xffffffffffffffffL
};
-static final long[] jjbitVec6 = {
+static final long[] jjbitVec7 = {
0xffffffffffffffffL, 0xffffffffffffffffL, 0xffffL, 0x0L
};
-static final long[] jjbitVec7 = {
+static final long[] jjbitVec8 = {
0xffffffffffffffffL, 0xffffffffffffffffL, 0x0L, 0x0L
};
-static final long[] jjbitVec8 = {
+static final long[] jjbitVec9 = {
0x3fffffffffffL, 0x0L, 0x0L, 0x0L
};
-private final int jjMoveNfa_5(int startState, int curPos)
+private int jjMoveNfa_5(int startState, int curPos)
{
- int[] nextStates;
int startsAt = 0;
jjnewStateCnt = 20;
int i = 1;
jjstateSet[0] = startState;
- int j, kind = 0x7fffffff;
+ int kind = 0x7fffffff;
for (;;)
{
if (++jjround == 0x7fffffff)
@@ -140,7 +116,7 @@
if (curChar < 64)
{
long l = 1L << curChar;
- MatchLoop: do
+ do
{
switch(jjstateSet[--i])
{
@@ -263,7 +239,7 @@
else if (curChar < 128)
{
long l = 1L << (curChar & 077);
- MatchLoop: do
+ do
{
switch(jjstateSet[--i])
{
@@ -294,7 +270,7 @@
long l1 = 1L << (hiByte & 077);
int i2 = (curChar & 0xff) >> 6;
long l2 = 1L << (curChar & 077);
- MatchLoop: do
+ do
{
switch(jjstateSet[--i])
{
@@ -343,16 +319,8 @@
{
return jjMoveNfa_3(jjStopStringLiteralDfa_3(pos, active0), pos + 1);
}
-private final int jjStartNfaWithStates_3(int pos, int kind, int state)
+private int jjMoveStringLiteralDfa0_3()
{
- jjmatchedKind = kind;
- jjmatchedPos = pos;
- try { curChar = input_stream.readChar(); }
- catch(java.io.IOException e) { return pos + 1; }
- return jjMoveNfa_3(state, pos + 1);
-}
-private final int jjMoveStringLiteralDfa0_3()
-{
switch(curChar)
{
case 47:
@@ -367,7 +335,7 @@
return jjMoveNfa_3(1, 0);
}
}
-private final int jjMoveStringLiteralDfa1_3(long active0)
+private int jjMoveStringLiteralDfa1_3(long active0)
{
try { curChar = input_stream.readChar(); }
catch(java.io.IOException e) {
@@ -385,14 +353,13 @@
}
return jjStartNfa_3(0, active0);
}
-private final int jjMoveNfa_3(int startState, int curPos)
+private int jjMoveNfa_3(int startState, int curPos)
{
- int[] nextStates;
int startsAt = 0;
jjnewStateCnt = 3;
int i = 1;
jjstateSet[0] = startState;
- int j, kind = 0x7fffffff;
+ int kind = 0x7fffffff;
for (;;)
{
if (++jjround == 0x7fffffff)
@@ -400,7 +367,7 @@
if (curChar < 64)
{
long l = 1L << curChar;
- MatchLoop: do
+ do
{
switch(jjstateSet[--i])
{
@@ -437,7 +404,7 @@
else if (curChar < 128)
{
long l = 1L << (curChar & 077);
- MatchLoop: do
+ do
{
switch(jjstateSet[--i])
{
@@ -460,7 +427,7 @@
long l1 = 1L << (hiByte & 077);
int i2 = (curChar & 0xff) >> 6;
long l2 = 1L << (curChar & 077);
- MatchLoop: do
+ do
{
switch(jjstateSet[--i])
{
@@ -488,18 +455,17 @@
catch(java.io.IOException e) { return curPos; }
}
}
-private final int jjMoveStringLiteralDfa0_2()
+private int jjMoveStringLiteralDfa0_2()
{
return jjMoveNfa_2(0, 0);
}
-private final int jjMoveNfa_2(int startState, int curPos)
+private int jjMoveNfa_2(int startState, int curPos)
{
- int[] nextStates;
int startsAt = 0;
jjnewStateCnt = 8;
int i = 1;
jjstateSet[0] = startState;
- int j, kind = 0x7fffffff;
+ int kind = 0x7fffffff;
for (;;)
{
if (++jjround == 0x7fffffff)
@@ -507,7 +473,7 @@
if (curChar < 64)
{
long l = 1L << curChar;
- MatchLoop: do
+ do
{
switch(jjstateSet[--i])
{
@@ -566,7 +532,7 @@
else if (curChar < 128)
{
long l = 1L << (curChar & 077);
- MatchLoop: do
+ do
{
switch(jjstateSet[--i])
{
@@ -593,7 +559,7 @@
long l1 = 1L << (hiByte & 077);
int i2 = (curChar & 0xff) >> 6;
long l2 = 1L << (curChar & 077);
- MatchLoop: do
+ do
{
switch(jjstateSet[--i])
{
@@ -630,18 +596,17 @@
catch(java.io.IOException e) { return curPos; }
}
}
-private final int jjMoveStringLiteralDfa0_4()
+private int jjMoveStringLiteralDfa0_4()
{
return jjMoveNfa_4(1, 0);
}
-private final int jjMoveNfa_4(int startState, int curPos)
+private int jjMoveNfa_4(int startState, int curPos)
{
- int[] nextStates;
int startsAt = 0;
jjnewStateCnt = 3;
int i = 1;
jjstateSet[0] = startState;
- int j, kind = 0x7fffffff;
+ int kind = 0x7fffffff;
for (;;)
{
if (++jjround == 0x7fffffff)
@@ -649,7 +614,7 @@
if (curChar < 64)
{
long l = 1L << curChar;
- MatchLoop: do
+ do
{
switch(jjstateSet[--i])
{
@@ -686,7 +651,7 @@
else if (curChar < 128)
{
long l = 1L << (curChar & 077);
- MatchLoop: do
+ do
{
switch(jjstateSet[--i])
{
@@ -709,7 +674,7 @@
long l1 = 1L << (hiByte & 077);
int i2 = (curChar & 0xff) >> 6;
long l2 = 1L << (curChar & 077);
- MatchLoop: do
+ do
{
switch(jjstateSet[--i])
{
@@ -749,16 +714,8 @@
{
return jjMoveNfa_0(jjStopStringLiteralDfa_0(pos, active0), pos + 1);
}
-private final int jjStartNfaWithStates_0(int pos, int kind, int state)
+private int jjMoveStringLiteralDfa0_0()
{
- jjmatchedKind = kind;
- jjmatchedPos = pos;
- try { curChar = input_stream.readChar(); }
- catch(java.io.IOException e) { return pos + 1; }
- return jjMoveNfa_0(state, pos + 1);
-}
-private final int jjMoveStringLiteralDfa0_0()
-{
switch(curChar)
{
case 62:
@@ -767,14 +724,13 @@
return jjMoveNfa_0(7, 0);
}
}
-private final int jjMoveNfa_0(int startState, int curPos)
+private int jjMoveNfa_0(int startState, int curPos)
{
- int[] nextStates;
int startsAt = 0;
jjnewStateCnt = 7;
int i = 1;
jjstateSet[0] = startState;
- int j, kind = 0x7fffffff;
+ int kind = 0x7fffffff;
for (;;)
{
if (++jjround == 0x7fffffff)
@@ -782,7 +738,7 @@
if (curChar < 64)
{
long l = 1L << curChar;
- MatchLoop: do
+ do
{
switch(jjstateSet[--i])
{
@@ -842,7 +798,7 @@
else if (curChar < 128)
{
long l = 1L << (curChar & 077);
- MatchLoop: do
+ do
{
switch(jjstateSet[--i])
{
@@ -869,7 +825,7 @@
long l1 = 1L << (hiByte & 077);
int i2 = (curChar & 0xff) >> 6;
long l2 = 1L << (curChar & 077);
- MatchLoop: do
+ do
{
switch(jjstateSet[--i])
{
@@ -918,16 +874,8 @@
{
return jjMoveNfa_1(jjStopStringLiteralDfa_1(pos, active0), pos + 1);
}
-private final int jjStartNfaWithStates_1(int pos, int kind, int state)
+private int jjMoveStringLiteralDfa0_1()
{
- jjmatchedKind = kind;
- jjmatchedPos = pos;
- try { curChar = input_stream.readChar(); }
- catch(java.io.IOException e) { return pos + 1; }
- return jjMoveNfa_1(state, pos + 1);
-}
-private final int jjMoveStringLiteralDfa0_1()
-{
switch(curChar)
{
case 45:
@@ -936,14 +884,21 @@
return jjMoveNfa_1(1, 0);
}
}
-private final int jjMoveNfa_1(int startState, int curPos)
+private int jjStartNfaWithStates_1(int pos, int kind, int state)
{
- int[] nextStates;
+ jjmatchedKind = kind;
+ jjmatchedPos = pos;
+ try { curChar = input_stream.readChar(); }
+ catch(java.io.IOException e) { return pos + 1; }
+ return jjMoveNfa_1(state, pos + 1);
+}
+private int jjMoveNfa_1(int startState, int curPos)
+{
int startsAt = 0;
jjnewStateCnt = 14;
int i = 1;
jjstateSet[0] = startState;
- int j, kind = 0x7fffffff;
+ int kind = 0x7fffffff;
for (;;)
{
if (++jjround == 0x7fffffff)
@@ -951,7 +906,7 @@
if (curChar < 64)
{
long l = 1L << curChar;
- MatchLoop: do
+ do
{
switch(jjstateSet[--i])
{
@@ -1048,7 +1003,7 @@
else if (curChar < 128)
{
long l = 1L << (curChar & 077);
- MatchLoop: do
+ do
{
switch(jjstateSet[--i])
{
@@ -1075,7 +1030,7 @@
long l1 = 1L << (hiByte & 077);
int i2 = (curChar & 0xff) >> 6;
long l2 = 1L << (curChar & 077);
- MatchLoop: do
+ do
{
switch(jjstateSet[--i])
{
@@ -1122,7 +1077,7 @@
{
case 0:
return ((jjbitVec2[i2] & l2) != 0L);
- default :
+ default :
if ((jjbitVec0[i1] & l1) != 0L)
return true;
return false;
@@ -1134,32 +1089,40 @@
{
case 0:
return ((jjbitVec4[i2] & l2) != 0L);
+ case 45:
+ return ((jjbitVec5[i2] & l2) != 0L);
case 48:
- return ((jjbitVec5[i2] & l2) != 0L);
+ return ((jjbitVec6[i2] & l2) != 0L);
case 49:
- return ((jjbitVec6[i2] & l2) != 0L);
+ return ((jjbitVec7[i2] & l2) != 0L);
case 51:
- return ((jjbitVec7[i2] & l2) != 0L);
+ return ((jjbitVec8[i2] & l2) != 0L);
case 61:
- return ((jjbitVec8[i2] & l2) != 0L);
- default :
+ return ((jjbitVec9[i2] & l2) != 0L);
+ default :
if ((jjbitVec3[i1] & l1) != 0L)
return true;
return false;
}
}
+
+/** Token literal values. */
public static final String[] jjstrLiteralImages = {
"", null, null, null, null, null, null, null, null, null, null, null, null,
null, null, "\74\41", null, null, null, null, null, null, "\76", "\57\76", "\75",
"\74", null, null, null, null, null, "\55", null, null, null, "\76", };
+
+/** Lexer state names. */
public static final String[] lexStateNames = {
- "LexDecl",
- "LexComment",
- "LexAttrVal",
- "LexInTag",
- "LexStartTag",
- "DEFAULT",
+ "LexDecl",
+ "LexComment",
+ "LexAttrVal",
+ "LexInTag",
+ "LexStartTag",
+ "DEFAULT",
};
+
+/** Lex State array. */
public static final int[] jjnewLexState = {
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 1, 4, 4, 0, -1, -1, 3, 5, -1, -1, \
5, 5, 2, 4, -1, -1, 3, -1, 5, -1, -1, -1, -1, 5,
@@ -1176,19 +1139,25 @@
protected SimpleCharStream input_stream;
private final int[] jjrounds = new int[20];
private final int[] jjstateSet = new int[40];
-StringBuffer image;
-int jjimageLen;
-int lengthOfMatch;
+private final StringBuilder jjimage = new StringBuilder();
+private StringBuilder image = jjimage;
+private int jjimageLen;
+private int lengthOfMatch;
protected char curChar;
+/** Constructor. */
public XmlParserTokenManager(SimpleCharStream stream){
if (SimpleCharStream.staticFlag)
throw new Error("ERROR: Cannot use a static CharStream class with a non-static \
lexical analyzer."); input_stream = stream;
}
+
+/** Constructor. */
public XmlParserTokenManager(SimpleCharStream stream, int lexState){
this(stream);
SwitchTo(lexState);
}
+
+/** Reinitialise parser. */
public void ReInit(SimpleCharStream stream)
{
jjmatchedPos = jjnewStateCnt = 0;
@@ -1196,18 +1165,22 @@
input_stream = stream;
ReInitRounds();
}
-private final void ReInitRounds()
+private void ReInitRounds()
{
int i;
jjround = 0x80000001;
for (i = 20; i-- > 0;)
jjrounds[i] = 0x80000000;
}
+
+/** Reinitialise parser. */
public void ReInit(SimpleCharStream stream, int lexState)
{
ReInit(stream);
SwitchTo(lexState);
}
+
+/** Switch to specified lex state. */
public void SwitchTo(int lexState)
{
if (lexState >= 6 || lexState < 0)
@@ -1218,14 +1191,25 @@
protected Token jjFillToken()
{
- Token t = Token.newToken(jjmatchedKind);
- t.kind = jjmatchedKind;
+ final Token t;
+ final String curTokenImage;
+ final int beginLine;
+ final int endLine;
+ final int beginColumn;
+ final int endColumn;
String im = jjstrLiteralImages[jjmatchedKind];
- t.image = (im == null) ? input_stream.GetImage() : im;
- t.beginLine = input_stream.getBeginLine();
- t.beginColumn = input_stream.getBeginColumn();
- t.endLine = input_stream.getEndLine();
- t.endColumn = input_stream.getEndColumn();
+ curTokenImage = (im == null) ? input_stream.GetImage() : im;
+ beginLine = input_stream.getBeginLine();
+ beginColumn = input_stream.getBeginColumn();
+ endLine = input_stream.getEndLine();
+ endColumn = input_stream.getEndColumn();
+ t = Token.newToken(jjmatchedKind, curTokenImage);
+
+ t.beginLine = beginLine;
+ t.endLine = endLine;
+ t.beginColumn = beginColumn;
+ t.endColumn = endColumn;
+
return t;
}
@@ -1236,28 +1220,29 @@
int jjmatchedPos;
int jjmatchedKind;
+/** Get the next Token. */
public Token getNextToken()
{
- int kind;
Token specialToken = null;
Token matchedToken;
int curPos = 0;
EOFLoop :
for (;;)
- {
- try
- {
+ {
+ try
+ {
curChar = input_stream.BeginToken();
- }
+ }
catch(java.io.IOException e)
- {
+ {
jjmatchedKind = 0;
matchedToken = jjFillToken();
matchedToken.specialToken = specialToken;
return matchedToken;
}
- image = null;
+ image = jjimage;
+ image.setLength(0);
jjimageLen = 0;
switch(curLexState)
@@ -1364,9 +1349,8 @@
switch(jjmatchedKind)
{
case 25 :
- if (image == null)
- image = new StringBuffer();
- image.append(jjstrLiteralImages[25]);
+ image.append(jjstrLiteralImages[25]);
+ lengthOfMatch = jjstrLiteralImages[25].length();
Token t = new Token();
t.image = "<";
t.kind = TAG_START;
@@ -1379,8 +1363,35 @@
matchedToken.kind = TAG_END;
matchedToken.image = ">";
break;
- default :
+ default :
break;
}
}
+private void jjCheckNAdd(int state)
+{
+ if (jjrounds[state] != jjround)
+ {
+ jjstateSet[jjnewStateCnt++] = state;
+ jjrounds[state] = jjround;
+ }
}
+private void jjAddStates(int start, int end)
+{
+ do {
+ jjstateSet[jjnewStateCnt++] = jjnextStates[start];
+ } while (start++ != end);
+}
+private void jjCheckNAddTwoStates(int state1, int state2)
+{
+ jjCheckNAdd(state1);
+ jjCheckNAdd(state2);
+}
+
+private void jjCheckNAddStates(int start, int end)
+{
+ do {
+ jjCheckNAdd(jjnextStates[start]);
+ } while (start++ != end);
+}
+
+}
This was sent by the SourceForge.net collaborative development platform, the world's \
largest Open Source development site.
------------------------------------------------------------------------------
Subversion Kills Productivity. Get off Subversion & Make the Move to Perforce.
With Perforce, you get hassle-free workflows. Merge that actually works.
Faster operations. Version large binaries. Built-in WAN optimization and the
freedom to use Git, Perforce or both. Make the move to Perforce.
http://pubads.g.doubleclick.net/gampad/clk?id=122218951&iu=/4140/ostg.clktrk
_______________________________________________
jEdit-CVS mailing list
jEdit-CVS@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/jedit-cvs
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic