You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@turbine.apache.org by ju...@apache.org on 2002/02/20 23:03:00 UTC
cvs commit: jakarta-turbine-maven/src/java/org/apache/maven/jrcs/rcs ASCII_UCodeESC_CharStream.java Archive.java ArchiveParser.java ArchiveParserConstants.java ArchiveParserTokenManager.java BranchNode.java BranchNotFoundException.java HeadAlreadySetException.java InvalidBranchVersionNumberException.java InvalidFileFormatException.java InvalidTrunkVersionNumberException.java InvalidVersionNumberException.java Line.java Lines.java Node.java NodeNotFoundException.java ParseException.java Path.java Phrases.java RCSException.java Token.java TokenMgrError.java TrunkNode.java Version.java
juanco 02/02/20 14:03:00
Modified: src/java/org/apache/maven/jrcs/rcs
ASCII_UCodeESC_CharStream.java Archive.java
ArchiveParser.java ArchiveParserConstants.java
ArchiveParserTokenManager.java BranchNode.java
BranchNotFoundException.java
HeadAlreadySetException.java
InvalidBranchVersionNumberException.java
InvalidFileFormatException.java
InvalidTrunkVersionNumberException.java
InvalidVersionNumberException.java Line.java
Lines.java Node.java NodeNotFoundException.java
ParseException.java Path.java Phrases.java
RCSException.java Token.java TokenMgrError.java
TrunkNode.java Version.java
Log:
Removed the extra carriage return at the end of each line that somehow got
through in the original check in.
Revision Changes Path
1.2 +519 -519 jakarta-turbine-maven/src/java/org/apache/maven/jrcs/rcs/ASCII_UCodeESC_CharStream.java
Index: ASCII_UCodeESC_CharStream.java
===================================================================
RCS file: /home/cvs/jakarta-turbine-maven/src/java/org/apache/maven/jrcs/rcs/ASCII_UCodeESC_CharStream.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- ASCII_UCodeESC_CharStream.java 20 Feb 2002 16:20:03 -0000 1.1
+++ ASCII_UCodeESC_CharStream.java 20 Feb 2002 22:02:59 -0000 1.2
@@ -1,519 +1,519 @@
-package org.apache.maven.jrcs.rcs;
-
-/**
- * An implementation of interface CharStream, where the stream is assumed to
- * contain only ASCII characters (with java-like unicode escape processing).
- */
-
-public final class ASCII_UCodeESC_CharStream
-{
- public static final boolean staticFlag = false;
- static final int hexval(char c) throws java.io.IOException {
- switch(c)
- {
- case '0' :
- return 0;
- case '1' :
- return 1;
- case '2' :
- return 2;
- case '3' :
- return 3;
- case '4' :
- return 4;
- case '5' :
- return 5;
- case '6' :
- return 6;
- case '7' :
- return 7;
- case '8' :
- return 8;
- case '9' :
- return 9;
-
- case 'a' :
- case 'A' :
- return 10;
- case 'b' :
- case 'B' :
- return 11;
- case 'c' :
- case 'C' :
- return 12;
- case 'd' :
- case 'D' :
- return 13;
- case 'e' :
- case 'E' :
- return 14;
- case 'f' :
- case 'F' :
- return 15;
- }
-
- throw new java.io.IOException(); // Should never come here
- }
-
- public int bufpos = -1;
- int bufsize;
- int available;
- int tokenBegin;
- private int bufline[];
- private int bufcolumn[];
-
- private int column = 0;
- private int line = 1;
-
- private java.io.Reader inputStream;
-
- private boolean prevCharIsCR = false;
- private boolean prevCharIsLF = false;
-
- private char[] nextCharBuf;
- private char[] buffer;
- private int maxNextCharInd = 0;
- private int nextCharInd = -1;
- private int inBuf = 0;
-
- private final void ExpandBuff(boolean wrapAround)
- {
- 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;
-
- 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;
-
- 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(bufcolumn, tokenBegin, newbufcolumn, 0, bufsize - tokenBegin);
- bufcolumn = newbufcolumn;
-
- bufpos -= tokenBegin;
- }
- }
- catch (Throwable t)
- {
- throw new Error(t.getMessage());
- }
-
- available = (bufsize += 2048);
- tokenBegin = 0;
- }
-
- private final void FillBuff() throws java.io.IOException
- {
- int i;
- if (maxNextCharInd == 4096)
- maxNextCharInd = nextCharInd = 0;
-
- try {
- if ((i = inputStream.read(nextCharBuf, maxNextCharInd,
- 4096 - maxNextCharInd)) == -1)
- {
- inputStream.close();
- throw new java.io.IOException();
- }
- else
- maxNextCharInd += i;
- return;
- }
- catch(java.io.IOException e) {
- if (bufpos != 0)
- {
- --bufpos;
- backup(0);
- }
- else
- {
- bufline[bufpos] = line;
- bufcolumn[bufpos] = column;
- }
- throw e;
- }
- }
-
- private final char ReadByte() throws java.io.IOException
- {
- 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++;
-
- if (prevCharIsLF)
- {
- prevCharIsLF = false;
- 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 += (8 - (column & 07));
- break;
- default :
- break;
- }
-
- bufline[bufpos] = line;
- bufcolumn[bufpos] = column;
- }
-
- public final char readChar() throws java.io.IOException
- {
- if (inBuf > 0)
- {
- --inBuf;
- return buffer[(bufpos == bufsize - 1) ? (bufpos = 0) : ++bufpos];
- }
-
- char c;
-
- if (++bufpos == available)
- AdjustBuffSize();
-
- if (((buffer[bufpos] = c = (char)((char)0xff & ReadByte())) == '\\'))
- {
- UpdateLineColumn(c);
-
- int backSlashCnt = 1;
-
- for (;;) // Read all the backslashes
- {
- if (++bufpos == available)
- AdjustBuffSize();
-
- try
- {
- if ((buffer[bufpos] = c = (char)((char)0xff & ReadByte())) != '\\')
- {
- UpdateLineColumn(c);
- // found a non-backslash char.
- if ((c == 'u') && ((backSlashCnt & 1) == 1))
- {
- if (--bufpos < 0)
- bufpos = bufsize - 1;
-
- break;
- }
-
- backup(backSlashCnt);
- return '\\';
- }
- }
- catch(java.io.IOException e)
- {
- if (backSlashCnt > 1)
- backup(backSlashCnt);
-
- return '\\';
- }
-
- UpdateLineColumn(c);
- backSlashCnt++;
- }
-
- // 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;
- }
- catch(java.io.IOException e)
- {
- throw new Error("Invalid escape character at line " + line +
- " column " + column + ".");
- }
-
- if (backSlashCnt == 1)
- return c;
- else
- {
- backup(backSlashCnt - 1);
- return '\\';
- }
- }
- else
- {
- UpdateLineColumn(c);
- return (c);
- }
- }
-
- /**
- * @deprecated
- * @see #getEndColumn
- */
-
- public final int getColumn() {
- return bufcolumn[bufpos];
- }
-
- /**
- * @deprecated
- * @see #getEndLine
- */
-
- public final int getLine() {
- return bufline[bufpos];
- }
-
- public final int getEndColumn() {
- return bufcolumn[bufpos];
- }
-
- public final int getEndLine() {
- return bufline[bufpos];
- }
-
- public final int getBeginColumn() {
- return bufcolumn[tokenBegin];
- }
-
- public final int getBeginLine() {
- return bufline[tokenBegin];
- }
-
- public final void backup(int amount) {
-
- inBuf += amount;
- if ((bufpos -= amount) < 0)
- bufpos += bufsize;
- }
-
- public ASCII_UCodeESC_CharStream(java.io.Reader dstream,
- int startline, int startcolumn, int buffersize)
- {
- inputStream = dstream;
- line = startline;
- column = startcolumn - 1;
-
- available = bufsize = buffersize;
- buffer = new char[buffersize];
- bufline = new int[buffersize];
- bufcolumn = new int[buffersize];
- nextCharBuf = new char[4096];
- }
-
- public ASCII_UCodeESC_CharStream(java.io.Reader dstream,
- int startline, int startcolumn)
- {
- this(dstream, startline, startcolumn, 4096);
- }
- public void ReInit(java.io.Reader dstream,
- int startline, int startcolumn, int buffersize)
- {
- inputStream = dstream;
- line = startline;
- column = startcolumn - 1;
-
- if (buffer == null || buffersize != buffer.length)
- {
- available = bufsize = buffersize;
- buffer = new char[buffersize];
- bufline = new int[buffersize];
- 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,
- int startline, int startcolumn)
- {
- ReInit(dstream, startline, startcolumn, 4096);
- }
- public ASCII_UCodeESC_CharStream(java.io.InputStream dstream, int startline,
- int startcolumn, int buffersize)
- {
- this(new java.io.InputStreamReader(dstream), startline, startcolumn, 4096);
- }
-
- public ASCII_UCodeESC_CharStream(java.io.InputStream dstream, int startline,
- int startcolumn)
- {
- this(dstream, startline, startcolumn, 4096);
- }
-
- public void ReInit(java.io.InputStream dstream, int startline,
- int startcolumn, int buffersize)
- {
- ReInit(new java.io.InputStreamReader(dstream), startline, startcolumn, 4096);
- }
- public void ReInit(java.io.InputStream dstream, int startline,
- int startcolumn)
- {
- ReInit(dstream, startline, startcolumn, 4096);
- }
-
- public final 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);
- }
-
- public final char[] GetSuffix(int 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);
- }
-
- return ret;
- }
-
- public void Done()
- {
- nextCharBuf = null;
- buffer = null;
- bufline = null;
- bufcolumn = null;
- }
-
- /**
- * Method to adjust line and column numbers for the start of a token.<BR>
- */
- public void adjustBeginLineColumn(int newLine, int newCol)
- {
- int start = tokenBegin;
- int len;
-
- 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;
-
- 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;
-
- while (i++ < len)
- {
- if (bufline[j = start % bufsize] != bufline[++start % bufsize])
- bufline[j] = newLine++;
- else
- bufline[j] = newLine;
- }
- }
-
- line = bufline[j];
- column = bufcolumn[j];
- }
-
-}
+package org.apache.maven.jrcs.rcs;
+
+/**
+ * An implementation of interface CharStream, where the stream is assumed to
+ * contain only ASCII characters (with java-like unicode escape processing).
+ */
+
+public final class ASCII_UCodeESC_CharStream
+{
+ public static final boolean staticFlag = false;
+ static final int hexval(char c) throws java.io.IOException {
+ switch(c)
+ {
+ case '0' :
+ return 0;
+ case '1' :
+ return 1;
+ case '2' :
+ return 2;
+ case '3' :
+ return 3;
+ case '4' :
+ return 4;
+ case '5' :
+ return 5;
+ case '6' :
+ return 6;
+ case '7' :
+ return 7;
+ case '8' :
+ return 8;
+ case '9' :
+ return 9;
+
+ case 'a' :
+ case 'A' :
+ return 10;
+ case 'b' :
+ case 'B' :
+ return 11;
+ case 'c' :
+ case 'C' :
+ return 12;
+ case 'd' :
+ case 'D' :
+ return 13;
+ case 'e' :
+ case 'E' :
+ return 14;
+ case 'f' :
+ case 'F' :
+ return 15;
+ }
+
+ throw new java.io.IOException(); // Should never come here
+ }
+
+ public int bufpos = -1;
+ int bufsize;
+ int available;
+ int tokenBegin;
+ private int bufline[];
+ private int bufcolumn[];
+
+ private int column = 0;
+ private int line = 1;
+
+ private java.io.Reader inputStream;
+
+ private boolean prevCharIsCR = false;
+ private boolean prevCharIsLF = false;
+
+ private char[] nextCharBuf;
+ private char[] buffer;
+ private int maxNextCharInd = 0;
+ private int nextCharInd = -1;
+ private int inBuf = 0;
+
+ private final void ExpandBuff(boolean wrapAround)
+ {
+ 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;
+
+ 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;
+
+ 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(bufcolumn, tokenBegin, newbufcolumn, 0, bufsize - tokenBegin);
+ bufcolumn = newbufcolumn;
+
+ bufpos -= tokenBegin;
+ }
+ }
+ catch (Throwable t)
+ {
+ throw new Error(t.getMessage());
+ }
+
+ available = (bufsize += 2048);
+ tokenBegin = 0;
+ }
+
+ private final void FillBuff() throws java.io.IOException
+ {
+ int i;
+ if (maxNextCharInd == 4096)
+ maxNextCharInd = nextCharInd = 0;
+
+ try {
+ if ((i = inputStream.read(nextCharBuf, maxNextCharInd,
+ 4096 - maxNextCharInd)) == -1)
+ {
+ inputStream.close();
+ throw new java.io.IOException();
+ }
+ else
+ maxNextCharInd += i;
+ return;
+ }
+ catch(java.io.IOException e) {
+ if (bufpos != 0)
+ {
+ --bufpos;
+ backup(0);
+ }
+ else
+ {
+ bufline[bufpos] = line;
+ bufcolumn[bufpos] = column;
+ }
+ throw e;
+ }
+ }
+
+ private final char ReadByte() throws java.io.IOException
+ {
+ 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++;
+
+ if (prevCharIsLF)
+ {
+ prevCharIsLF = false;
+ 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 += (8 - (column & 07));
+ break;
+ default :
+ break;
+ }
+
+ bufline[bufpos] = line;
+ bufcolumn[bufpos] = column;
+ }
+
+ public final char readChar() throws java.io.IOException
+ {
+ if (inBuf > 0)
+ {
+ --inBuf;
+ return buffer[(bufpos == bufsize - 1) ? (bufpos = 0) : ++bufpos];
+ }
+
+ char c;
+
+ if (++bufpos == available)
+ AdjustBuffSize();
+
+ if (((buffer[bufpos] = c = (char)((char)0xff & ReadByte())) == '\\'))
+ {
+ UpdateLineColumn(c);
+
+ int backSlashCnt = 1;
+
+ for (;;) // Read all the backslashes
+ {
+ if (++bufpos == available)
+ AdjustBuffSize();
+
+ try
+ {
+ if ((buffer[bufpos] = c = (char)((char)0xff & ReadByte())) != '\\')
+ {
+ UpdateLineColumn(c);
+ // found a non-backslash char.
+ if ((c == 'u') && ((backSlashCnt & 1) == 1))
+ {
+ if (--bufpos < 0)
+ bufpos = bufsize - 1;
+
+ break;
+ }
+
+ backup(backSlashCnt);
+ return '\\';
+ }
+ }
+ catch(java.io.IOException e)
+ {
+ if (backSlashCnt > 1)
+ backup(backSlashCnt);
+
+ return '\\';
+ }
+
+ UpdateLineColumn(c);
+ backSlashCnt++;
+ }
+
+ // 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;
+ }
+ catch(java.io.IOException e)
+ {
+ throw new Error("Invalid escape character at line " + line +
+ " column " + column + ".");
+ }
+
+ if (backSlashCnt == 1)
+ return c;
+ else
+ {
+ backup(backSlashCnt - 1);
+ return '\\';
+ }
+ }
+ else
+ {
+ UpdateLineColumn(c);
+ return (c);
+ }
+ }
+
+ /**
+ * @deprecated
+ * @see #getEndColumn
+ */
+
+ public final int getColumn() {
+ return bufcolumn[bufpos];
+ }
+
+ /**
+ * @deprecated
+ * @see #getEndLine
+ */
+
+ public final int getLine() {
+ return bufline[bufpos];
+ }
+
+ public final int getEndColumn() {
+ return bufcolumn[bufpos];
+ }
+
+ public final int getEndLine() {
+ return bufline[bufpos];
+ }
+
+ public final int getBeginColumn() {
+ return bufcolumn[tokenBegin];
+ }
+
+ public final int getBeginLine() {
+ return bufline[tokenBegin];
+ }
+
+ public final void backup(int amount) {
+
+ inBuf += amount;
+ if ((bufpos -= amount) < 0)
+ bufpos += bufsize;
+ }
+
+ public ASCII_UCodeESC_CharStream(java.io.Reader dstream,
+ int startline, int startcolumn, int buffersize)
+ {
+ inputStream = dstream;
+ line = startline;
+ column = startcolumn - 1;
+
+ available = bufsize = buffersize;
+ buffer = new char[buffersize];
+ bufline = new int[buffersize];
+ bufcolumn = new int[buffersize];
+ nextCharBuf = new char[4096];
+ }
+
+ public ASCII_UCodeESC_CharStream(java.io.Reader dstream,
+ int startline, int startcolumn)
+ {
+ this(dstream, startline, startcolumn, 4096);
+ }
+ public void ReInit(java.io.Reader dstream,
+ int startline, int startcolumn, int buffersize)
+ {
+ inputStream = dstream;
+ line = startline;
+ column = startcolumn - 1;
+
+ if (buffer == null || buffersize != buffer.length)
+ {
+ available = bufsize = buffersize;
+ buffer = new char[buffersize];
+ bufline = new int[buffersize];
+ 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,
+ int startline, int startcolumn)
+ {
+ ReInit(dstream, startline, startcolumn, 4096);
+ }
+ public ASCII_UCodeESC_CharStream(java.io.InputStream dstream, int startline,
+ int startcolumn, int buffersize)
+ {
+ this(new java.io.InputStreamReader(dstream), startline, startcolumn, 4096);
+ }
+
+ public ASCII_UCodeESC_CharStream(java.io.InputStream dstream, int startline,
+ int startcolumn)
+ {
+ this(dstream, startline, startcolumn, 4096);
+ }
+
+ public void ReInit(java.io.InputStream dstream, int startline,
+ int startcolumn, int buffersize)
+ {
+ ReInit(new java.io.InputStreamReader(dstream), startline, startcolumn, 4096);
+ }
+ public void ReInit(java.io.InputStream dstream, int startline,
+ int startcolumn)
+ {
+ ReInit(dstream, startline, startcolumn, 4096);
+ }
+
+ public final 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);
+ }
+
+ public final char[] GetSuffix(int 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);
+ }
+
+ return ret;
+ }
+
+ public void Done()
+ {
+ nextCharBuf = null;
+ buffer = null;
+ bufline = null;
+ bufcolumn = null;
+ }
+
+ /**
+ * Method to adjust line and column numbers for the start of a token.<BR>
+ */
+ public void adjustBeginLineColumn(int newLine, int newCol)
+ {
+ int start = tokenBegin;
+ int len;
+
+ 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;
+
+ 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;
+
+ while (i++ < len)
+ {
+ if (bufline[j = start % bufsize] != bufline[++start % bufsize])
+ bufline[j] = newLine++;
+ else
+ bufline[j] = newLine;
+ }
+ }
+
+ line = bufline[j];
+ column = bufcolumn[j];
+ }
+
+}
1.2 +642 -642 jakarta-turbine-maven/src/java/org/apache/maven/jrcs/rcs/Archive.java
Index: Archive.java
===================================================================
RCS file: /home/cvs/jakarta-turbine-maven/src/java/org/apache/maven/jrcs/rcs/Archive.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- Archive.java 20 Feb 2002 16:20:03 -0000 1.1
+++ Archive.java 20 Feb 2002 22:02:59 -0000 1.2
@@ -1,642 +1,642 @@
-package org.apache.maven.jrcs.rcs;
-
-import org.apache.maven.jrcs.diff.Diff;
-
-import gnu.regexp.*;
-
-import java.util.*;
-import java.text.Format;
-import java.text.DateFormat;
-import java.text.SimpleDateFormat;
-import java.text.MessageFormat;
-
-public class Archive
-extends org.apache.maven.jrcs.util.ToString
-{
- public static final String RCS_NEWLINE = "\0x0A";
-
- protected TrunkNode _head;
- protected Version _branch;
- protected Map _nodes = new TreeMap(); //!!! check Node.compareTo for correct RCS order
- protected Set _users = new TreeSet();
- protected Set _locked = new TreeSet();
- protected Map _symbols = new TreeMap();
- protected Phrases _phrases = new Phrases();
- protected String _desc = new String();
- protected boolean _strictLocking = true;
- protected String _expand;
- protected String _comment = "# ";
- protected String _filename = "?,v";
-
-
- /**
- * Creates a new archive and sets the text of the initial revision.
- * @param text The text of the initial revision.
- * @param desc The archives description (not the log message).
- */
- public Archive(Object[] text, String desc) {
- this(text, desc, new Version(1,1));
- }
-
- /**
- * Creates a new archive with the specified initial version number
- * and sets the text of the initial revision.
- * The initila revision must be of the form "n.m" (i.e. a trunk revision).
- * @param text The text of the initial revision.
- * @param desc The archives description (not the log message).
- * @param vernum The initial revision number.
- */
- public Archive(Object[] text, String desc, String vernum) {
- this(text, desc, new Version(vernum));
- }
-
- /**
- * Creates a new archive with the specified initial version number
- * and sets the text of the initial revision.
- * The initila revision must be of the form "n.m" (i.e. a trunk revision).
- * @param text The text of the initial revision.
- * @param desc The archives description (not the log message).
- * @param vernum The initial revision number.
- */
- protected Archive(Object[] text, String desc, Version vernum) {
- // can only add a trunk version
- if (vernum.size() > 2)
- throw new InvalidVersionNumberException(vernum + " must be a trunk version");
- while (vernum.size() < 2)
- vernum = vernum.newBranch(1);
- // now add the _head node
- this._head = (TrunkNode) newNode(vernum, null);
- this._head.setText(text);
- this._head.setLog("Initial revision\n");
- this.setDesc(desc);
- }
-
- /**
- * Load an archive from an input stream.
- * Parses the archive given by the input stream, and gives it the provided name.
- * @param fname The name to give to the archive.
- * @param input Where to read the archive from
- */
- public Archive(String fname, java.io.InputStream input) throws ParseException {
- this._filename = fname;
- ArchiveParser.load(this, input);
- }
-
- /**
- * Load an archive from an a file given by name.
- * @param path The path to the file wher the archive resides.
- */
- public Archive(String path) throws ParseException, java.io.FileNotFoundException {
- this._filename = new java.io.File(path).getPath();
- ArchiveParser.load(this, this._filename);
- }
-
- /**
- * Create an unitialized Archive.
- * Used internally by the ArchiveParser.
- * @see ArchiveParser
- */
- Archive() {
- }
-
- public void save(java.io.OutputStream output)
- throws java.io.IOException
- {
- new java.io.OutputStreamWriter(output).write(
- toString(Archive.RCS_NEWLINE).toCharArray()
- );
- }
-
- public void save(String path)
- throws java.io.IOException
- {
- save(new java.io.FileOutputStream(path));
- this._filename = new java.io.File(path).getPath();
- }
-
- protected void setHead(Version vernum) throws InvalidVersionNumberException {
- if (_head != null)
- throw new HeadAlreadySetException(_head.version);
- _head = new TrunkNode(vernum, null);
- _nodes.put(vernum, _head);
- }
-
- public void setBranch(String v) throws InvalidBranchVersionNumberException {
- setBranch(new Version(v));
- }
-
- public void setBranch(Version vernum) throws InvalidBranchVersionNumberException {
- if (!vernum.isBranch())
- throw new InvalidBranchVersionNumberException(vernum);
- if (_head == null || vernum.getBase(2).isGreaterThan(_head.version))
- throw new InvalidBranchVersionNumberException(vernum + "is greater than _head version " + _head.version);
- _branch = vernum;
- }
-
- public void addUser(String name) {
- _users.add(name);
- }
-
- public void addSymbol(String sym, Version vernum) throws InvalidVersionNumberException {
- _symbols.put(sym, vernum);
- }
-
- public void addLock(String user, Version vernum)
- throws InvalidVersionNumberException,
- NodeNotFoundException
- {
- addUser(user);
- Node node = newNode(vernum);
- node.setLocker(user);
- if (user == null)
- _locked.remove(node);
- else
- _locked.add(node);
- }
-
- public void setStrictLocking(boolean value) {
- _strictLocking = value;
- }
-
- public void setExpand(String value) {
- _expand = value;
- }
-
- public void setComment(String value) {
- _comment = value;
- }
-
- public void setDesc(String value) {
- _desc = value;
- }
-
- public void addPhrase(String key, Collection values) {
- _phrases.put(key, values);
- }
-
- protected Node getNode(Version vernum)
- throws InvalidVersionNumberException,
- NodeNotFoundException
- {
- if (!vernum.even())
- throw new InvalidVersionNumberException(vernum);
- Node node = (Node) _nodes.get(vernum);
- if (node == null)
- throw new NodeNotFoundException();
- else
- return node;
- }
-
- protected Node newNode(Version vernum) {
- return newNode(vernum, null);
- }
-
- protected Node newNode(Version vernum, Node prev)
- throws InvalidVersionNumberException,
- NodeNotFoundException
- {
- if (!vernum.isRevision())
- throw new InvalidVersionNumberException(vernum);
- Node node = (Node) _nodes.get(vernum);
- if (node == null) {
- node = Node.newNode(vernum, prev);
- _nodes.put(vernum, node);
- }
- return node;
- }
-
- protected TrunkNode newTrunkNode(Version vernum)
- throws InvalidVersionNumberException,
- NodeNotFoundException
- {
- if (!vernum.isTrunk())
- throw new InvalidTrunkVersionNumberException(vernum);
- return (TrunkNode) newNode(vernum);
- }
-
- protected BranchNode newBranchNode(Version vernum)
- throws InvalidVersionNumberException,
- NodeNotFoundException
- {
- if (!vernum.isBranch())
- throw new InvalidBranchVersionNumberException(vernum);
- return (BranchNode) newNode(vernum);
- }
-
- protected Node findNode(Version vernum)
- throws InvalidVersionNumberException,
- NodeNotFoundException
- {
- if (!vernum.isRevision())
- throw new InvalidVersionNumberException(vernum);
- Node node = (Node) _nodes.get(vernum);
- if (node == null)
- throw new NodeNotFoundException(vernum);
- return node;
- }
-
- public void toString(StringBuffer s) {
- toString(s, "\n");
- }
-
- public String toString(String EOL) {
- StringBuffer s = new StringBuffer();
- toString(s, EOL);
- return s.toString();
- }
-
- protected Path getRevisionPath(Version vernum)
- {
- if (_head == null)
- return null;
- try {
- Path path = _head.pathTo(vernum, true);
- Node revisionFound = path.last();
- if (revisionFound == null)
- return null;
- if (revisionFound.version.isLessThan(vernum))
- return null;
- return path;
- }
- catch(NodeNotFoundException e) {
- return null;
- }
- }
-
- public Version getRevisionVersion(Version vernum)
- {
- Path path = getRevisionPath(vernum);
- return (path == null ? null : path.last().version);
- }
-
- public Version getRevisionVersion(String v)
- {
- return getRevisionVersion(new Version(v));
- }
-
- public Version getRevisionVersion()
- {
- if (_branch != null)
- return getRevisionVersion(_branch);
- else if (_head != null)
- return _head.version;
- else
- return null;
- }
-
- public void toString(StringBuffer s, String EOL) {
- String EOI = ";"+EOL;
- String NLT = EOL + "\t";
-
- s.append("head");
- if (_head != null) {
- s.append("\t");
- _head.version.toString(s);
- }
- s.append(EOI);
-
- if (_branch != null) {
- s.append("branch\t");
- s.append(_branch.toString());
- s.append(EOI);
- }
-
- s.append("access");
- for(Iterator i = _users.iterator(); i.hasNext(); ) {
- s.append(EOL);
- s.append("\t");
- s.append(i.next());
- }
- s.append(EOI);
-
- s.append("symbols");
- for(Iterator i = _symbols.entrySet().iterator(); i.hasNext(); ) {
- Map.Entry e = (Map.Entry) i.next();
- s.append(NLT);
- s.append(e.getKey().toString());
- s.append(":");
- s.append(e.getValue().toString());
- }
- s.append(EOI);
-
- s.append("locks");
- for(Iterator i = _locked.iterator(); i.hasNext(); ) {
- String locker = ((Node) i.next())._locker;
- s.append(NLT);
- s.append(locker);
- }
- if (_strictLocking)
- s.append("; strict");
- s.append(EOI);
-
- if (_comment != null) {
- s.append("comment\t");
- s.append(Archive.quoteString(_comment));
- s.append(EOI);
- }
-
- if (_expand != null) {
- s.append("expand\t");
- s.append(Archive.quoteString(_expand));
- s.append(EOI);
- }
-
- if (_phrases != null)
- _phrases.toString(s, EOL);
- s.append(EOL);
-
- for(Iterator i = _nodes.values().iterator(); i.hasNext(); ) {
- Node n = (Node) i.next();
- if (!n.version.isGhost() && n._text != null)
- n.toString(s, EOL);
- }
-
- s.append(EOL + EOL);
- s.append("desc");
- s.append(EOL);
- s.append(quoteString(_desc));
- s.append(EOL);
-
- Node n = _head;
- while (n != null) {
- n.toText(s, EOL);
- n = n.getNext();
- }
- }
-
- static public String quoteString(String s) {
- //!!! use org.apache.maven.jrcs.RegExp here !!!
- StringBuffer result = new StringBuffer(s);
- for(int i = 0; i < s.length(); i++) {
- if (result.charAt(i) == '@')
- result.insert(i++, '@');
- }
- result.insert(0,'@');
- result.append('@');
- return new String(result);
- }
-
- static public String unquoteString(String s) {
- return unquoteString(s, true);
- }
-
- static public String unquoteString(String s, boolean removeExtremes) {
- //!!! use org.apache.maven.jrcs.RegExp here !!!
- //!!! always ignore extremes. Check they are @'s, though.
- StringBuffer result = new StringBuffer();
- int start = 0;
- int end = s.length();
- if (removeExtremes) {
- start += 1;
- end -= 1;
- }
- for(int i = start; i < end; i++) {
- char c = s.charAt(i);
- result.append(c);
- if (c == '@')
- i++;
- }
- return new String(result);
- }
-
- public Object[] getRevision()
- throws InvalidFileFormatException,
- org.apache.maven.jrcs.diff.DiffException,
- NodeNotFoundException
- {
- return getRevision(false);
- }
-
- public Object[] getRevision(boolean annotate)
- throws InvalidFileFormatException,
- org.apache.maven.jrcs.diff.DiffException,
- NodeNotFoundException
- {
- if (_branch != null)
- return getRevision(_branch);
- else if (_head != null)
- return getRevision(_head.version);
- else
- throw new IllegalStateException("no head node");
- }
-
- public Object[] getRevision(String v)
- throws InvalidFileFormatException,
- org.apache.maven.jrcs.diff.PatchFailedException,
- InvalidVersionNumberException,
- NodeNotFoundException
- {
- return getRevision(v, false);
- }
-
- public Object[] getRevision(String v, boolean annotate)
- throws InvalidVersionNumberException,
- NodeNotFoundException,
- InvalidFileFormatException,
- org.apache.maven.jrcs.diff.PatchFailedException
- {
- return getRevision(new Version(v), annotate);
- }
-
- public Object[] getRevision(Version vernum)
- throws InvalidFileFormatException,
- org.apache.maven.jrcs.diff.PatchFailedException,
- NodeNotFoundException
- {
- return getRevision(vernum, false);
- }
-
- public Object[] getRevision(Version vernum, boolean annotate)
- throws InvalidFileFormatException,
- org.apache.maven.jrcs.diff.PatchFailedException,
- NodeNotFoundException
- {
- Path path = getRevisionPath(vernum);
- if (path == null)
- throw new NodeNotFoundException(vernum);
- Lines lines = new Lines();
- Node revisionFound = path.last();
- path.patch(lines, annotate);
-
- return doKeywords(lines.toArray(), revisionFound);
- }
-
- public Version addRevision(Object[] text, String log)
- throws InvalidFileFormatException,
- org.apache.maven.jrcs.diff.DiffException,
- InvalidVersionNumberException,
- NodeNotFoundException
- {
- if (_branch != null)
- return addRevision(text, _branch, log);
- else
- return addRevision(text, _head.version.next(), log);
- }
-
- public Version addRevision(Object[] text, String vernum, String log)
- throws InvalidFileFormatException,
- org.apache.maven.jrcs.diff.DiffException,
- InvalidVersionNumberException,
- NodeNotFoundException
- {
- return addRevision(text, new Version(vernum), log);
- }
-
- public Version addRevision(Object[] text, Version vernum, String log)
- throws InvalidFileFormatException,
- org.apache.maven.jrcs.diff.DiffException,
- NodeNotFoundException,
- InvalidVersionNumberException
- {
- if (_head == null)
- throw new IllegalStateException("no _head node");
-
- Path path = _head.pathTo(vernum, true);
- Node target = path.last();
-
- if (vernum.size() < target.version.size())
- vernum = target.nextVersion();
- else if (!vernum.isGreaterThan(target.version))
- throw new InvalidVersionNumberException(vernum + " revision must be higher than " + target.version);
- else if (vernum.odd())
- if (vernum.last() == 0)
- vernum = target.newBranchVersion();
- else
- vernum = vernum.newBranch(1);
- else if (vernum.last() == 0)
- vernum = vernum.next();
-
- boolean headAdd = (target == _head && !vernum.isBranch());
-
- text = removeKeywords(text);
- String deltaText;
- if (headAdd)
- deltaText = Diff.diff(text, _head._text).toRCSString();
- else {
- Object[] oldText = path.patch().toArray();
- deltaText = Diff.diff(oldText, text).toRCSString();
- }
- if (deltaText.length() == 0)
- return null; // no changes, no new version
-
- Node newNode = null;
- if (headAdd) {
- newNode = newNode(vernum, _head);
- newNode.setText(text);
- _head.setText(deltaText);
- _head = (TrunkNode) newNode;
- }
- else { // adding a branch node
- newNode = newNode(vernum);
- newNode.setText(deltaText);
- if (vernum.size() > target.version.size())
- target.addBranch((BranchNode) newNode);
- else
- target.setRCSNext(newNode);
- }
- newNode.setLog(log);
- return newNode.version;
- }
-
- protected static final Format Header_FORMAT =
- new MessageFormat("Header: {1} {2} {3, date,yyyy/MM/dd HH:mm:ss} {4} {5} ");
- protected static final Format Id_FORMAT =
- new MessageFormat("Id: {1} {2} {3, date,yyyy/MM/dd HH:mm:ss} {4} {5} ");
- protected static final Format RCSFile_FORMAT =
- new MessageFormat("RCSfile: {1} ");
- protected static final Format Revision_FORMAT =
- new MessageFormat("Revision: {2} ");
- protected static final Format Date_FORMAT =
- new MessageFormat("Date: {3, date,yyyy/MM/dd HH:mm:ss} ");
- protected static final Format Author_FORMAT =
- new MessageFormat("Author: {4} ");
- protected static final Format State_FORMAT =
- new MessageFormat("State: {5} ");
- protected static final Format Locker_FORMAT =
- new MessageFormat("Locker: {6} ");
- protected static final Format Source_FORMAT =
- new MessageFormat("Source: {0} ");
-
- protected static RE Id_re;
- protected static RE Header_re;
- protected static RE Source_re;
- protected static RE RCSfile_re;
- protected static RE Revision_re;
- protected static RE Date_re;
- protected static RE Author_re;
- protected static RE State_re;
- protected static RE Locker_re;
-
- static void makeRegularExpressions() throws org.apache.maven.jrcs.diff.PatchFailedException
- {
- if (Locker_re != null)
- return;
- try {
- Id_re = new RE("\\$Id(:[^\\$]*)?\\$" );
- Header_re = new RE("\\$Header(:[^\\$]*)?\\$" );
- Source_re = new RE("\\$Source(:[^\\$]*)?\\$" );
- RCSfile_re = new RE("\\$RCSfile(:[^\\$]*)?\\$" );
- Revision_re = new RE("\\$Revision(:[^\\$]*)?\\$" );
- Date_re = new RE("\\$Date(:[^\\$]*)?\\$" );
- Author_re = new RE("\\$Author(:[^\\$]*)?\\$" );
- State_re = new RE("\\$State(:[^\\$]*)?\\$" );
- Locker_re = new RE("\\$Locker(:[^\\$]*)?\\$" );
- }
- catch(REException e) {
- throw new org.apache.maven.jrcs.diff.PatchFailedException(e.getMessage());
- }
- }
-
- public Object[] doKeywords(Object[] text, Node rev)
- throws org.apache.maven.jrcs.diff.PatchFailedException
- {
- Object[] revisionInfo = new Object[] {
- _filename,
- new java.io.File(_filename).getName(),
- rev.version.toString(),
- rev._date,
- rev._author,
- rev._state,
- rev._locker
- };
-
- makeRegularExpressions();
- Object[] result = new Object[text.length];
- for(int i = 0; i < text.length; i++) {
- result[i] = Id_re .substituteAll(text[i], "$"+Id_FORMAT.format(revisionInfo)+"$");
- result[i] = Header_re .substituteAll(text[i], "$"+Header_FORMAT.format(revisionInfo)+"$");
- result[i] = Source_re .substituteAll(text[i], "$"+Source_FORMAT.format(revisionInfo)+"$");
- result[i] = RCSfile_re .substituteAll(text[i], "$"+RCSFile_FORMAT.format(revisionInfo)+"$");
- result[i] = Revision_re .substituteAll(text[i], "$"+Revision_FORMAT.format(revisionInfo)+"$");
- result[i] = Date_re .substituteAll(text[i], "$"+Date_FORMAT.format(revisionInfo)+"$");
- result[i] = Author_re .substituteAll(text[i], "$"+Author_FORMAT.format(revisionInfo)+"$");
- result[i] = State_re .substituteAll(text[i], "$"+State_FORMAT.format(revisionInfo)+"$");
- result[i] = Locker_re .substituteAll(text[i], "$"+Locker_FORMAT.format(revisionInfo)+"$");
- //@TODO: should do something about Name and Log
- }
- return result;
- }
-
- protected static Object[] removeKeywords(Object[] text)
- throws org.apache.maven.jrcs.diff.PatchFailedException
- {
- makeRegularExpressions();
- Object[] result = new Object[text.length];
- for(int i = 0; i < text.length; i++) {
- result[i] = Id_re .substituteAll(text[i], "$"+"Id"+"$");
- result[i] = Header_re .substituteAll(text[i], "$"+"Header"+"$");
- result[i] = Source_re .substituteAll(text[i], "$"+"Source"+"$");
- result[i] = RCSfile_re .substituteAll(text[i], "$"+"RCSFile"+"$");
- result[i] = Revision_re .substituteAll(text[i], "$"+"Revision"+"$");
- result[i] = Date_re .substituteAll(text[i], "$"+"Date"+"$");
- result[i] = Author_re .substituteAll(text[i], "$"+"Author"+"$");
- result[i] = State_re .substituteAll(text[i], "$"+"State"+"$");
- result[i] = Locker_re .substituteAll(text[i], "$"+"Locker"+"$");
- //@TODO: should do something about Name and Log
- }
- return result;
- }
-
-}
-
-
+package org.apache.maven.jrcs.rcs;
+
+import org.apache.maven.jrcs.diff.Diff;
+
+import gnu.regexp.*;
+
+import java.util.*;
+import java.text.Format;
+import java.text.DateFormat;
+import java.text.SimpleDateFormat;
+import java.text.MessageFormat;
+
+public class Archive
+extends org.apache.maven.jrcs.util.ToString
+{
+ public static final String RCS_NEWLINE = "\0x0A";
+
+ protected TrunkNode _head;
+ protected Version _branch;
+ protected Map _nodes = new TreeMap(); //!!! check Node.compareTo for correct RCS order
+ protected Set _users = new TreeSet();
+ protected Set _locked = new TreeSet();
+ protected Map _symbols = new TreeMap();
+ protected Phrases _phrases = new Phrases();
+ protected String _desc = new String();
+ protected boolean _strictLocking = true;
+ protected String _expand;
+ protected String _comment = "# ";
+ protected String _filename = "?,v";
+
+
+ /**
+ * Creates a new archive and sets the text of the initial revision.
+ * @param text The text of the initial revision.
+ * @param desc The archives description (not the log message).
+ */
+ public Archive(Object[] text, String desc) {
+ this(text, desc, new Version(1,1));
+ }
+
+ /**
+ * Creates a new archive with the specified initial version number
+ * and sets the text of the initial revision.
+ * The initila revision must be of the form "n.m" (i.e. a trunk revision).
+ * @param text The text of the initial revision.
+ * @param desc The archives description (not the log message).
+ * @param vernum The initial revision number.
+ */
+ public Archive(Object[] text, String desc, String vernum) {
+ this(text, desc, new Version(vernum));
+ }
+
+ /**
+ * Creates a new archive with the specified initial version number
+ * and sets the text of the initial revision.
+ * The initila revision must be of the form "n.m" (i.e. a trunk revision).
+ * @param text The text of the initial revision.
+ * @param desc The archives description (not the log message).
+ * @param vernum The initial revision number.
+ */
+ protected Archive(Object[] text, String desc, Version vernum) {
+ // can only add a trunk version
+ if (vernum.size() > 2)
+ throw new InvalidVersionNumberException(vernum + " must be a trunk version");
+ while (vernum.size() < 2)
+ vernum = vernum.newBranch(1);
+ // now add the _head node
+ this._head = (TrunkNode) newNode(vernum, null);
+ this._head.setText(text);
+ this._head.setLog("Initial revision\n");
+ this.setDesc(desc);
+ }
+
+ /**
+ * Load an archive from an input stream.
+ * Parses the archive given by the input stream, and gives it the provided name.
+ * @param fname The name to give to the archive.
+ * @param input Where to read the archive from
+ */
+ public Archive(String fname, java.io.InputStream input) throws ParseException {
+ this._filename = fname;
+ ArchiveParser.load(this, input);
+ }
+
+ /**
+ * Load an archive from an a file given by name.
+ * @param path The path to the file wher the archive resides.
+ */
+ public Archive(String path) throws ParseException, java.io.FileNotFoundException {
+ this._filename = new java.io.File(path).getPath();
+ ArchiveParser.load(this, this._filename);
+ }
+
+ /**
+ * Create an unitialized Archive.
+ * Used internally by the ArchiveParser.
+ * @see ArchiveParser
+ */
+ Archive() {
+ }
+
+ public void save(java.io.OutputStream output)
+ throws java.io.IOException
+ {
+ new java.io.OutputStreamWriter(output).write(
+ toString(Archive.RCS_NEWLINE).toCharArray()
+ );
+ }
+
+ public void save(String path)
+ throws java.io.IOException
+ {
+ save(new java.io.FileOutputStream(path));
+ this._filename = new java.io.File(path).getPath();
+ }
+
+ protected void setHead(Version vernum) throws InvalidVersionNumberException {
+ if (_head != null)
+ throw new HeadAlreadySetException(_head.version);
+ _head = new TrunkNode(vernum, null);
+ _nodes.put(vernum, _head);
+ }
+
+ public void setBranch(String v) throws InvalidBranchVersionNumberException {
+ setBranch(new Version(v));
+ }
+
+ public void setBranch(Version vernum) throws InvalidBranchVersionNumberException {
+ if (!vernum.isBranch())
+ throw new InvalidBranchVersionNumberException(vernum);
+ if (_head == null || vernum.getBase(2).isGreaterThan(_head.version))
+ throw new InvalidBranchVersionNumberException(vernum + "is greater than _head version " + _head.version);
+ _branch = vernum;
+ }
+
+ public void addUser(String name) {
+ _users.add(name);
+ }
+
+ public void addSymbol(String sym, Version vernum) throws InvalidVersionNumberException {
+ _symbols.put(sym, vernum);
+ }
+
+ public void addLock(String user, Version vernum)
+ throws InvalidVersionNumberException,
+ NodeNotFoundException
+ {
+ addUser(user);
+ Node node = newNode(vernum);
+ node.setLocker(user);
+ if (user == null)
+ _locked.remove(node);
+ else
+ _locked.add(node);
+ }
+
+ public void setStrictLocking(boolean value) {
+ _strictLocking = value;
+ }
+
+ public void setExpand(String value) {
+ _expand = value;
+ }
+
+ public void setComment(String value) {
+ _comment = value;
+ }
+
+ public void setDesc(String value) {
+ _desc = value;
+ }
+
+ public void addPhrase(String key, Collection values) {
+ _phrases.put(key, values);
+ }
+
+ protected Node getNode(Version vernum)
+ throws InvalidVersionNumberException,
+ NodeNotFoundException
+ {
+ if (!vernum.even())
+ throw new InvalidVersionNumberException(vernum);
+ Node node = (Node) _nodes.get(vernum);
+ if (node == null)
+ throw new NodeNotFoundException();
+ else
+ return node;
+ }
+
+ protected Node newNode(Version vernum) {
+ return newNode(vernum, null);
+ }
+
+ protected Node newNode(Version vernum, Node prev)
+ throws InvalidVersionNumberException,
+ NodeNotFoundException
+ {
+ if (!vernum.isRevision())
+ throw new InvalidVersionNumberException(vernum);
+ Node node = (Node) _nodes.get(vernum);
+ if (node == null) {
+ node = Node.newNode(vernum, prev);
+ _nodes.put(vernum, node);
+ }
+ return node;
+ }
+
+ protected TrunkNode newTrunkNode(Version vernum)
+ throws InvalidVersionNumberException,
+ NodeNotFoundException
+ {
+ if (!vernum.isTrunk())
+ throw new InvalidTrunkVersionNumberException(vernum);
+ return (TrunkNode) newNode(vernum);
+ }
+
+ protected BranchNode newBranchNode(Version vernum)
+ throws InvalidVersionNumberException,
+ NodeNotFoundException
+ {
+ if (!vernum.isBranch())
+ throw new InvalidBranchVersionNumberException(vernum);
+ return (BranchNode) newNode(vernum);
+ }
+
+ protected Node findNode(Version vernum)
+ throws InvalidVersionNumberException,
+ NodeNotFoundException
+ {
+ if (!vernum.isRevision())
+ throw new InvalidVersionNumberException(vernum);
+ Node node = (Node) _nodes.get(vernum);
+ if (node == null)
+ throw new NodeNotFoundException(vernum);
+ return node;
+ }
+
+ public void toString(StringBuffer s) {
+ toString(s, "\n");
+ }
+
+ public String toString(String EOL) {
+ StringBuffer s = new StringBuffer();
+ toString(s, EOL);
+ return s.toString();
+ }
+
+ protected Path getRevisionPath(Version vernum)
+ {
+ if (_head == null)
+ return null;
+ try {
+ Path path = _head.pathTo(vernum, true);
+ Node revisionFound = path.last();
+ if (revisionFound == null)
+ return null;
+ if (revisionFound.version.isLessThan(vernum))
+ return null;
+ return path;
+ }
+ catch(NodeNotFoundException e) {
+ return null;
+ }
+ }
+
+ public Version getRevisionVersion(Version vernum)
+ {
+ Path path = getRevisionPath(vernum);
+ return (path == null ? null : path.last().version);
+ }
+
+ public Version getRevisionVersion(String v)
+ {
+ return getRevisionVersion(new Version(v));
+ }
+
+ public Version getRevisionVersion()
+ {
+ if (_branch != null)
+ return getRevisionVersion(_branch);
+ else if (_head != null)
+ return _head.version;
+ else
+ return null;
+ }
+
+ public void toString(StringBuffer s, String EOL) {
+ String EOI = ";"+EOL;
+ String NLT = EOL + "\t";
+
+ s.append("head");
+ if (_head != null) {
+ s.append("\t");
+ _head.version.toString(s);
+ }
+ s.append(EOI);
+
+ if (_branch != null) {
+ s.append("branch\t");
+ s.append(_branch.toString());
+ s.append(EOI);
+ }
+
+ s.append("access");
+ for(Iterator i = _users.iterator(); i.hasNext(); ) {
+ s.append(EOL);
+ s.append("\t");
+ s.append(i.next());
+ }
+ s.append(EOI);
+
+ s.append("symbols");
+ for(Iterator i = _symbols.entrySet().iterator(); i.hasNext(); ) {
+ Map.Entry e = (Map.Entry) i.next();
+ s.append(NLT);
+ s.append(e.getKey().toString());
+ s.append(":");
+ s.append(e.getValue().toString());
+ }
+ s.append(EOI);
+
+ s.append("locks");
+ for(Iterator i = _locked.iterator(); i.hasNext(); ) {
+ String locker = ((Node) i.next())._locker;
+ s.append(NLT);
+ s.append(locker);
+ }
+ if (_strictLocking)
+ s.append("; strict");
+ s.append(EOI);
+
+ if (_comment != null) {
+ s.append("comment\t");
+ s.append(Archive.quoteString(_comment));
+ s.append(EOI);
+ }
+
+ if (_expand != null) {
+ s.append("expand\t");
+ s.append(Archive.quoteString(_expand));
+ s.append(EOI);
+ }
+
+ if (_phrases != null)
+ _phrases.toString(s, EOL);
+ s.append(EOL);
+
+ for(Iterator i = _nodes.values().iterator(); i.hasNext(); ) {
+ Node n = (Node) i.next();
+ if (!n.version.isGhost() && n._text != null)
+ n.toString(s, EOL);
+ }
+
+ s.append(EOL + EOL);
+ s.append("desc");
+ s.append(EOL);
+ s.append(quoteString(_desc));
+ s.append(EOL);
+
+ Node n = _head;
+ while (n != null) {
+ n.toText(s, EOL);
+ n = n.getNext();
+ }
+ }
+
+ static public String quoteString(String s) {
+ //!!! use org.apache.maven.jrcs.RegExp here !!!
+ StringBuffer result = new StringBuffer(s);
+ for(int i = 0; i < s.length(); i++) {
+ if (result.charAt(i) == '@')
+ result.insert(i++, '@');
+ }
+ result.insert(0,'@');
+ result.append('@');
+ return new String(result);
+ }
+
+ static public String unquoteString(String s) {
+ return unquoteString(s, true);
+ }
+
+ static public String unquoteString(String s, boolean removeExtremes) {
+ //!!! use org.apache.maven.jrcs.RegExp here !!!
+ //!!! always ignore extremes. Check they are @'s, though.
+ StringBuffer result = new StringBuffer();
+ int start = 0;
+ int end = s.length();
+ if (removeExtremes) {
+ start += 1;
+ end -= 1;
+ }
+ for(int i = start; i < end; i++) {
+ char c = s.charAt(i);
+ result.append(c);
+ if (c == '@')
+ i++;
+ }
+ return new String(result);
+ }
+
+ public Object[] getRevision()
+ throws InvalidFileFormatException,
+ org.apache.maven.jrcs.diff.DiffException,
+ NodeNotFoundException
+ {
+ return getRevision(false);
+ }
+
+ public Object[] getRevision(boolean annotate)
+ throws InvalidFileFormatException,
+ org.apache.maven.jrcs.diff.DiffException,
+ NodeNotFoundException
+ {
+ if (_branch != null)
+ return getRevision(_branch);
+ else if (_head != null)
+ return getRevision(_head.version);
+ else
+ throw new IllegalStateException("no head node");
+ }
+
+ public Object[] getRevision(String v)
+ throws InvalidFileFormatException,
+ org.apache.maven.jrcs.diff.PatchFailedException,
+ InvalidVersionNumberException,
+ NodeNotFoundException
+ {
+ return getRevision(v, false);
+ }
+
+ public Object[] getRevision(String v, boolean annotate)
+ throws InvalidVersionNumberException,
+ NodeNotFoundException,
+ InvalidFileFormatException,
+ org.apache.maven.jrcs.diff.PatchFailedException
+ {
+ return getRevision(new Version(v), annotate);
+ }
+
+ public Object[] getRevision(Version vernum)
+ throws InvalidFileFormatException,
+ org.apache.maven.jrcs.diff.PatchFailedException,
+ NodeNotFoundException
+ {
+ return getRevision(vernum, false);
+ }
+
+ public Object[] getRevision(Version vernum, boolean annotate)
+ throws InvalidFileFormatException,
+ org.apache.maven.jrcs.diff.PatchFailedException,
+ NodeNotFoundException
+ {
+ Path path = getRevisionPath(vernum);
+ if (path == null)
+ throw new NodeNotFoundException(vernum);
+ Lines lines = new Lines();
+ Node revisionFound = path.last();
+ path.patch(lines, annotate);
+
+ return doKeywords(lines.toArray(), revisionFound);
+ }
+
+ public Version addRevision(Object[] text, String log)
+ throws InvalidFileFormatException,
+ org.apache.maven.jrcs.diff.DiffException,
+ InvalidVersionNumberException,
+ NodeNotFoundException
+ {
+ if (_branch != null)
+ return addRevision(text, _branch, log);
+ else
+ return addRevision(text, _head.version.next(), log);
+ }
+
+ public Version addRevision(Object[] text, String vernum, String log)
+ throws InvalidFileFormatException,
+ org.apache.maven.jrcs.diff.DiffException,
+ InvalidVersionNumberException,
+ NodeNotFoundException
+ {
+ return addRevision(text, new Version(vernum), log);
+ }
+
+ public Version addRevision(Object[] text, Version vernum, String log)
+ throws InvalidFileFormatException,
+ org.apache.maven.jrcs.diff.DiffException,
+ NodeNotFoundException,
+ InvalidVersionNumberException
+ {
+ if (_head == null)
+ throw new IllegalStateException("no _head node");
+
+ Path path = _head.pathTo(vernum, true);
+ Node target = path.last();
+
+ if (vernum.size() < target.version.size())
+ vernum = target.nextVersion();
+ else if (!vernum.isGreaterThan(target.version))
+ throw new InvalidVersionNumberException(vernum + " revision must be higher than " + target.version);
+ else if (vernum.odd())
+ if (vernum.last() == 0)
+ vernum = target.newBranchVersion();
+ else
+ vernum = vernum.newBranch(1);
+ else if (vernum.last() == 0)
+ vernum = vernum.next();
+
+ boolean headAdd = (target == _head && !vernum.isBranch());
+
+ text = removeKeywords(text);
+ String deltaText;
+ if (headAdd)
+ deltaText = Diff.diff(text, _head._text).toRCSString();
+ else {
+ Object[] oldText = path.patch().toArray();
+ deltaText = Diff.diff(oldText, text).toRCSString();
+ }
+ if (deltaText.length() == 0)
+ return null; // no changes, no new version
+
+ Node newNode = null;
+ if (headAdd) {
+ newNode = newNode(vernum, _head);
+ newNode.setText(text);
+ _head.setText(deltaText);
+ _head = (TrunkNode) newNode;
+ }
+ else { // adding a branch node
+ newNode = newNode(vernum);
+ newNode.setText(deltaText);
+ if (vernum.size() > target.version.size())
+ target.addBranch((BranchNode) newNode);
+ else
+ target.setRCSNext(newNode);
+ }
+ newNode.setLog(log);
+ return newNode.version;
+ }
+
+ protected static final Format Header_FORMAT =
+ new MessageFormat("Header: {1} {2} {3, date,yyyy/MM/dd HH:mm:ss} {4} {5} ");
+ protected static final Format Id_FORMAT =
+ new MessageFormat("Id: {1} {2} {3, date,yyyy/MM/dd HH:mm:ss} {4} {5} ");
+ protected static final Format RCSFile_FORMAT =
+ new MessageFormat("RCSfile: {1} ");
+ protected static final Format Revision_FORMAT =
+ new MessageFormat("Revision: {2} ");
+ protected static final Format Date_FORMAT =
+ new MessageFormat("Date: {3, date,yyyy/MM/dd HH:mm:ss} ");
+ protected static final Format Author_FORMAT =
+ new MessageFormat("Author: {4} ");
+ protected static final Format State_FORMAT =
+ new MessageFormat("State: {5} ");
+ protected static final Format Locker_FORMAT =
+ new MessageFormat("Locker: {6} ");
+ protected static final Format Source_FORMAT =
+ new MessageFormat("Source: {0} ");
+
+ protected static RE Id_re;
+ protected static RE Header_re;
+ protected static RE Source_re;
+ protected static RE RCSfile_re;
+ protected static RE Revision_re;
+ protected static RE Date_re;
+ protected static RE Author_re;
+ protected static RE State_re;
+ protected static RE Locker_re;
+
+ static void makeRegularExpressions() throws org.apache.maven.jrcs.diff.PatchFailedException
+ {
+ if (Locker_re != null)
+ return;
+ try {
+ Id_re = new RE("\\$Id(:[^\\$]*)?\\$" );
+ Header_re = new RE("\\$Header(:[^\\$]*)?\\$" );
+ Source_re = new RE("\\$Source(:[^\\$]*)?\\$" );
+ RCSfile_re = new RE("\\$RCSfile(:[^\\$]*)?\\$" );
+ Revision_re = new RE("\\$Revision(:[^\\$]*)?\\$" );
+ Date_re = new RE("\\$Date(:[^\\$]*)?\\$" );
+ Author_re = new RE("\\$Author(:[^\\$]*)?\\$" );
+ State_re = new RE("\\$State(:[^\\$]*)?\\$" );
+ Locker_re = new RE("\\$Locker(:[^\\$]*)?\\$" );
+ }
+ catch(REException e) {
+ throw new org.apache.maven.jrcs.diff.PatchFailedException(e.getMessage());
+ }
+ }
+
+ public Object[] doKeywords(Object[] text, Node rev)
+ throws org.apache.maven.jrcs.diff.PatchFailedException
+ {
+ Object[] revisionInfo = new Object[] {
+ _filename,
+ new java.io.File(_filename).getName(),
+ rev.version.toString(),
+ rev._date,
+ rev._author,
+ rev._state,
+ rev._locker
+ };
+
+ makeRegularExpressions();
+ Object[] result = new Object[text.length];
+ for(int i = 0; i < text.length; i++) {
+ result[i] = Id_re .substituteAll(text[i], "$"+Id_FORMAT.format(revisionInfo)+"$");
+ result[i] = Header_re .substituteAll(text[i], "$"+Header_FORMAT.format(revisionInfo)+"$");
+ result[i] = Source_re .substituteAll(text[i], "$"+Source_FORMAT.format(revisionInfo)+"$");
+ result[i] = RCSfile_re .substituteAll(text[i], "$"+RCSFile_FORMAT.format(revisionInfo)+"$");
+ result[i] = Revision_re .substituteAll(text[i], "$"+Revision_FORMAT.format(revisionInfo)+"$");
+ result[i] = Date_re .substituteAll(text[i], "$"+Date_FORMAT.format(revisionInfo)+"$");
+ result[i] = Author_re .substituteAll(text[i], "$"+Author_FORMAT.format(revisionInfo)+"$");
+ result[i] = State_re .substituteAll(text[i], "$"+State_FORMAT.format(revisionInfo)+"$");
+ result[i] = Locker_re .substituteAll(text[i], "$"+Locker_FORMAT.format(revisionInfo)+"$");
+ //@TODO: should do something about Name and Log
+ }
+ return result;
+ }
+
+ protected static Object[] removeKeywords(Object[] text)
+ throws org.apache.maven.jrcs.diff.PatchFailedException
+ {
+ makeRegularExpressions();
+ Object[] result = new Object[text.length];
+ for(int i = 0; i < text.length; i++) {
+ result[i] = Id_re .substituteAll(text[i], "$"+"Id"+"$");
+ result[i] = Header_re .substituteAll(text[i], "$"+"Header"+"$");
+ result[i] = Source_re .substituteAll(text[i], "$"+"Source"+"$");
+ result[i] = RCSfile_re .substituteAll(text[i], "$"+"RCSFile"+"$");
+ result[i] = Revision_re .substituteAll(text[i], "$"+"Revision"+"$");
+ result[i] = Date_re .substituteAll(text[i], "$"+"Date"+"$");
+ result[i] = Author_re .substituteAll(text[i], "$"+"Author"+"$");
+ result[i] = State_re .substituteAll(text[i], "$"+"State"+"$");
+ result[i] = Locker_re .substituteAll(text[i], "$"+"Locker"+"$");
+ //@TODO: should do something about Name and Log
+ }
+ return result;
+ }
+
+}
+
+
1.2 +681 -681 jakarta-turbine-maven/src/java/org/apache/maven/jrcs/rcs/ArchiveParser.java
Index: ArchiveParser.java
===================================================================
RCS file: /home/cvs/jakarta-turbine-maven/src/java/org/apache/maven/jrcs/rcs/ArchiveParser.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- ArchiveParser.java 20 Feb 2002 16:20:03 -0000 1.1
+++ ArchiveParser.java 20 Feb 2002 22:02:59 -0000 1.2
@@ -1,681 +1,681 @@
-package org.apache.maven.jrcs.rcs;
-
-import java.util.*;
-
-class ArchiveParser implements ArchiveParserConstants {
-
- static final String ident = "RCS ArchiveParser Parser $version$:";
-
- public static void main(String args[]) {
- ArchiveParser parser;
- if (args.length == 0) {
- System.out.println(ident + " Reading from standard input . . .");
- parser = new ArchiveParser(System.in);
- } else if (args.length == 1) {
- System.out.println(ident + " Reading from file " + args[0] + " . . .");
- try {
- parser = new ArchiveParser(new java.io.FileInputStream(args[0]));
- } catch (java.io.FileNotFoundException e) {
- System.out.println(ident + " File " + args[0] + " not found.");
- return;
- }
- } else {
- System.out.println(ident+" Usage is one of:");
- System.out.println(" java ArchiveParser < inputfile");
- System.out.println("OR");
- System.out.println(" java ArchiveParser inputfile");
- return;
- }
- parser.parse();
- }
-
- public static void load(Archive arc, java.io.InputStream input) throws ParseException {
- ArchiveParser parser = new ArchiveParser(input);
- parser.archive(arc);
- }
-
- public static void load(Archive arc, String fname) throws java.io.FileNotFoundException, ParseException {
- load(arc, new java.io.FileInputStream(fname) );
- }
-
- public void parse() {
- try {
- archive(null);
- System.out.println("RCS ArchiveParser Parser version 1.1: RCS ArchiveParser parsed successfully.");
- } catch (ParseException e) {
- System.out.println("RCS ArchiveParser Parser version 1.1: Encountered errors during parse.");
- }
- }
-
-/**
-* PARSER STARTS HERE
-*/
- final public void archive(Archive arc) throws ParseException {
- admin(arc);
- label_1:
- while (true) {
- switch (jj_nt.kind) {
- case NUM:
- ;
- break;
- default:
- break label_1;
- }
- delta(arc);
- }
- desc(arc);
- label_2:
- while (true) {
- switch (jj_nt.kind) {
- case NUM:
- ;
- break;
- default:
- break label_2;
- }
- text(arc);
- }
- jj_consume_token(0);
- }
-
- final public void admin(Archive arc) throws ParseException {
- head(arc);
- switch (jj_nt.kind) {
- case BRANCH:
- branch(arc);
- break;
- default:
- ;
- }
- access(arc);
- symbols(arc);
- locks(arc);
- optionals(arc);
- }
-
- final public void optionals(Archive arc) throws ParseException {
- label_3:
- while (true) {
- switch (jj_nt.kind) {
- case COMMENT:
- case EXPAND:
- case ID:
- ;
- break;
- default:
- break label_3;
- }
- switch (jj_nt.kind) {
- case COMMENT:
- comment(arc);
- break;
- case EXPAND:
- expand(arc);
- break;
- case ID:
- newPhrase(arc._phrases);
- break;
- default:
- jj_consume_token(-1);
- throw new ParseException();
- }
- }
- }
-
- final public void newPhrases(Map map) throws ParseException {
- label_4:
- while (true) {
- switch (jj_nt.kind) {
- case ID:
- ;
- break;
- default:
- break label_4;
- }
- newPhrase(map);
- }
- }
-
- final public void head(Archive arc) throws ParseException {
- Version v;
- jj_consume_token(HEAD);
- switch (jj_nt.kind) {
- case NUM:
- v = version();
- arc.setHead(v);
- break;
- default:
- ;
- }
- jj_consume_token(29);
- }
-
- final public void branch(Archive arc) throws ParseException {
- Version v;
- jj_consume_token(BRANCH);
- switch (jj_nt.kind) {
- case NUM:
- v = version();
- arc.setBranch(v);
- break;
- default:
- ;
- }
- jj_consume_token(29);
- }
-
- final public void access(Archive arc) throws ParseException {
- String name;
- jj_consume_token(ACCESS);
- label_5:
- while (true) {
- switch (jj_nt.kind) {
- case ID:
- ;
- break;
- default:
- break label_5;
- }
- name = id();
- arc.addUser(name);
- }
- jj_consume_token(29);
- }
-
- final public void symbols(Archive arc) throws ParseException {
- String s;
- Version v;
- jj_consume_token(SYMBOLS);
- label_6:
- while (true) {
- switch (jj_nt.kind) {
- case ID:
- case SYM:
- ;
- break;
- default:
- break label_6;
- }
- s = sym();
- jj_consume_token(30);
- v = version();
- arc.addSymbol(s, v);
- }
- jj_consume_token(29);
- }
-
- final public void locks(Archive arc) throws ParseException {
- String name;
- Version v;
- jj_consume_token(LOCKS);
- label_7:
- while (true) {
- switch (jj_nt.kind) {
- case ID:
- ;
- break;
- default:
- break label_7;
- }
- name = id();
- jj_consume_token(30);
- v = version();
- arc.addLock(name, v);
- }
- jj_consume_token(29);
- switch (jj_nt.kind) {
- case STRICT:
- jj_consume_token(STRICT);
- jj_consume_token(29);
- arc.setStrictLocking(true);
- break;
- default:
- ;
- }
- }
-
- final public void comment(Archive arc) throws ParseException {
- String s;
- jj_consume_token(COMMENT);
- switch (jj_nt.kind) {
- case STRING:
- s = string();
- arc.setComment(s);
- break;
- default:
- ;
- }
- jj_consume_token(29);
- }
-
- final public void expand(Archive arc) throws ParseException {
- String s;
- jj_consume_token(EXPAND);
- switch (jj_nt.kind) {
- case STRING:
- s = string();
- arc.setExpand(s);
- break;
- default:
- ;
- }
- jj_consume_token(29);
- }
-
- final public void newPhrase(Map map) throws ParseException {
- String key;
- String value;
- StringBuffer values = new StringBuffer();
- key = id();
- label_8:
- while (true) {
- switch (jj_nt.kind) {
- case ID:
- case STRING:
- case NUM:
- ;
- break;
- default:
- break label_8;
- }
- value = word();
- values.append(" " + value);
- }
- jj_consume_token(29);
- if (map != null) map.put(key, values.toString());
- }
-
- final public String word() throws ParseException {
- String result;
- if (jj_2_1(2)) {
- result = pair();
- } else {
- switch (jj_nt.kind) {
- case ID:
- case STRING:
- case NUM:
- result = simpleWord();
- break;
- default:
- jj_consume_token(-1);
- throw new ParseException();
- }
- }
- {if (true) return result;}
- throw new Error("Missing return statement in function");
- }
-
- final public String simpleWord() throws ParseException {
- String result;
- Version v;
- switch (jj_nt.kind) {
- case ID:
- result = id();
- break;
- case NUM:
- v = version();
- result = v.toString();
- break;
- case STRING:
- result = string();
- break;
- default:
- jj_consume_token(-1);
- throw new ParseException();
- }
- {if (true) return result;}
- throw new Error("Missing return statement in function");
- }
-
- final public String pair() throws ParseException {
- String left;
- String right;
- left = simpleWord();
- jj_consume_token(30);
- right = simpleWord();
- {if (true) return left + ":" + right;}
- throw new Error("Missing return statement in function");
- }
-
- final public void desc(Archive arc) throws ParseException {
- String s;
- jj_consume_token(DESC);
- s = string();
- arc.setDesc(s);
- }
-
- final public void delta(Archive arc) throws ParseException {
- Version v;
- Node node;
- int[] d;
- String s;
- v = version();
- node = arc.newNode(v);
- jj_consume_token(DATE);
- d = date();
- node.setDate(d);
- jj_consume_token(29);
- jj_consume_token(AUTHOR);
- s = id();
- node.setAuthor(s);
- jj_consume_token(29);
- jj_consume_token(STATE);
- switch (jj_nt.kind) {
- case ID:
- s = id();
- node.setState(s);
- break;
- default:
- ;
- }
- jj_consume_token(29);
- jj_consume_token(BRANCHES);
- label_9:
- while (true) {
- switch (jj_nt.kind) {
- case NUM:
- ;
- break;
- default:
- break label_9;
- }
- v = version();
- node.addBranch(arc.newBranchNode(v));
- }
- jj_consume_token(29);
- jj_consume_token(NEXT);
- switch (jj_nt.kind) {
- case NUM:
- v = version();
- node.setRCSNext(arc.newNode(v));
- break;
- default:
- ;
- }
- jj_consume_token(29);
- newPhrases(node._phrases);
- }
-
- final public void text(Archive arc) throws ParseException {
- Version v;
- Node node;
- String log;
- String txt;
- v = version();
- node = arc.findNode(v);
- jj_consume_token(LOG);
- log = string();
- node.setLog(log);
- newPhrases(node._phrases);
- jj_consume_token(TEXT);
- txt = string();
- node.setText(txt);
- }
-
- final public String id() throws ParseException {
- Token t;
- t = jj_consume_token(ID);
- {if (true) return t.image;}
- throw new Error("Missing return statement in function");
- }
-
- final public String sym() throws ParseException {
- Token t;
- switch (jj_nt.kind) {
- case SYM:
- t = jj_consume_token(SYM);
- break;
- case ID:
- t = jj_consume_token(ID);
- break;
- default:
- jj_consume_token(-1);
- throw new ParseException();
- }
- {if (true) return t.image;}
- throw new Error("Missing return statement in function");
- }
-
- final public Version version() throws ParseException {
- Version v;
- int n, r;
- n = num();
- v = new Version(n);
- label_10:
- while (true) {
- switch (jj_nt.kind) {
- case 31:
- ;
- break;
- default:
- break label_10;
- }
- jj_consume_token(31);
- n = num();
- v.__addBranch(n);
- }
- {if (true) return v;}
- throw new Error("Missing return statement in function");
- }
-
- final public int[] date() throws ParseException {
- int[] n = new int[6];
- n[0] = num();
- jj_consume_token(31);
- n[1] = num();
- jj_consume_token(31);
- n[2] = num();
- jj_consume_token(31);
- n[3] = num();
- jj_consume_token(31);
- n[4] = num();
- jj_consume_token(31);
- n[5] = num();
- {if (true) return n;}
- throw new Error("Missing return statement in function");
- }
-
- final public int num() throws ParseException {
- Token t;
- t = jj_consume_token(NUM);
- {if (true) return Integer.parseInt(t.image);}
- throw new Error("Missing return statement in function");
- }
-
- final public String string() throws ParseException {
- Token t;
- t = jj_consume_token(STRING);
- {if (true) return Archive.unquoteString(t.image);}
- throw new Error("Missing return statement in function");
- }
-
- final private boolean jj_2_1(int xla) {
- jj_la = xla; jj_lastpos = jj_scanpos = token;
- return !jj_3_1();
- }
-
- final private boolean jj_3R_15() {
- if (jj_3R_18()) return true;
- if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
- return false;
- }
-
- final private boolean jj_3R_14() {
- if (jj_3R_17()) return true;
- if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
- return false;
- }
-
- final private boolean jj_3R_20() {
- if (jj_scan_token(31)) return true;
- if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
- return false;
- }
-
- final private boolean jj_3R_13() {
- if (jj_3R_16()) return true;
- if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
- return false;
- }
-
- final private boolean jj_3R_12() {
- Token xsp;
- xsp = jj_scanpos;
- if (jj_3R_13()) {
- jj_scanpos = xsp;
- if (jj_3R_14()) {
- jj_scanpos = xsp;
- if (jj_3R_15()) return true;
- if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
- } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
- } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
- return false;
- }
-
- final private boolean jj_3R_18() {
- if (jj_scan_token(STRING)) return true;
- if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
- return false;
- }
-
- final private boolean jj_3R_17() {
- if (jj_3R_19()) return true;
- if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
- Token xsp;
- while (true) {
- xsp = jj_scanpos;
- if (jj_3R_20()) { jj_scanpos = xsp; break; }
- if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
- }
- return false;
- }
-
- final private boolean jj_3R_11() {
- if (jj_3R_12()) return true;
- if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
- if (jj_scan_token(30)) return true;
- if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
- return false;
- }
-
- final private boolean jj_3R_19() {
- if (jj_scan_token(NUM)) return true;
- if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
- return false;
- }
-
- final private boolean jj_3_1() {
- if (jj_3R_11()) return true;
- if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
- return false;
- }
-
- final private boolean jj_3R_16() {
- if (jj_scan_token(ID)) return true;
- if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
- return false;
- }
-
- public ArchiveParserTokenManager token_source;
- ASCII_UCodeESC_CharStream jj_input_stream;
- public Token token, jj_nt;
- private Token jj_scanpos, jj_lastpos;
- private int jj_la;
- public boolean lookingAhead = false;
- private boolean jj_semLA;
-
- public ArchiveParser(java.io.InputStream stream) {
- jj_input_stream = new ASCII_UCodeESC_CharStream(stream, 1, 1);
- token_source = new ArchiveParserTokenManager(jj_input_stream);
- token = new Token();
- token.next = jj_nt = token_source.getNextToken();
- }
-
- public void ReInit(java.io.InputStream stream) {
- jj_input_stream.ReInit(stream, 1, 1);
- token_source.ReInit(jj_input_stream);
- token = new Token();
- token.next = jj_nt = token_source.getNextToken();
- }
-
- public ArchiveParser(java.io.Reader stream) {
- jj_input_stream = new ASCII_UCodeESC_CharStream(stream, 1, 1);
- token_source = new ArchiveParserTokenManager(jj_input_stream);
- token = new Token();
- token.next = jj_nt = token_source.getNextToken();
- }
-
- public void ReInit(java.io.Reader stream) {
- jj_input_stream.ReInit(stream, 1, 1);
- token_source.ReInit(jj_input_stream);
- token = new Token();
- token.next = jj_nt = token_source.getNextToken();
- }
-
- public ArchiveParser(ArchiveParserTokenManager tm) {
- token_source = tm;
- token = new Token();
- token.next = jj_nt = token_source.getNextToken();
- }
-
- public void ReInit(ArchiveParserTokenManager tm) {
- token_source = tm;
- token = new Token();
- token.next = jj_nt = token_source.getNextToken();
- }
-
- final private Token jj_consume_token(int kind) throws ParseException {
- Token oldToken = token;
- if ((token = jj_nt).next != null) jj_nt = jj_nt.next;
- else jj_nt = jj_nt.next = token_source.getNextToken();
- if (token.kind == kind) {
- return token;
- }
- jj_nt = token;
- token = oldToken;
- throw generateParseException();
- }
-
- final private boolean jj_scan_token(int kind) {
- if (jj_scanpos == jj_lastpos) {
- jj_la--;
- if (jj_scanpos.next == null) {
- jj_lastpos = jj_scanpos = jj_scanpos.next = token_source.getNextToken();
- } else {
- jj_lastpos = jj_scanpos = jj_scanpos.next;
- }
- } else {
- jj_scanpos = jj_scanpos.next;
- }
- return (jj_scanpos.kind != kind);
- }
-
- final public Token getNextToken() {
- if ((token = jj_nt).next != null) jj_nt = jj_nt.next;
- else jj_nt = jj_nt.next = token_source.getNextToken();
- return token;
- }
-
- final public Token getToken(int index) {
- Token t = lookingAhead ? jj_scanpos : token;
- for (int i = 0; i < index; i++) {
- if (t.next != null) t = t.next;
- else t = t.next = token_source.getNextToken();
- }
- return t;
- }
-
- final public ParseException generateParseException() {
- Token errortok = token.next;
- int line = errortok.beginLine, column = errortok.beginColumn;
- String mess = (errortok.kind == 0) ? tokenImage[0] : errortok.image;
- return new ParseException("Parse error at line " + line + ", column " + column + ". Encountered: " + mess);
- }
-
- final public void enable_tracing() {
- }
-
- final public void disable_tracing() {
- }
-
-}
+package org.apache.maven.jrcs.rcs;
+
+import java.util.*;
+
+class ArchiveParser implements ArchiveParserConstants {
+
+ static final String ident = "RCS ArchiveParser Parser $version$:";
+
+ public static void main(String args[]) {
+ ArchiveParser parser;
+ if (args.length == 0) {
+ System.out.println(ident + " Reading from standard input . . .");
+ parser = new ArchiveParser(System.in);
+ } else if (args.length == 1) {
+ System.out.println(ident + " Reading from file " + args[0] + " . . .");
+ try {
+ parser = new ArchiveParser(new java.io.FileInputStream(args[0]));
+ } catch (java.io.FileNotFoundException e) {
+ System.out.println(ident + " File " + args[0] + " not found.");
+ return;
+ }
+ } else {
+ System.out.println(ident+" Usage is one of:");
+ System.out.println(" java ArchiveParser < inputfile");
+ System.out.println("OR");
+ System.out.println(" java ArchiveParser inputfile");
+ return;
+ }
+ parser.parse();
+ }
+
+ public static void load(Archive arc, java.io.InputStream input) throws ParseException {
+ ArchiveParser parser = new ArchiveParser(input);
+ parser.archive(arc);
+ }
+
+ public static void load(Archive arc, String fname) throws java.io.FileNotFoundException, ParseException {
+ load(arc, new java.io.FileInputStream(fname) );
+ }
+
+ public void parse() {
+ try {
+ archive(null);
+ System.out.println("RCS ArchiveParser Parser version 1.1: RCS ArchiveParser parsed successfully.");
+ } catch (ParseException e) {
+ System.out.println("RCS ArchiveParser Parser version 1.1: Encountered errors during parse.");
+ }
+ }
+
+/**
+* PARSER STARTS HERE
+*/
+ final public void archive(Archive arc) throws ParseException {
+ admin(arc);
+ label_1:
+ while (true) {
+ switch (jj_nt.kind) {
+ case NUM:
+ ;
+ break;
+ default:
+ break label_1;
+ }
+ delta(arc);
+ }
+ desc(arc);
+ label_2:
+ while (true) {
+ switch (jj_nt.kind) {
+ case NUM:
+ ;
+ break;
+ default:
+ break label_2;
+ }
+ text(arc);
+ }
+ jj_consume_token(0);
+ }
+
+ final public void admin(Archive arc) throws ParseException {
+ head(arc);
+ switch (jj_nt.kind) {
+ case BRANCH:
+ branch(arc);
+ break;
+ default:
+ ;
+ }
+ access(arc);
+ symbols(arc);
+ locks(arc);
+ optionals(arc);
+ }
+
+ final public void optionals(Archive arc) throws ParseException {
+ label_3:
+ while (true) {
+ switch (jj_nt.kind) {
+ case COMMENT:
+ case EXPAND:
+ case ID:
+ ;
+ break;
+ default:
+ break label_3;
+ }
+ switch (jj_nt.kind) {
+ case COMMENT:
+ comment(arc);
+ break;
+ case EXPAND:
+ expand(arc);
+ break;
+ case ID:
+ newPhrase(arc._phrases);
+ break;
+ default:
+ jj_consume_token(-1);
+ throw new ParseException();
+ }
+ }
+ }
+
+ final public void newPhrases(Map map) throws ParseException {
+ label_4:
+ while (true) {
+ switch (jj_nt.kind) {
+ case ID:
+ ;
+ break;
+ default:
+ break label_4;
+ }
+ newPhrase(map);
+ }
+ }
+
+ final public void head(Archive arc) throws ParseException {
+ Version v;
+ jj_consume_token(HEAD);
+ switch (jj_nt.kind) {
+ case NUM:
+ v = version();
+ arc.setHead(v);
+ break;
+ default:
+ ;
+ }
+ jj_consume_token(29);
+ }
+
+ final public void branch(Archive arc) throws ParseException {
+ Version v;
+ jj_consume_token(BRANCH);
+ switch (jj_nt.kind) {
+ case NUM:
+ v = version();
+ arc.setBranch(v);
+ break;
+ default:
+ ;
+ }
+ jj_consume_token(29);
+ }
+
+ final public void access(Archive arc) throws ParseException {
+ String name;
+ jj_consume_token(ACCESS);
+ label_5:
+ while (true) {
+ switch (jj_nt.kind) {
+ case ID:
+ ;
+ break;
+ default:
+ break label_5;
+ }
+ name = id();
+ arc.addUser(name);
+ }
+ jj_consume_token(29);
+ }
+
+ final public void symbols(Archive arc) throws ParseException {
+ String s;
+ Version v;
+ jj_consume_token(SYMBOLS);
+ label_6:
+ while (true) {
+ switch (jj_nt.kind) {
+ case ID:
+ case SYM:
+ ;
+ break;
+ default:
+ break label_6;
+ }
+ s = sym();
+ jj_consume_token(30);
+ v = version();
+ arc.addSymbol(s, v);
+ }
+ jj_consume_token(29);
+ }
+
+ final public void locks(Archive arc) throws ParseException {
+ String name;
+ Version v;
+ jj_consume_token(LOCKS);
+ label_7:
+ while (true) {
+ switch (jj_nt.kind) {
+ case ID:
+ ;
+ break;
+ default:
+ break label_7;
+ }
+ name = id();
+ jj_consume_token(30);
+ v = version();
+ arc.addLock(name, v);
+ }
+ jj_consume_token(29);
+ switch (jj_nt.kind) {
+ case STRICT:
+ jj_consume_token(STRICT);
+ jj_consume_token(29);
+ arc.setStrictLocking(true);
+ break;
+ default:
+ ;
+ }
+ }
+
+ final public void comment(Archive arc) throws ParseException {
+ String s;
+ jj_consume_token(COMMENT);
+ switch (jj_nt.kind) {
+ case STRING:
+ s = string();
+ arc.setComment(s);
+ break;
+ default:
+ ;
+ }
+ jj_consume_token(29);
+ }
+
+ final public void expand(Archive arc) throws ParseException {
+ String s;
+ jj_consume_token(EXPAND);
+ switch (jj_nt.kind) {
+ case STRING:
+ s = string();
+ arc.setExpand(s);
+ break;
+ default:
+ ;
+ }
+ jj_consume_token(29);
+ }
+
+ final public void newPhrase(Map map) throws ParseException {
+ String key;
+ String value;
+ StringBuffer values = new StringBuffer();
+ key = id();
+ label_8:
+ while (true) {
+ switch (jj_nt.kind) {
+ case ID:
+ case STRING:
+ case NUM:
+ ;
+ break;
+ default:
+ break label_8;
+ }
+ value = word();
+ values.append(" " + value);
+ }
+ jj_consume_token(29);
+ if (map != null) map.put(key, values.toString());
+ }
+
+ final public String word() throws ParseException {
+ String result;
+ if (jj_2_1(2)) {
+ result = pair();
+ } else {
+ switch (jj_nt.kind) {
+ case ID:
+ case STRING:
+ case NUM:
+ result = simpleWord();
+ break;
+ default:
+ jj_consume_token(-1);
+ throw new ParseException();
+ }
+ }
+ {if (true) return result;}
+ throw new Error("Missing return statement in function");
+ }
+
+ final public String simpleWord() throws ParseException {
+ String result;
+ Version v;
+ switch (jj_nt.kind) {
+ case ID:
+ result = id();
+ break;
+ case NUM:
+ v = version();
+ result = v.toString();
+ break;
+ case STRING:
+ result = string();
+ break;
+ default:
+ jj_consume_token(-1);
+ throw new ParseException();
+ }
+ {if (true) return result;}
+ throw new Error("Missing return statement in function");
+ }
+
+ final public String pair() throws ParseException {
+ String left;
+ String right;
+ left = simpleWord();
+ jj_consume_token(30);
+ right = simpleWord();
+ {if (true) return left + ":" + right;}
+ throw new Error("Missing return statement in function");
+ }
+
+ final public void desc(Archive arc) throws ParseException {
+ String s;
+ jj_consume_token(DESC);
+ s = string();
+ arc.setDesc(s);
+ }
+
+ final public void delta(Archive arc) throws ParseException {
+ Version v;
+ Node node;
+ int[] d;
+ String s;
+ v = version();
+ node = arc.newNode(v);
+ jj_consume_token(DATE);
+ d = date();
+ node.setDate(d);
+ jj_consume_token(29);
+ jj_consume_token(AUTHOR);
+ s = id();
+ node.setAuthor(s);
+ jj_consume_token(29);
+ jj_consume_token(STATE);
+ switch (jj_nt.kind) {
+ case ID:
+ s = id();
+ node.setState(s);
+ break;
+ default:
+ ;
+ }
+ jj_consume_token(29);
+ jj_consume_token(BRANCHES);
+ label_9:
+ while (true) {
+ switch (jj_nt.kind) {
+ case NUM:
+ ;
+ break;
+ default:
+ break label_9;
+ }
+ v = version();
+ node.addBranch(arc.newBranchNode(v));
+ }
+ jj_consume_token(29);
+ jj_consume_token(NEXT);
+ switch (jj_nt.kind) {
+ case NUM:
+ v = version();
+ node.setRCSNext(arc.newNode(v));
+ break;
+ default:
+ ;
+ }
+ jj_consume_token(29);
+ newPhrases(node._phrases);
+ }
+
+ final public void text(Archive arc) throws ParseException {
+ Version v;
+ Node node;
+ String log;
+ String txt;
+ v = version();
+ node = arc.findNode(v);
+ jj_consume_token(LOG);
+ log = string();
+ node.setLog(log);
+ newPhrases(node._phrases);
+ jj_consume_token(TEXT);
+ txt = string();
+ node.setText(txt);
+ }
+
+ final public String id() throws ParseException {
+ Token t;
+ t = jj_consume_token(ID);
+ {if (true) return t.image;}
+ throw new Error("Missing return statement in function");
+ }
+
+ final public String sym() throws ParseException {
+ Token t;
+ switch (jj_nt.kind) {
+ case SYM:
+ t = jj_consume_token(SYM);
+ break;
+ case ID:
+ t = jj_consume_token(ID);
+ break;
+ default:
+ jj_consume_token(-1);
+ throw new ParseException();
+ }
+ {if (true) return t.image;}
+ throw new Error("Missing return statement in function");
+ }
+
+ final public Version version() throws ParseException {
+ Version v;
+ int n, r;
+ n = num();
+ v = new Version(n);
+ label_10:
+ while (true) {
+ switch (jj_nt.kind) {
+ case 31:
+ ;
+ break;
+ default:
+ break label_10;
+ }
+ jj_consume_token(31);
+ n = num();
+ v.__addBranch(n);
+ }
+ {if (true) return v;}
+ throw new Error("Missing return statement in function");
+ }
+
+ final public int[] date() throws ParseException {
+ int[] n = new int[6];
+ n[0] = num();
+ jj_consume_token(31);
+ n[1] = num();
+ jj_consume_token(31);
+ n[2] = num();
+ jj_consume_token(31);
+ n[3] = num();
+ jj_consume_token(31);
+ n[4] = num();
+ jj_consume_token(31);
+ n[5] = num();
+ {if (true) return n;}
+ throw new Error("Missing return statement in function");
+ }
+
+ final public int num() throws ParseException {
+ Token t;
+ t = jj_consume_token(NUM);
+ {if (true) return Integer.parseInt(t.image);}
+ throw new Error("Missing return statement in function");
+ }
+
+ final public String string() throws ParseException {
+ Token t;
+ t = jj_consume_token(STRING);
+ {if (true) return Archive.unquoteString(t.image);}
+ throw new Error("Missing return statement in function");
+ }
+
+ final private boolean jj_2_1(int xla) {
+ jj_la = xla; jj_lastpos = jj_scanpos = token;
+ return !jj_3_1();
+ }
+
+ final private boolean jj_3R_15() {
+ if (jj_3R_18()) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ return false;
+ }
+
+ final private boolean jj_3R_14() {
+ if (jj_3R_17()) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ return false;
+ }
+
+ final private boolean jj_3R_20() {
+ if (jj_scan_token(31)) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ return false;
+ }
+
+ final private boolean jj_3R_13() {
+ if (jj_3R_16()) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ return false;
+ }
+
+ final private boolean jj_3R_12() {
+ Token xsp;
+ xsp = jj_scanpos;
+ if (jj_3R_13()) {
+ jj_scanpos = xsp;
+ if (jj_3R_14()) {
+ jj_scanpos = xsp;
+ if (jj_3R_15()) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ return false;
+ }
+
+ final private boolean jj_3R_18() {
+ if (jj_scan_token(STRING)) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ return false;
+ }
+
+ final private boolean jj_3R_17() {
+ if (jj_3R_19()) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ Token xsp;
+ while (true) {
+ xsp = jj_scanpos;
+ if (jj_3R_20()) { jj_scanpos = xsp; break; }
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ }
+ return false;
+ }
+
+ final private boolean jj_3R_11() {
+ if (jj_3R_12()) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ if (jj_scan_token(30)) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ return false;
+ }
+
+ final private boolean jj_3R_19() {
+ if (jj_scan_token(NUM)) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ return false;
+ }
+
+ final private boolean jj_3_1() {
+ if (jj_3R_11()) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ return false;
+ }
+
+ final private boolean jj_3R_16() {
+ if (jj_scan_token(ID)) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ return false;
+ }
+
+ public ArchiveParserTokenManager token_source;
+ ASCII_UCodeESC_CharStream jj_input_stream;
+ public Token token, jj_nt;
+ private Token jj_scanpos, jj_lastpos;
+ private int jj_la;
+ public boolean lookingAhead = false;
+ private boolean jj_semLA;
+
+ public ArchiveParser(java.io.InputStream stream) {
+ jj_input_stream = new ASCII_UCodeESC_CharStream(stream, 1, 1);
+ token_source = new ArchiveParserTokenManager(jj_input_stream);
+ token = new Token();
+ token.next = jj_nt = token_source.getNextToken();
+ }
+
+ public void ReInit(java.io.InputStream stream) {
+ jj_input_stream.ReInit(stream, 1, 1);
+ token_source.ReInit(jj_input_stream);
+ token = new Token();
+ token.next = jj_nt = token_source.getNextToken();
+ }
+
+ public ArchiveParser(java.io.Reader stream) {
+ jj_input_stream = new ASCII_UCodeESC_CharStream(stream, 1, 1);
+ token_source = new ArchiveParserTokenManager(jj_input_stream);
+ token = new Token();
+ token.next = jj_nt = token_source.getNextToken();
+ }
+
+ public void ReInit(java.io.Reader stream) {
+ jj_input_stream.ReInit(stream, 1, 1);
+ token_source.ReInit(jj_input_stream);
+ token = new Token();
+ token.next = jj_nt = token_source.getNextToken();
+ }
+
+ public ArchiveParser(ArchiveParserTokenManager tm) {
+ token_source = tm;
+ token = new Token();
+ token.next = jj_nt = token_source.getNextToken();
+ }
+
+ public void ReInit(ArchiveParserTokenManager tm) {
+ token_source = tm;
+ token = new Token();
+ token.next = jj_nt = token_source.getNextToken();
+ }
+
+ final private Token jj_consume_token(int kind) throws ParseException {
+ Token oldToken = token;
+ if ((token = jj_nt).next != null) jj_nt = jj_nt.next;
+ else jj_nt = jj_nt.next = token_source.getNextToken();
+ if (token.kind == kind) {
+ return token;
+ }
+ jj_nt = token;
+ token = oldToken;
+ throw generateParseException();
+ }
+
+ final private boolean jj_scan_token(int kind) {
+ if (jj_scanpos == jj_lastpos) {
+ jj_la--;
+ if (jj_scanpos.next == null) {
+ jj_lastpos = jj_scanpos = jj_scanpos.next = token_source.getNextToken();
+ } else {
+ jj_lastpos = jj_scanpos = jj_scanpos.next;
+ }
+ } else {
+ jj_scanpos = jj_scanpos.next;
+ }
+ return (jj_scanpos.kind != kind);
+ }
+
+ final public Token getNextToken() {
+ if ((token = jj_nt).next != null) jj_nt = jj_nt.next;
+ else jj_nt = jj_nt.next = token_source.getNextToken();
+ return token;
+ }
+
+ final public Token getToken(int index) {
+ Token t = lookingAhead ? jj_scanpos : token;
+ for (int i = 0; i < index; i++) {
+ if (t.next != null) t = t.next;
+ else t = t.next = token_source.getNextToken();
+ }
+ return t;
+ }
+
+ final public ParseException generateParseException() {
+ Token errortok = token.next;
+ int line = errortok.beginLine, column = errortok.beginColumn;
+ String mess = (errortok.kind == 0) ? tokenImage[0] : errortok.image;
+ return new ParseException("Parse error at line " + line + ", column " + column + ". Encountered: " + mess);
+ }
+
+ final public void enable_tracing() {
+ }
+
+ final public void disable_tracing() {
+ }
+
+}
1.2 +122 -122 jakarta-turbine-maven/src/java/org/apache/maven/jrcs/rcs/ArchiveParserConstants.java
Index: ArchiveParserConstants.java
===================================================================
RCS file: /home/cvs/jakarta-turbine-maven/src/java/org/apache/maven/jrcs/rcs/ArchiveParserConstants.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- ArchiveParserConstants.java 20 Feb 2002 16:20:03 -0000 1.1
+++ ArchiveParserConstants.java 20 Feb 2002 22:02:59 -0000 1.2
@@ -1,122 +1,122 @@
-package org.apache.maven.jrcs.rcs;
-
-/* ====================================================================
- * The Apache Software License, Version 1.1
- *
- * Copyright (c) 2001 The Apache Software Foundation. All rights
- * reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- *
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in
- * the documentation and/or other materials provided with the
- * distribution.
- *
- * 3. The end-user documentation included with the redistribution,
- * if any, must include the following acknowledgment:
- * "This product includes software developed by the
- * Apache Software Foundation (http://www.apache.org/)."
- * Alternately, this acknowledgment may appear in the software itself,
- * if and wherever such third-party acknowledgments normally appear.
- *
- * 4. The names "Apache" and "Apache Software Foundation" and
- * "Apache Maven" must not be used to endorse or promote products
- * derived from this software without prior written permission. For
- * written permission, please contact apache@apache.org.
- *
- * 5. Products derived from this software may not be called "Apache",
- * "Apache Maven", nor may "Apache" appear in their name, without
- * prior written permission of the Apache Software Foundation.
- *
- * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
- * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
- * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
- * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
- * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
- * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
- * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- * ====================================================================
- *
- * This software consists of voluntary contributions made by many
- * individuals on behalf of the Apache Software Foundation. For more
- * information on the Apache Software Foundation, please see
- * <http://www.apache.org/>.
- */
-
-public interface ArchiveParserConstants {
-
- int EOF = 0;
- int ACCESS = 6;
- int AUTHOR = 7;
- int BRANCH = 8;
- int BRANCHES = 9;
- int COMMENT = 10;
- int DATE = 11;
- int DESC = 12;
- int EXPAND = 13;
- int HEAD = 14;
- int LOCKS = 15;
- int LOG = 16;
- int NEXT = 17;
- int STATE = 18;
- int STRICT = 19;
- int SYMBOLS = 20;
- int TEXT = 21;
- int ID = 22;
- int SYM = 23;
- int IDCHAR = 24;
- int STRING = 25;
- int LETTER = 26;
- int DIGIT = 27;
- int NUM = 28;
-
- int DEFAULT = 0;
- int PRE_DELTA = 1;
-
- String[] tokenImage = {
- "<EOF>",
- "\" \"",
- "\"\\n\"",
- "\"\\t\"",
- "\"\\r\"",
- "\"\\f\"",
- "\"access\"",
- "\"author\"",
- "\"branch\"",
- "\"branches\"",
- "\"comment\"",
- "\"date\"",
- "\"desc\"",
- "\"expand\"",
- "\"head\"",
- "\"locks\"",
- "\"log\"",
- "\"next\"",
- "\"state\"",
- "\"strict\"",
- "\"symbols\"",
- "\"text\"",
- "<ID>",
- "<SYM>",
- "<IDCHAR>",
- "<STRING>",
- "<LETTER>",
- "<DIGIT>",
- "<NUM>",
- "\";\"",
- "\":\"",
- "\".\"",
- };
-
-}
+package org.apache.maven.jrcs.rcs;
+
+/* ====================================================================
+ * The Apache Software License, Version 1.1
+ *
+ * Copyright (c) 2001 The Apache Software Foundation. All rights
+ * reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * 3. The end-user documentation included with the redistribution,
+ * if any, must include the following acknowledgment:
+ * "This product includes software developed by the
+ * Apache Software Foundation (http://www.apache.org/)."
+ * Alternately, this acknowledgment may appear in the software itself,
+ * if and wherever such third-party acknowledgments normally appear.
+ *
+ * 4. The names "Apache" and "Apache Software Foundation" and
+ * "Apache Maven" must not be used to endorse or promote products
+ * derived from this software without prior written permission. For
+ * written permission, please contact apache@apache.org.
+ *
+ * 5. Products derived from this software may not be called "Apache",
+ * "Apache Maven", nor may "Apache" appear in their name, without
+ * prior written permission of the Apache Software Foundation.
+ *
+ * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
+ * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
+ * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
+ * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
+ * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ * ====================================================================
+ *
+ * This software consists of voluntary contributions made by many
+ * individuals on behalf of the Apache Software Foundation. For more
+ * information on the Apache Software Foundation, please see
+ * <http://www.apache.org/>.
+ */
+
+public interface ArchiveParserConstants {
+
+ int EOF = 0;
+ int ACCESS = 6;
+ int AUTHOR = 7;
+ int BRANCH = 8;
+ int BRANCHES = 9;
+ int COMMENT = 10;
+ int DATE = 11;
+ int DESC = 12;
+ int EXPAND = 13;
+ int HEAD = 14;
+ int LOCKS = 15;
+ int LOG = 16;
+ int NEXT = 17;
+ int STATE = 18;
+ int STRICT = 19;
+ int SYMBOLS = 20;
+ int TEXT = 21;
+ int ID = 22;
+ int SYM = 23;
+ int IDCHAR = 24;
+ int STRING = 25;
+ int LETTER = 26;
+ int DIGIT = 27;
+ int NUM = 28;
+
+ int DEFAULT = 0;
+ int PRE_DELTA = 1;
+
+ String[] tokenImage = {
+ "<EOF>",
+ "\" \"",
+ "\"\\n\"",
+ "\"\\t\"",
+ "\"\\r\"",
+ "\"\\f\"",
+ "\"access\"",
+ "\"author\"",
+ "\"branch\"",
+ "\"branches\"",
+ "\"comment\"",
+ "\"date\"",
+ "\"desc\"",
+ "\"expand\"",
+ "\"head\"",
+ "\"locks\"",
+ "\"log\"",
+ "\"next\"",
+ "\"state\"",
+ "\"strict\"",
+ "\"symbols\"",
+ "\"text\"",
+ "<ID>",
+ "<SYM>",
+ "<IDCHAR>",
+ "<STRING>",
+ "<LETTER>",
+ "<DIGIT>",
+ "<NUM>",
+ "\";\"",
+ "\":\"",
+ "\".\"",
+ };
+
+}
1.2 +896 -896 jakarta-turbine-maven/src/java/org/apache/maven/jrcs/rcs/ArchiveParserTokenManager.java
Index: ArchiveParserTokenManager.java
===================================================================
RCS file: /home/cvs/jakarta-turbine-maven/src/java/org/apache/maven/jrcs/rcs/ArchiveParserTokenManager.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- ArchiveParserTokenManager.java 20 Feb 2002 16:20:03 -0000 1.1
+++ ArchiveParserTokenManager.java 20 Feb 2002 22:02:59 -0000 1.2
@@ -1,896 +1,896 @@
-package org.apache.maven.jrcs.rcs;
-import java.util.*;
-
-public class ArchiveParserTokenManager implements ArchiveParserConstants
-{
-private final int jjStopStringLiteralDfa_0(int pos, long active0)
-{
- switch (pos)
- {
- case 0:
- if ((active0 & 0x3fffc0L) != 0L)
- {
- jjmatchedKind = 22;
- return 14;
- }
- return -1;
- case 1:
- if ((active0 & 0x3fffc0L) != 0L)
- {
- jjmatchedKind = 22;
- jjmatchedPos = 1;
- return 14;
- }
- return -1;
- case 2:
- if ((active0 & 0x10000L) != 0L)
- return 14;
- if ((active0 & 0x3effc0L) != 0L)
- {
- jjmatchedKind = 22;
- jjmatchedPos = 2;
- return 14;
- }
- return -1;
- case 3:
- if ((active0 & 0x225800L) != 0L)
- return 14;
- if ((active0 & 0x1ca7c0L) != 0L)
- {
- jjmatchedKind = 22;
- jjmatchedPos = 3;
- return 14;
- }
- return -1;
- case 4:
- if ((active0 & 0x48000L) != 0L)
- return 14;
- if ((active0 & 0x1827c0L) != 0L)
- {
- jjmatchedKind = 22;
- jjmatchedPos = 4;
- return 14;
- }
- return -1;
- case 5:
- if ((active0 & 0x823c0L) != 0L)
- return 14;
- if ((active0 & 0x100400L) != 0L)
- {
- if (jjmatchedPos != 5)
- {
- jjmatchedKind = 22;
- jjmatchedPos = 5;
- }
- return 14;
- }
- return -1;
- case 6:
- if ((active0 & 0x100400L) != 0L)
- return 14;
- if ((active0 & 0x200L) != 0L)
- {
- jjmatchedKind = 22;
- jjmatchedPos = 6;
- return 14;
- }
- return -1;
- default :
- return -1;
- }
-}
-private final int jjStartNfa_0(int pos, long active0)
-{
- return jjMoveNfa_0(jjStopStringLiteralDfa_0(pos, active0), pos + 1);
-}
-private final int jjStopAtPos(int pos, int kind)
-{
- jjmatchedKind = kind;
- jjmatchedPos = pos;
- return pos + 1;
-}
-private final int jjStartNfaWithStates_0(int pos, int kind, int state)
-{
- 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 46:
- return jjStopAtPos(0, 31);
- case 58:
- return jjStopAtPos(0, 30);
- case 59:
- return jjStopAtPos(0, 29);
- case 97:
- return jjMoveStringLiteralDfa1_0(0xc0L);
- case 98:
- return jjMoveStringLiteralDfa1_0(0x300L);
- case 99:
- return jjMoveStringLiteralDfa1_0(0x400L);
- case 100:
- return jjMoveStringLiteralDfa1_0(0x1800L);
- case 101:
- return jjMoveStringLiteralDfa1_0(0x2000L);
- case 104:
- return jjMoveStringLiteralDfa1_0(0x4000L);
- case 108:
- return jjMoveStringLiteralDfa1_0(0x18000L);
- case 110:
- return jjMoveStringLiteralDfa1_0(0x20000L);
- case 115:
- return jjMoveStringLiteralDfa1_0(0x1c0000L);
- case 116:
- return jjMoveStringLiteralDfa1_0(0x200000L);
- default :
- return jjMoveNfa_0(0, 0);
- }
-}
-private final int jjMoveStringLiteralDfa1_0(long active0)
-{
- try { curChar = input_stream.readChar(); }
- catch(java.io.IOException e) {
- jjStopStringLiteralDfa_0(0, active0);
- return 1;
- }
- switch(curChar)
- {
- case 97:
- return jjMoveStringLiteralDfa2_0(active0, 0x800L);
- case 99:
- return jjMoveStringLiteralDfa2_0(active0, 0x40L);
- case 101:
- return jjMoveStringLiteralDfa2_0(active0, 0x225000L);
- case 111:
- return jjMoveStringLiteralDfa2_0(active0, 0x18400L);
- case 114:
- return jjMoveStringLiteralDfa2_0(active0, 0x300L);
- case 116:
- return jjMoveStringLiteralDfa2_0(active0, 0xc0000L);
- case 117:
- return jjMoveStringLiteralDfa2_0(active0, 0x80L);
- case 120:
- return jjMoveStringLiteralDfa2_0(active0, 0x2000L);
- case 121:
- return jjMoveStringLiteralDfa2_0(active0, 0x100000L);
- default :
- break;
- }
- return jjStartNfa_0(0, active0);
-}
-private final int jjMoveStringLiteralDfa2_0(long old0, long active0)
-{
- if (((active0 &= old0)) == 0L)
- return jjStartNfa_0(0, old0);
- try { curChar = input_stream.readChar(); }
- catch(java.io.IOException e) {
- jjStopStringLiteralDfa_0(1, active0);
- return 2;
- }
- switch(curChar)
- {
- case 97:
- return jjMoveStringLiteralDfa3_0(active0, 0x44300L);
- case 99:
- return jjMoveStringLiteralDfa3_0(active0, 0x8040L);
- case 103:
- if ((active0 & 0x10000L) != 0L)
- return jjStartNfaWithStates_0(2, 16, 14);
- break;
- case 109:
- return jjMoveStringLiteralDfa3_0(active0, 0x100400L);
- case 112:
- return jjMoveStringLiteralDfa3_0(active0, 0x2000L);
- case 114:
- return jjMoveStringLiteralDfa3_0(active0, 0x80000L);
- case 115:
- return jjMoveStringLiteralDfa3_0(active0, 0x1000L);
- case 116:
- return jjMoveStringLiteralDfa3_0(active0, 0x880L);
- case 120:
- return jjMoveStringLiteralDfa3_0(active0, 0x220000L);
- default :
- break;
- }
- return jjStartNfa_0(1, active0);
-}
-private final int jjMoveStringLiteralDfa3_0(long old0, long active0)
-{
- if (((active0 &= old0)) == 0L)
- return jjStartNfa_0(1, old0);
- try { curChar = input_stream.readChar(); }
- catch(java.io.IOException e) {
- jjStopStringLiteralDfa_0(2, active0);
- return 3;
- }
- switch(curChar)
- {
- case 97:
- return jjMoveStringLiteralDfa4_0(active0, 0x2000L);
- case 98:
- return jjMoveStringLiteralDfa4_0(active0, 0x100000L);
- case 99:
- if ((active0 & 0x1000L) != 0L)
- return jjStartNfaWithStates_0(3, 12, 14);
- break;
- case 100:
- if ((active0 & 0x4000L) != 0L)
- return jjStartNfaWithStates_0(3, 14, 14);
- break;
- case 101:
- if ((active0 & 0x800L) != 0L)
- return jjStartNfaWithStates_0(3, 11, 14);
- return jjMoveStringLiteralDfa4_0(active0, 0x40L);
- case 104:
- return jjMoveStringLiteralDfa4_0(active0, 0x80L);
- case 105:
- return jjMoveStringLiteralDfa4_0(active0, 0x80000L);
- case 107:
- return jjMoveStringLiteralDfa4_0(active0, 0x8000L);
- case 109:
- return jjMoveStringLiteralDfa4_0(active0, 0x400L);
- case 110:
- return jjMoveStringLiteralDfa4_0(active0, 0x300L);
- case 116:
- if ((active0 & 0x20000L) != 0L)
- return jjStartNfaWithStates_0(3, 17, 14);
- else if ((active0 & 0x200000L) != 0L)
- return jjStartNfaWithStates_0(3, 21, 14);
- return jjMoveStringLiteralDfa4_0(active0, 0x40000L);
- default :
- break;
- }
- return jjStartNfa_0(2, active0);
-}
-private final int jjMoveStringLiteralDfa4_0(long old0, long active0)
-{
- if (((active0 &= old0)) == 0L)
- return jjStartNfa_0(2, old0);
- try { curChar = input_stream.readChar(); }
- catch(java.io.IOException e) {
- jjStopStringLiteralDfa_0(3, active0);
- return 4;
- }
- switch(curChar)
- {
- case 99:
- return jjMoveStringLiteralDfa5_0(active0, 0x80300L);
- case 101:
- if ((active0 & 0x40000L) != 0L)
- return jjStartNfaWithStates_0(4, 18, 14);
- return jjMoveStringLiteralDfa5_0(active0, 0x400L);
- case 110:
- return jjMoveStringLiteralDfa5_0(active0, 0x2000L);
- case 111:
- return jjMoveStringLiteralDfa5_0(active0, 0x100080L);
- case 115:
- if ((active0 & 0x8000L) != 0L)
- return jjStartNfaWithStates_0(4, 15, 14);
- return jjMoveStringLiteralDfa5_0(active0, 0x40L);
- default :
- break;
- }
- return jjStartNfa_0(3, active0);
-}
-private final int jjMoveStringLiteralDfa5_0(long old0, long active0)
-{
- if (((active0 &= old0)) == 0L)
- return jjStartNfa_0(3, old0);
- try { curChar = input_stream.readChar(); }
- catch(java.io.IOException e) {
- jjStopStringLiteralDfa_0(4, active0);
- return 5;
- }
- switch(curChar)
- {
- case 100:
- if ((active0 & 0x2000L) != 0L)
- return jjStartNfaWithStates_0(5, 13, 14);
- break;
- case 104:
- if ((active0 & 0x100L) != 0L)
- {
- jjmatchedKind = 8;
- jjmatchedPos = 5;
- }
- return jjMoveStringLiteralDfa6_0(active0, 0x200L);
- case 108:
- return jjMoveStringLiteralDfa6_0(active0, 0x100000L);
- case 110:
- return jjMoveStringLiteralDfa6_0(active0, 0x400L);
- case 114:
- if ((active0 & 0x80L) != 0L)
- return jjStartNfaWithStates_0(5, 7, 14);
- break;
- case 115:
- if ((active0 & 0x40L) != 0L)
- return jjStartNfaWithStates_0(5, 6, 14);
- break;
- case 116:
- if ((active0 & 0x80000L) != 0L)
- return jjStartNfaWithStates_0(5, 19, 14);
- break;
- default :
- break;
- }
- return jjStartNfa_0(4, active0);
-}
-private final int jjMoveStringLiteralDfa6_0(long old0, long active0)
-{
- if (((active0 &= old0)) == 0L)
- return jjStartNfa_0(4, old0);
- try { curChar = input_stream.readChar(); }
- catch(java.io.IOException e) {
- jjStopStringLiteralDfa_0(5, active0);
- return 6;
- }
- switch(curChar)
- {
- case 101:
- return jjMoveStringLiteralDfa7_0(active0, 0x200L);
- case 115:
- if ((active0 & 0x100000L) != 0L)
- return jjStartNfaWithStates_0(6, 20, 14);
- break;
- case 116:
- if ((active0 & 0x400L) != 0L)
- return jjStartNfaWithStates_0(6, 10, 14);
- break;
- default :
- break;
- }
- return jjStartNfa_0(5, active0);
-}
-private final int jjMoveStringLiteralDfa7_0(long old0, long active0)
-{
- if (((active0 &= old0)) == 0L)
- return jjStartNfa_0(5, old0);
- try { curChar = input_stream.readChar(); }
- catch(java.io.IOException e) {
- jjStopStringLiteralDfa_0(6, active0);
- return 7;
- }
- switch(curChar)
- {
- case 115:
- if ((active0 & 0x200L) != 0L)
- return jjStartNfaWithStates_0(7, 9, 14);
- break;
- default :
- break;
- }
- return jjStartNfa_0(6, active0);
-}
-private final void jjCheckNAdd(int state)
-{
- if (jjrounds[state] != jjround)
- {
- jjstateSet[jjnewStateCnt++] = state;
- jjrounds[state] = jjround;
- }
-}
-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
-};
-static final long[] jjbitVec2 = {
- 0x0L, 0x0L, 0xffffffffffffffffL, 0xffffffffffffffffL
-};
-static final long[] jjbitVec3 = {
- 0x1ff00000fffffffeL, 0xffffffffffffc000L, 0xffffffffL, 0x600000000000000L
-};
-static final long[] jjbitVec4 = {
- 0x0L, 0x0L, 0x0L, 0xff7fffffff7fffffL
-};
-static final long[] jjbitVec5 = {
- 0x0L, 0xffffffffffffffffL, 0xffffffffffffffffL, 0xffffffffffffffffL
-};
-static final long[] jjbitVec6 = {
- 0xffffffffffffffffL, 0xffffffffffffffffL, 0xffffL, 0x0L
-};
-static final long[] jjbitVec7 = {
- 0xffffffffffffffffL, 0xffffffffffffffffL, 0x0L, 0x0L
-};
-static final long[] jjbitVec8 = {
- 0x3fffffffffffL, 0x0L, 0x0L, 0x0L
-};
-private final int jjMoveNfa_0(int startState, int curPos)
-{
- int[] nextStates;
- int startsAt = 0;
- jjnewStateCnt = 14;
- int i = 1;
- jjstateSet[0] = startState;
- int j, kind = 0x7fffffff;
- for (;;)
- {
- if (++jjround == 0x7fffffff)
- ReInitRounds();
- if (curChar < 64)
- {
- long l = 1L << curChar;
- MatchLoop: do
- {
- switch(jjstateSet[--i])
- {
- case 0:
- if ((0x3ff000000000000L & l) != 0L)
- {
- if (kind > 28)
- kind = 28;
- jjCheckNAddStates(0, 4);
- }
- else if (curChar == 36)
- {
- if (kind > 22)
- kind = 22;
- jjCheckNAddStates(5, 8);
- }
- break;
- case 14:
- if ((0x3ff000000000000L & l) != 0L)
- {
- if (kind > 23)
- kind = 23;
- jjCheckNAddTwoStates(10, 11);
- }
- else if (curChar == 36)
- {
- if (kind > 23)
- kind = 23;
- jjCheckNAddTwoStates(10, 11);
- }
- if ((0x3ff000000000000L & l) != 0L)
- {
- if (kind > 22)
- kind = 22;
- jjCheckNAddTwoStates(7, 8);
- }
- else if (curChar == 36)
- {
- if (kind > 22)
- kind = 22;
- jjCheckNAddTwoStates(7, 8);
- }
- break;
- case 1:
- jjAddStates(9, 11);
- break;
- case 5:
- if ((0x3ff000000000000L & l) == 0L)
- break;
- if (kind > 28)
- kind = 28;
- jjCheckNAddStates(0, 4);
- break;
- case 6:
- if ((0x3ff000000000000L & l) != 0L)
- jjCheckNAddTwoStates(6, 7);
- break;
- case 7:
- if (curChar != 36)
- break;
- if (kind > 22)
- kind = 22;
- jjCheckNAddTwoStates(7, 8);
- break;
- case 8:
- if ((0x3ff000000000000L & l) == 0L)
- break;
- if (kind > 22)
- kind = 22;
- jjCheckNAddTwoStates(7, 8);
- break;
- case 9:
- if ((0x3ff000000000000L & l) != 0L)
- jjCheckNAddTwoStates(9, 10);
- break;
- case 10:
- if (curChar != 36)
- break;
- if (kind > 23)
- kind = 23;
- jjCheckNAddTwoStates(10, 11);
- break;
- case 11:
- if ((0x3ff000000000000L & l) == 0L)
- break;
- if (kind > 23)
- kind = 23;
- jjCheckNAddTwoStates(10, 11);
- break;
- case 12:
- if ((0x3ff000000000000L & l) == 0L)
- break;
- if (kind > 28)
- kind = 28;
- jjCheckNAdd(12);
- break;
- case 13:
- if (curChar != 36)
- break;
- if (kind > 22)
- kind = 22;
- jjCheckNAddStates(5, 8);
- break;
- default : break;
- }
- } while(i != startsAt);
- }
- else if (curChar < 128)
- {
- long l = 1L << (curChar & 077);
- MatchLoop: do
- {
- switch(jjstateSet[--i])
- {
- case 0:
- if ((0x7fffffe87fffffeL & l) != 0L)
- {
- if (kind > 22)
- kind = 22;
- jjCheckNAddStates(5, 8);
- }
- else if (curChar == 64)
- jjCheckNAddStates(9, 11);
- break;
- case 14:
- if ((0x7fffffe87fffffeL & l) != 0L)
- {
- if (kind > 23)
- kind = 23;
- jjCheckNAddTwoStates(10, 11);
- }
- if ((0x7fffffe87fffffeL & l) != 0L)
- {
- if (kind > 22)
- kind = 22;
- jjCheckNAddTwoStates(7, 8);
- }
- break;
- case 1:
- if ((0xfffffffffffffffeL & l) != 0L)
- jjCheckNAddStates(9, 11);
- break;
- case 2:
- if (curChar == 64)
- jjCheckNAddStates(9, 11);
- break;
- case 3:
- if (curChar == 64)
- jjstateSet[jjnewStateCnt++] = 2;
- break;
- case 4:
- if (curChar == 64 && kind > 25)
- kind = 25;
- break;
- case 7:
- if ((0x7fffffe87fffffeL & l) == 0L)
- break;
- if (kind > 22)
- kind = 22;
- jjCheckNAddTwoStates(7, 8);
- break;
- case 10:
- if ((0x7fffffe87fffffeL & l) == 0L)
- break;
- if (kind > 23)
- kind = 23;
- jjCheckNAddTwoStates(10, 11);
- break;
- case 13:
- if ((0x7fffffe87fffffeL & l) == 0L)
- break;
- if (kind > 22)
- kind = 22;
- jjCheckNAddStates(5, 8);
- break;
- default : break;
- }
- } while(i != startsAt);
- }
- else
- {
- int hiByte = (int)(curChar >> 8);
- int i1 = hiByte >> 6;
- long l1 = 1L << (hiByte & 077);
- int i2 = (curChar & 0xff) >> 6;
- long l2 = 1L << (curChar & 077);
- MatchLoop: do
- {
- switch(jjstateSet[--i])
- {
- case 0:
- if (!jjCanMove_1(hiByte, i1, i2, l1, l2))
- break;
- if (kind > 22)
- kind = 22;
- jjCheckNAddStates(5, 8);
- break;
- case 14:
- if (jjCanMove_1(hiByte, i1, i2, l1, l2))
- {
- if (kind > 22)
- kind = 22;
- jjCheckNAddTwoStates(7, 8);
- }
- if (jjCanMove_1(hiByte, i1, i2, l1, l2))
- {
- if (kind > 23)
- kind = 23;
- jjCheckNAddTwoStates(10, 11);
- }
- break;
- case 1:
- if (jjCanMove_0(hiByte, i1, i2, l1, l2))
- jjAddStates(9, 11);
- break;
- case 7:
- if (!jjCanMove_1(hiByte, i1, i2, l1, l2))
- break;
- if (kind > 22)
- kind = 22;
- jjCheckNAddTwoStates(7, 8);
- break;
- case 10:
- if (!jjCanMove_1(hiByte, i1, i2, l1, l2))
- break;
- if (kind > 23)
- kind = 23;
- jjCheckNAddTwoStates(10, 11);
- break;
- default : break;
- }
- } while(i != startsAt);
- }
- if (kind != 0x7fffffff)
- {
- jjmatchedKind = kind;
- jjmatchedPos = curPos;
- kind = 0x7fffffff;
- }
- ++curPos;
- if ((i = jjnewStateCnt) == (startsAt = 14 - (jjnewStateCnt = startsAt)))
- return curPos;
- try { curChar = input_stream.readChar(); }
- catch(java.io.IOException e) { return curPos; }
- }
-}
-private final int jjMoveStringLiteralDfa0_1()
-{
- switch(curChar)
- {
- default :
- return 1;
- }
-}
-static final int[] jjnextStates = {
- 6, 7, 9, 10, 12, 7, 8, 10, 11, 1, 3, 4,
-};
-private static final boolean jjCanMove_0(int hiByte, int i1, int i2, long l1, long l2)
-{
- switch(hiByte)
- {
- case 0:
- return ((jjbitVec2[i2] & l2) != 0L);
- default :
- if ((jjbitVec0[i1] & l1) != 0L)
- return true;
- return false;
- }
-}
-private static final boolean jjCanMove_1(int hiByte, int i1, int i2, long l1, long l2)
-{
- switch(hiByte)
- {
- case 0:
- return ((jjbitVec4[i2] & l2) != 0L);
- case 48:
- return ((jjbitVec5[i2] & l2) != 0L);
- case 49:
- return ((jjbitVec6[i2] & l2) != 0L);
- case 51:
- return ((jjbitVec7[i2] & l2) != 0L);
- case 61:
- return ((jjbitVec8[i2] & l2) != 0L);
- default :
- if ((jjbitVec3[i1] & l1) != 0L)
- return true;
- return false;
- }
-}
-public static final String[] jjstrLiteralImages = {
-"", null, null, null, null, null, "\141\143\143\145\163\163",
-"\141\165\164\150\157\162", "\142\162\141\156\143\150", "\142\162\141\156\143\150\145\163",
-"\143\157\155\155\145\156\164", "\144\141\164\145", "\144\145\163\143", "\145\170\160\141\156\144",
-"\150\145\141\144", "\154\157\143\153\163", "\154\157\147", "\156\145\170\164",
-"\163\164\141\164\145", "\163\164\162\151\143\164", "\163\171\155\142\157\154\163",
-"\164\145\170\164", null, null, null, null, null, null, null, "\73", "\72", "\56", };
-public static final String[] lexStateNames = {
- "DEFAULT",
- "PRE_DELTA",
-};
-public static final int[] jjnewLexState = {
- -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, -1, -1,
-};
-static final long[] jjtoToken = {
- 0xf3ffffc1L,
-};
-static final long[] jjtoSkip = {
- 0x3eL,
-};
-private ASCII_UCodeESC_CharStream input_stream;
-private final int[] jjrounds = new int[14];
-private final int[] jjstateSet = new int[28];
-protected char curChar;
-public ArchiveParserTokenManager(ASCII_UCodeESC_CharStream stream)
-{
- if (ASCII_UCodeESC_CharStream.staticFlag)
- throw new Error("ERROR: Cannot use a static CharStream class with a non-static lexical analyzer.");
- input_stream = stream;
-}
-public ArchiveParserTokenManager(ASCII_UCodeESC_CharStream stream, int lexState)
-{
- this(stream);
- SwitchTo(lexState);
-}
-public void ReInit(ASCII_UCodeESC_CharStream stream)
-{
- jjmatchedPos = jjnewStateCnt = 0;
- curLexState = defaultLexState;
- input_stream = stream;
- ReInitRounds();
-}
-private final void ReInitRounds()
-{
- int i;
- jjround = 0x80000001;
- for (i = 14; i-- > 0;)
- jjrounds[i] = 0x80000000;
-}
-public void ReInit(ASCII_UCodeESC_CharStream stream, int lexState)
-{
- ReInit(stream);
- SwitchTo(lexState);
-}
-public void SwitchTo(int lexState)
-{
- if (lexState >= 2 || lexState < 0)
- throw new TokenMgrError("Error: Ignoring invalid lexical state : " + lexState + ". State unchanged.", TokenMgrError.INVALID_LEXICAL_STATE);
- else
- curLexState = lexState;
-}
-
-private final Token jjFillToken()
-{
- Token t = Token.newToken(jjmatchedKind);
- t.kind = jjmatchedKind;
- 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();
- return t;
-}
-
-int curLexState = 0;
-int defaultLexState = 0;
-int jjnewStateCnt;
-int jjround;
-int jjmatchedPos;
-int jjmatchedKind;
-
-public final Token getNextToken()
-{
- int kind;
- Token specialToken = null;
- Token matchedToken;
- int curPos = 0;
-
- EOFLoop :
- for (;;)
- {
- try
- {
- curChar = input_stream.BeginToken();
- }
- catch(java.io.IOException e)
- {
- jjmatchedKind = 0;
- matchedToken = jjFillToken();
- return matchedToken;
- }
-
- switch(curLexState)
- {
- case 0:
- try { input_stream.backup(0);
- while (curChar <= 32 && (0x100003600L & (1L << curChar)) != 0L)
- curChar = input_stream.BeginToken();
- }
- catch (java.io.IOException e1) { continue EOFLoop; }
- jjmatchedKind = 0x7fffffff;
- jjmatchedPos = 0;
- curPos = jjMoveStringLiteralDfa0_0();
- break;
- case 1:
- try { input_stream.backup(0);
- while (curChar <= 32 && (0x100003600L & (1L << curChar)) != 0L)
- curChar = input_stream.BeginToken();
- }
- catch (java.io.IOException e1) { continue EOFLoop; }
- jjmatchedKind = 0x7fffffff;
- jjmatchedPos = 0;
- curPos = jjMoveStringLiteralDfa0_1();
- break;
- }
- if (jjmatchedKind != 0x7fffffff)
- {
- if (jjmatchedPos + 1 < curPos)
- input_stream.backup(curPos - jjmatchedPos - 1);
- if ((jjtoToken[jjmatchedKind >> 6] & (1L << (jjmatchedKind & 077))) != 0L)
- {
- matchedToken = jjFillToken();
- if (jjnewLexState[jjmatchedKind] != -1)
- curLexState = jjnewLexState[jjmatchedKind];
- return matchedToken;
- }
- else
- {
- if (jjnewLexState[jjmatchedKind] != -1)
- curLexState = jjnewLexState[jjmatchedKind];
- continue EOFLoop;
- }
- }
- int error_line = input_stream.getEndLine();
- int error_column = input_stream.getEndColumn();
- String error_after = null;
- boolean EOFSeen = false;
- try { input_stream.readChar(); input_stream.backup(1); }
- catch (java.io.IOException e1) {
- EOFSeen = true;
- error_after = curPos <= 1 ? "" : input_stream.GetImage();
- if (curChar == '\n' || curChar == '\r') {
- error_line++;
- error_column = 0;
- }
- else
- error_column++;
- }
- if (!EOFSeen) {
- input_stream.backup(1);
- error_after = curPos <= 1 ? "" : input_stream.GetImage();
- }
- throw new TokenMgrError(EOFSeen, curLexState, error_line, error_column, error_after, curChar, TokenMgrError.LEXICAL_ERROR);
- }
-}
-
-}
+package org.apache.maven.jrcs.rcs;
+import java.util.*;
+
+public class ArchiveParserTokenManager implements ArchiveParserConstants
+{
+private final int jjStopStringLiteralDfa_0(int pos, long active0)
+{
+ switch (pos)
+ {
+ case 0:
+ if ((active0 & 0x3fffc0L) != 0L)
+ {
+ jjmatchedKind = 22;
+ return 14;
+ }
+ return -1;
+ case 1:
+ if ((active0 & 0x3fffc0L) != 0L)
+ {
+ jjmatchedKind = 22;
+ jjmatchedPos = 1;
+ return 14;
+ }
+ return -1;
+ case 2:
+ if ((active0 & 0x10000L) != 0L)
+ return 14;
+ if ((active0 & 0x3effc0L) != 0L)
+ {
+ jjmatchedKind = 22;
+ jjmatchedPos = 2;
+ return 14;
+ }
+ return -1;
+ case 3:
+ if ((active0 & 0x225800L) != 0L)
+ return 14;
+ if ((active0 & 0x1ca7c0L) != 0L)
+ {
+ jjmatchedKind = 22;
+ jjmatchedPos = 3;
+ return 14;
+ }
+ return -1;
+ case 4:
+ if ((active0 & 0x48000L) != 0L)
+ return 14;
+ if ((active0 & 0x1827c0L) != 0L)
+ {
+ jjmatchedKind = 22;
+ jjmatchedPos = 4;
+ return 14;
+ }
+ return -1;
+ case 5:
+ if ((active0 & 0x823c0L) != 0L)
+ return 14;
+ if ((active0 & 0x100400L) != 0L)
+ {
+ if (jjmatchedPos != 5)
+ {
+ jjmatchedKind = 22;
+ jjmatchedPos = 5;
+ }
+ return 14;
+ }
+ return -1;
+ case 6:
+ if ((active0 & 0x100400L) != 0L)
+ return 14;
+ if ((active0 & 0x200L) != 0L)
+ {
+ jjmatchedKind = 22;
+ jjmatchedPos = 6;
+ return 14;
+ }
+ return -1;
+ default :
+ return -1;
+ }
+}
+private final int jjStartNfa_0(int pos, long active0)
+{
+ return jjMoveNfa_0(jjStopStringLiteralDfa_0(pos, active0), pos + 1);
+}
+private final int jjStopAtPos(int pos, int kind)
+{
+ jjmatchedKind = kind;
+ jjmatchedPos = pos;
+ return pos + 1;
+}
+private final int jjStartNfaWithStates_0(int pos, int kind, int state)
+{
+ 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 46:
+ return jjStopAtPos(0, 31);
+ case 58:
+ return jjStopAtPos(0, 30);
+ case 59:
+ return jjStopAtPos(0, 29);
+ case 97:
+ return jjMoveStringLiteralDfa1_0(0xc0L);
+ case 98:
+ return jjMoveStringLiteralDfa1_0(0x300L);
+ case 99:
+ return jjMoveStringLiteralDfa1_0(0x400L);
+ case 100:
+ return jjMoveStringLiteralDfa1_0(0x1800L);
+ case 101:
+ return jjMoveStringLiteralDfa1_0(0x2000L);
+ case 104:
+ return jjMoveStringLiteralDfa1_0(0x4000L);
+ case 108:
+ return jjMoveStringLiteralDfa1_0(0x18000L);
+ case 110:
+ return jjMoveStringLiteralDfa1_0(0x20000L);
+ case 115:
+ return jjMoveStringLiteralDfa1_0(0x1c0000L);
+ case 116:
+ return jjMoveStringLiteralDfa1_0(0x200000L);
+ default :
+ return jjMoveNfa_0(0, 0);
+ }
+}
+private final int jjMoveStringLiteralDfa1_0(long active0)
+{
+ try { curChar = input_stream.readChar(); }
+ catch(java.io.IOException e) {
+ jjStopStringLiteralDfa_0(0, active0);
+ return 1;
+ }
+ switch(curChar)
+ {
+ case 97:
+ return jjMoveStringLiteralDfa2_0(active0, 0x800L);
+ case 99:
+ return jjMoveStringLiteralDfa2_0(active0, 0x40L);
+ case 101:
+ return jjMoveStringLiteralDfa2_0(active0, 0x225000L);
+ case 111:
+ return jjMoveStringLiteralDfa2_0(active0, 0x18400L);
+ case 114:
+ return jjMoveStringLiteralDfa2_0(active0, 0x300L);
+ case 116:
+ return jjMoveStringLiteralDfa2_0(active0, 0xc0000L);
+ case 117:
+ return jjMoveStringLiteralDfa2_0(active0, 0x80L);
+ case 120:
+ return jjMoveStringLiteralDfa2_0(active0, 0x2000L);
+ case 121:
+ return jjMoveStringLiteralDfa2_0(active0, 0x100000L);
+ default :
+ break;
+ }
+ return jjStartNfa_0(0, active0);
+}
+private final int jjMoveStringLiteralDfa2_0(long old0, long active0)
+{
+ if (((active0 &= old0)) == 0L)
+ return jjStartNfa_0(0, old0);
+ try { curChar = input_stream.readChar(); }
+ catch(java.io.IOException e) {
+ jjStopStringLiteralDfa_0(1, active0);
+ return 2;
+ }
+ switch(curChar)
+ {
+ case 97:
+ return jjMoveStringLiteralDfa3_0(active0, 0x44300L);
+ case 99:
+ return jjMoveStringLiteralDfa3_0(active0, 0x8040L);
+ case 103:
+ if ((active0 & 0x10000L) != 0L)
+ return jjStartNfaWithStates_0(2, 16, 14);
+ break;
+ case 109:
+ return jjMoveStringLiteralDfa3_0(active0, 0x100400L);
+ case 112:
+ return jjMoveStringLiteralDfa3_0(active0, 0x2000L);
+ case 114:
+ return jjMoveStringLiteralDfa3_0(active0, 0x80000L);
+ case 115:
+ return jjMoveStringLiteralDfa3_0(active0, 0x1000L);
+ case 116:
+ return jjMoveStringLiteralDfa3_0(active0, 0x880L);
+ case 120:
+ return jjMoveStringLiteralDfa3_0(active0, 0x220000L);
+ default :
+ break;
+ }
+ return jjStartNfa_0(1, active0);
+}
+private final int jjMoveStringLiteralDfa3_0(long old0, long active0)
+{
+ if (((active0 &= old0)) == 0L)
+ return jjStartNfa_0(1, old0);
+ try { curChar = input_stream.readChar(); }
+ catch(java.io.IOException e) {
+ jjStopStringLiteralDfa_0(2, active0);
+ return 3;
+ }
+ switch(curChar)
+ {
+ case 97:
+ return jjMoveStringLiteralDfa4_0(active0, 0x2000L);
+ case 98:
+ return jjMoveStringLiteralDfa4_0(active0, 0x100000L);
+ case 99:
+ if ((active0 & 0x1000L) != 0L)
+ return jjStartNfaWithStates_0(3, 12, 14);
+ break;
+ case 100:
+ if ((active0 & 0x4000L) != 0L)
+ return jjStartNfaWithStates_0(3, 14, 14);
+ break;
+ case 101:
+ if ((active0 & 0x800L) != 0L)
+ return jjStartNfaWithStates_0(3, 11, 14);
+ return jjMoveStringLiteralDfa4_0(active0, 0x40L);
+ case 104:
+ return jjMoveStringLiteralDfa4_0(active0, 0x80L);
+ case 105:
+ return jjMoveStringLiteralDfa4_0(active0, 0x80000L);
+ case 107:
+ return jjMoveStringLiteralDfa4_0(active0, 0x8000L);
+ case 109:
+ return jjMoveStringLiteralDfa4_0(active0, 0x400L);
+ case 110:
+ return jjMoveStringLiteralDfa4_0(active0, 0x300L);
+ case 116:
+ if ((active0 & 0x20000L) != 0L)
+ return jjStartNfaWithStates_0(3, 17, 14);
+ else if ((active0 & 0x200000L) != 0L)
+ return jjStartNfaWithStates_0(3, 21, 14);
+ return jjMoveStringLiteralDfa4_0(active0, 0x40000L);
+ default :
+ break;
+ }
+ return jjStartNfa_0(2, active0);
+}
+private final int jjMoveStringLiteralDfa4_0(long old0, long active0)
+{
+ if (((active0 &= old0)) == 0L)
+ return jjStartNfa_0(2, old0);
+ try { curChar = input_stream.readChar(); }
+ catch(java.io.IOException e) {
+ jjStopStringLiteralDfa_0(3, active0);
+ return 4;
+ }
+ switch(curChar)
+ {
+ case 99:
+ return jjMoveStringLiteralDfa5_0(active0, 0x80300L);
+ case 101:
+ if ((active0 & 0x40000L) != 0L)
+ return jjStartNfaWithStates_0(4, 18, 14);
+ return jjMoveStringLiteralDfa5_0(active0, 0x400L);
+ case 110:
+ return jjMoveStringLiteralDfa5_0(active0, 0x2000L);
+ case 111:
+ return jjMoveStringLiteralDfa5_0(active0, 0x100080L);
+ case 115:
+ if ((active0 & 0x8000L) != 0L)
+ return jjStartNfaWithStates_0(4, 15, 14);
+ return jjMoveStringLiteralDfa5_0(active0, 0x40L);
+ default :
+ break;
+ }
+ return jjStartNfa_0(3, active0);
+}
+private final int jjMoveStringLiteralDfa5_0(long old0, long active0)
+{
+ if (((active0 &= old0)) == 0L)
+ return jjStartNfa_0(3, old0);
+ try { curChar = input_stream.readChar(); }
+ catch(java.io.IOException e) {
+ jjStopStringLiteralDfa_0(4, active0);
+ return 5;
+ }
+ switch(curChar)
+ {
+ case 100:
+ if ((active0 & 0x2000L) != 0L)
+ return jjStartNfaWithStates_0(5, 13, 14);
+ break;
+ case 104:
+ if ((active0 & 0x100L) != 0L)
+ {
+ jjmatchedKind = 8;
+ jjmatchedPos = 5;
+ }
+ return jjMoveStringLiteralDfa6_0(active0, 0x200L);
+ case 108:
+ return jjMoveStringLiteralDfa6_0(active0, 0x100000L);
+ case 110:
+ return jjMoveStringLiteralDfa6_0(active0, 0x400L);
+ case 114:
+ if ((active0 & 0x80L) != 0L)
+ return jjStartNfaWithStates_0(5, 7, 14);
+ break;
+ case 115:
+ if ((active0 & 0x40L) != 0L)
+ return jjStartNfaWithStates_0(5, 6, 14);
+ break;
+ case 116:
+ if ((active0 & 0x80000L) != 0L)
+ return jjStartNfaWithStates_0(5, 19, 14);
+ break;
+ default :
+ break;
+ }
+ return jjStartNfa_0(4, active0);
+}
+private final int jjMoveStringLiteralDfa6_0(long old0, long active0)
+{
+ if (((active0 &= old0)) == 0L)
+ return jjStartNfa_0(4, old0);
+ try { curChar = input_stream.readChar(); }
+ catch(java.io.IOException e) {
+ jjStopStringLiteralDfa_0(5, active0);
+ return 6;
+ }
+ switch(curChar)
+ {
+ case 101:
+ return jjMoveStringLiteralDfa7_0(active0, 0x200L);
+ case 115:
+ if ((active0 & 0x100000L) != 0L)
+ return jjStartNfaWithStates_0(6, 20, 14);
+ break;
+ case 116:
+ if ((active0 & 0x400L) != 0L)
+ return jjStartNfaWithStates_0(6, 10, 14);
+ break;
+ default :
+ break;
+ }
+ return jjStartNfa_0(5, active0);
+}
+private final int jjMoveStringLiteralDfa7_0(long old0, long active0)
+{
+ if (((active0 &= old0)) == 0L)
+ return jjStartNfa_0(5, old0);
+ try { curChar = input_stream.readChar(); }
+ catch(java.io.IOException e) {
+ jjStopStringLiteralDfa_0(6, active0);
+ return 7;
+ }
+ switch(curChar)
+ {
+ case 115:
+ if ((active0 & 0x200L) != 0L)
+ return jjStartNfaWithStates_0(7, 9, 14);
+ break;
+ default :
+ break;
+ }
+ return jjStartNfa_0(6, active0);
+}
+private final void jjCheckNAdd(int state)
+{
+ if (jjrounds[state] != jjround)
+ {
+ jjstateSet[jjnewStateCnt++] = state;
+ jjrounds[state] = jjround;
+ }
+}
+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
+};
+static final long[] jjbitVec2 = {
+ 0x0L, 0x0L, 0xffffffffffffffffL, 0xffffffffffffffffL
+};
+static final long[] jjbitVec3 = {
+ 0x1ff00000fffffffeL, 0xffffffffffffc000L, 0xffffffffL, 0x600000000000000L
+};
+static final long[] jjbitVec4 = {
+ 0x0L, 0x0L, 0x0L, 0xff7fffffff7fffffL
+};
+static final long[] jjbitVec5 = {
+ 0x0L, 0xffffffffffffffffL, 0xffffffffffffffffL, 0xffffffffffffffffL
+};
+static final long[] jjbitVec6 = {
+ 0xffffffffffffffffL, 0xffffffffffffffffL, 0xffffL, 0x0L
+};
+static final long[] jjbitVec7 = {
+ 0xffffffffffffffffL, 0xffffffffffffffffL, 0x0L, 0x0L
+};
+static final long[] jjbitVec8 = {
+ 0x3fffffffffffL, 0x0L, 0x0L, 0x0L
+};
+private final int jjMoveNfa_0(int startState, int curPos)
+{
+ int[] nextStates;
+ int startsAt = 0;
+ jjnewStateCnt = 14;
+ int i = 1;
+ jjstateSet[0] = startState;
+ int j, kind = 0x7fffffff;
+ for (;;)
+ {
+ if (++jjround == 0x7fffffff)
+ ReInitRounds();
+ if (curChar < 64)
+ {
+ long l = 1L << curChar;
+ MatchLoop: do
+ {
+ switch(jjstateSet[--i])
+ {
+ case 0:
+ if ((0x3ff000000000000L & l) != 0L)
+ {
+ if (kind > 28)
+ kind = 28;
+ jjCheckNAddStates(0, 4);
+ }
+ else if (curChar == 36)
+ {
+ if (kind > 22)
+ kind = 22;
+ jjCheckNAddStates(5, 8);
+ }
+ break;
+ case 14:
+ if ((0x3ff000000000000L & l) != 0L)
+ {
+ if (kind > 23)
+ kind = 23;
+ jjCheckNAddTwoStates(10, 11);
+ }
+ else if (curChar == 36)
+ {
+ if (kind > 23)
+ kind = 23;
+ jjCheckNAddTwoStates(10, 11);
+ }
+ if ((0x3ff000000000000L & l) != 0L)
+ {
+ if (kind > 22)
+ kind = 22;
+ jjCheckNAddTwoStates(7, 8);
+ }
+ else if (curChar == 36)
+ {
+ if (kind > 22)
+ kind = 22;
+ jjCheckNAddTwoStates(7, 8);
+ }
+ break;
+ case 1:
+ jjAddStates(9, 11);
+ break;
+ case 5:
+ if ((0x3ff000000000000L & l) == 0L)
+ break;
+ if (kind > 28)
+ kind = 28;
+ jjCheckNAddStates(0, 4);
+ break;
+ case 6:
+ if ((0x3ff000000000000L & l) != 0L)
+ jjCheckNAddTwoStates(6, 7);
+ break;
+ case 7:
+ if (curChar != 36)
+ break;
+ if (kind > 22)
+ kind = 22;
+ jjCheckNAddTwoStates(7, 8);
+ break;
+ case 8:
+ if ((0x3ff000000000000L & l) == 0L)
+ break;
+ if (kind > 22)
+ kind = 22;
+ jjCheckNAddTwoStates(7, 8);
+ break;
+ case 9:
+ if ((0x3ff000000000000L & l) != 0L)
+ jjCheckNAddTwoStates(9, 10);
+ break;
+ case 10:
+ if (curChar != 36)
+ break;
+ if (kind > 23)
+ kind = 23;
+ jjCheckNAddTwoStates(10, 11);
+ break;
+ case 11:
+ if ((0x3ff000000000000L & l) == 0L)
+ break;
+ if (kind > 23)
+ kind = 23;
+ jjCheckNAddTwoStates(10, 11);
+ break;
+ case 12:
+ if ((0x3ff000000000000L & l) == 0L)
+ break;
+ if (kind > 28)
+ kind = 28;
+ jjCheckNAdd(12);
+ break;
+ case 13:
+ if (curChar != 36)
+ break;
+ if (kind > 22)
+ kind = 22;
+ jjCheckNAddStates(5, 8);
+ break;
+ default : break;
+ }
+ } while(i != startsAt);
+ }
+ else if (curChar < 128)
+ {
+ long l = 1L << (curChar & 077);
+ MatchLoop: do
+ {
+ switch(jjstateSet[--i])
+ {
+ case 0:
+ if ((0x7fffffe87fffffeL & l) != 0L)
+ {
+ if (kind > 22)
+ kind = 22;
+ jjCheckNAddStates(5, 8);
+ }
+ else if (curChar == 64)
+ jjCheckNAddStates(9, 11);
+ break;
+ case 14:
+ if ((0x7fffffe87fffffeL & l) != 0L)
+ {
+ if (kind > 23)
+ kind = 23;
+ jjCheckNAddTwoStates(10, 11);
+ }
+ if ((0x7fffffe87fffffeL & l) != 0L)
+ {
+ if (kind > 22)
+ kind = 22;
+ jjCheckNAddTwoStates(7, 8);
+ }
+ break;
+ case 1:
+ if ((0xfffffffffffffffeL & l) != 0L)
+ jjCheckNAddStates(9, 11);
+ break;
+ case 2:
+ if (curChar == 64)
+ jjCheckNAddStates(9, 11);
+ break;
+ case 3:
+ if (curChar == 64)
+ jjstateSet[jjnewStateCnt++] = 2;
+ break;
+ case 4:
+ if (curChar == 64 && kind > 25)
+ kind = 25;
+ break;
+ case 7:
+ if ((0x7fffffe87fffffeL & l) == 0L)
+ break;
+ if (kind > 22)
+ kind = 22;
+ jjCheckNAddTwoStates(7, 8);
+ break;
+ case 10:
+ if ((0x7fffffe87fffffeL & l) == 0L)
+ break;
+ if (kind > 23)
+ kind = 23;
+ jjCheckNAddTwoStates(10, 11);
+ break;
+ case 13:
+ if ((0x7fffffe87fffffeL & l) == 0L)
+ break;
+ if (kind > 22)
+ kind = 22;
+ jjCheckNAddStates(5, 8);
+ break;
+ default : break;
+ }
+ } while(i != startsAt);
+ }
+ else
+ {
+ int hiByte = (int)(curChar >> 8);
+ int i1 = hiByte >> 6;
+ long l1 = 1L << (hiByte & 077);
+ int i2 = (curChar & 0xff) >> 6;
+ long l2 = 1L << (curChar & 077);
+ MatchLoop: do
+ {
+ switch(jjstateSet[--i])
+ {
+ case 0:
+ if (!jjCanMove_1(hiByte, i1, i2, l1, l2))
+ break;
+ if (kind > 22)
+ kind = 22;
+ jjCheckNAddStates(5, 8);
+ break;
+ case 14:
+ if (jjCanMove_1(hiByte, i1, i2, l1, l2))
+ {
+ if (kind > 22)
+ kind = 22;
+ jjCheckNAddTwoStates(7, 8);
+ }
+ if (jjCanMove_1(hiByte, i1, i2, l1, l2))
+ {
+ if (kind > 23)
+ kind = 23;
+ jjCheckNAddTwoStates(10, 11);
+ }
+ break;
+ case 1:
+ if (jjCanMove_0(hiByte, i1, i2, l1, l2))
+ jjAddStates(9, 11);
+ break;
+ case 7:
+ if (!jjCanMove_1(hiByte, i1, i2, l1, l2))
+ break;
+ if (kind > 22)
+ kind = 22;
+ jjCheckNAddTwoStates(7, 8);
+ break;
+ case 10:
+ if (!jjCanMove_1(hiByte, i1, i2, l1, l2))
+ break;
+ if (kind > 23)
+ kind = 23;
+ jjCheckNAddTwoStates(10, 11);
+ break;
+ default : break;
+ }
+ } while(i != startsAt);
+ }
+ if (kind != 0x7fffffff)
+ {
+ jjmatchedKind = kind;
+ jjmatchedPos = curPos;
+ kind = 0x7fffffff;
+ }
+ ++curPos;
+ if ((i = jjnewStateCnt) == (startsAt = 14 - (jjnewStateCnt = startsAt)))
+ return curPos;
+ try { curChar = input_stream.readChar(); }
+ catch(java.io.IOException e) { return curPos; }
+ }
+}
+private final int jjMoveStringLiteralDfa0_1()
+{
+ switch(curChar)
+ {
+ default :
+ return 1;
+ }
+}
+static final int[] jjnextStates = {
+ 6, 7, 9, 10, 12, 7, 8, 10, 11, 1, 3, 4,
+};
+private static final boolean jjCanMove_0(int hiByte, int i1, int i2, long l1, long l2)
+{
+ switch(hiByte)
+ {
+ case 0:
+ return ((jjbitVec2[i2] & l2) != 0L);
+ default :
+ if ((jjbitVec0[i1] & l1) != 0L)
+ return true;
+ return false;
+ }
+}
+private static final boolean jjCanMove_1(int hiByte, int i1, int i2, long l1, long l2)
+{
+ switch(hiByte)
+ {
+ case 0:
+ return ((jjbitVec4[i2] & l2) != 0L);
+ case 48:
+ return ((jjbitVec5[i2] & l2) != 0L);
+ case 49:
+ return ((jjbitVec6[i2] & l2) != 0L);
+ case 51:
+ return ((jjbitVec7[i2] & l2) != 0L);
+ case 61:
+ return ((jjbitVec8[i2] & l2) != 0L);
+ default :
+ if ((jjbitVec3[i1] & l1) != 0L)
+ return true;
+ return false;
+ }
+}
+public static final String[] jjstrLiteralImages = {
+"", null, null, null, null, null, "\141\143\143\145\163\163",
+"\141\165\164\150\157\162", "\142\162\141\156\143\150", "\142\162\141\156\143\150\145\163",
+"\143\157\155\155\145\156\164", "\144\141\164\145", "\144\145\163\143", "\145\170\160\141\156\144",
+"\150\145\141\144", "\154\157\143\153\163", "\154\157\147", "\156\145\170\164",
+"\163\164\141\164\145", "\163\164\162\151\143\164", "\163\171\155\142\157\154\163",
+"\164\145\170\164", null, null, null, null, null, null, null, "\73", "\72", "\56", };
+public static final String[] lexStateNames = {
+ "DEFAULT",
+ "PRE_DELTA",
+};
+public static final int[] jjnewLexState = {
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1, -1,
+};
+static final long[] jjtoToken = {
+ 0xf3ffffc1L,
+};
+static final long[] jjtoSkip = {
+ 0x3eL,
+};
+private ASCII_UCodeESC_CharStream input_stream;
+private final int[] jjrounds = new int[14];
+private final int[] jjstateSet = new int[28];
+protected char curChar;
+public ArchiveParserTokenManager(ASCII_UCodeESC_CharStream stream)
+{
+ if (ASCII_UCodeESC_CharStream.staticFlag)
+ throw new Error("ERROR: Cannot use a static CharStream class with a non-static lexical analyzer.");
+ input_stream = stream;
+}
+public ArchiveParserTokenManager(ASCII_UCodeESC_CharStream stream, int lexState)
+{
+ this(stream);
+ SwitchTo(lexState);
+}
+public void ReInit(ASCII_UCodeESC_CharStream stream)
+{
+ jjmatchedPos = jjnewStateCnt = 0;
+ curLexState = defaultLexState;
+ input_stream = stream;
+ ReInitRounds();
+}
+private final void ReInitRounds()
+{
+ int i;
+ jjround = 0x80000001;
+ for (i = 14; i-- > 0;)
+ jjrounds[i] = 0x80000000;
+}
+public void ReInit(ASCII_UCodeESC_CharStream stream, int lexState)
+{
+ ReInit(stream);
+ SwitchTo(lexState);
+}
+public void SwitchTo(int lexState)
+{
+ if (lexState >= 2 || lexState < 0)
+ throw new TokenMgrError("Error: Ignoring invalid lexical state : " + lexState + ". State unchanged.", TokenMgrError.INVALID_LEXICAL_STATE);
+ else
+ curLexState = lexState;
+}
+
+private final Token jjFillToken()
+{
+ Token t = Token.newToken(jjmatchedKind);
+ t.kind = jjmatchedKind;
+ 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();
+ return t;
+}
+
+int curLexState = 0;
+int defaultLexState = 0;
+int jjnewStateCnt;
+int jjround;
+int jjmatchedPos;
+int jjmatchedKind;
+
+public final Token getNextToken()
+{
+ int kind;
+ Token specialToken = null;
+ Token matchedToken;
+ int curPos = 0;
+
+ EOFLoop :
+ for (;;)
+ {
+ try
+ {
+ curChar = input_stream.BeginToken();
+ }
+ catch(java.io.IOException e)
+ {
+ jjmatchedKind = 0;
+ matchedToken = jjFillToken();
+ return matchedToken;
+ }
+
+ switch(curLexState)
+ {
+ case 0:
+ try { input_stream.backup(0);
+ while (curChar <= 32 && (0x100003600L & (1L << curChar)) != 0L)
+ curChar = input_stream.BeginToken();
+ }
+ catch (java.io.IOException e1) { continue EOFLoop; }
+ jjmatchedKind = 0x7fffffff;
+ jjmatchedPos = 0;
+ curPos = jjMoveStringLiteralDfa0_0();
+ break;
+ case 1:
+ try { input_stream.backup(0);
+ while (curChar <= 32 && (0x100003600L & (1L << curChar)) != 0L)
+ curChar = input_stream.BeginToken();
+ }
+ catch (java.io.IOException e1) { continue EOFLoop; }
+ jjmatchedKind = 0x7fffffff;
+ jjmatchedPos = 0;
+ curPos = jjMoveStringLiteralDfa0_1();
+ break;
+ }
+ if (jjmatchedKind != 0x7fffffff)
+ {
+ if (jjmatchedPos + 1 < curPos)
+ input_stream.backup(curPos - jjmatchedPos - 1);
+ if ((jjtoToken[jjmatchedKind >> 6] & (1L << (jjmatchedKind & 077))) != 0L)
+ {
+ matchedToken = jjFillToken();
+ if (jjnewLexState[jjmatchedKind] != -1)
+ curLexState = jjnewLexState[jjmatchedKind];
+ return matchedToken;
+ }
+ else
+ {
+ if (jjnewLexState[jjmatchedKind] != -1)
+ curLexState = jjnewLexState[jjmatchedKind];
+ continue EOFLoop;
+ }
+ }
+ int error_line = input_stream.getEndLine();
+ int error_column = input_stream.getEndColumn();
+ String error_after = null;
+ boolean EOFSeen = false;
+ try { input_stream.readChar(); input_stream.backup(1); }
+ catch (java.io.IOException e1) {
+ EOFSeen = true;
+ error_after = curPos <= 1 ? "" : input_stream.GetImage();
+ if (curChar == '\n' || curChar == '\r') {
+ error_line++;
+ error_column = 0;
+ }
+ else
+ error_column++;
+ }
+ if (!EOFSeen) {
+ input_stream.backup(1);
+ error_after = curPos <= 1 ? "" : input_stream.GetImage();
+ }
+ throw new TokenMgrError(EOFSeen, curLexState, error_line, error_column, error_after, curChar, TokenMgrError.LEXICAL_ERROR);
+ }
+}
+
+}
1.2 +65 -65 jakarta-turbine-maven/src/java/org/apache/maven/jrcs/rcs/BranchNode.java
Index: BranchNode.java
===================================================================
RCS file: /home/cvs/jakarta-turbine-maven/src/java/org/apache/maven/jrcs/rcs/BranchNode.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- BranchNode.java 20 Feb 2002 16:20:03 -0000 1.1
+++ BranchNode.java 20 Feb 2002 22:02:59 -0000 1.2
@@ -1,65 +1,65 @@
-package org.apache.maven.jrcs.rcs;
-
-import java.util.List;
-import java.util.LinkedList;
-
-class BranchNode extends Node
-{
- /**
- * the next field in a Branch node points to the next higher
- * revision on the same branch
- */
- BranchNode(Version vernum, BranchNode next) {
- super(vernum, next);
- if(vernum == null)
- throw new IllegalArgumentException(vernum.toString());
- }
-
- public BranchNode getLeafNode() {
- BranchNode result = this;
- while (result.getNext() != null)
- result = (BranchNode) result.getNext();
- return result;
- }
-
- protected void setRCSNext(Node node) {
- super.setRCSNext(node);
- if (this._next != null)
- this._next._parent = null;
- this._next = node;
- if (this._next != null)
- this._next._parent = this;
- }
-
- protected Node deltaRevision() {
- return this;
- }
-
- protected Node nextInPathTo(Version vernum, boolean soft)
- throws NodeNotFoundException
- {
- Version branchPoint = vernum.getBase(this.version.size());
- Version thisBase = this.version.getBase(branchPoint.size());
- if (thisBase.isGreaterThan(branchPoint) && !soft)
- throw new NodeNotFoundException(vernum); //!!! InternalError, really
-
- if (this.version.equals(vernum))
- return null;
- else if (this.version.isLessThan(branchPoint))
- return _next;
- else if (vernum.size() <= this.version.size()) {
- if (vernum.size() < this.version.size() || branchPoint.last() == 0)
- return _next; // keep going
- else
- return null;
- }
- else {
- Node branch = getBranch(vernum.at(this.version.size()));
- if (branch != null || soft)
- return branch;
- else
- throw new BranchNotFoundException(vernum.getBase(this.version.size()+1));
- }
- }
-}
-
+package org.apache.maven.jrcs.rcs;
+
+import java.util.List;
+import java.util.LinkedList;
+
+class BranchNode extends Node
+{
+ /**
+ * the next field in a Branch node points to the next higher
+ * revision on the same branch
+ */
+ BranchNode(Version vernum, BranchNode next) {
+ super(vernum, next);
+ if(vernum == null)
+ throw new IllegalArgumentException(vernum.toString());
+ }
+
+ public BranchNode getLeafNode() {
+ BranchNode result = this;
+ while (result.getNext() != null)
+ result = (BranchNode) result.getNext();
+ return result;
+ }
+
+ protected void setRCSNext(Node node) {
+ super.setRCSNext(node);
+ if (this._next != null)
+ this._next._parent = null;
+ this._next = node;
+ if (this._next != null)
+ this._next._parent = this;
+ }
+
+ protected Node deltaRevision() {
+ return this;
+ }
+
+ protected Node nextInPathTo(Version vernum, boolean soft)
+ throws NodeNotFoundException
+ {
+ Version branchPoint = vernum.getBase(this.version.size());
+ Version thisBase = this.version.getBase(branchPoint.size());
+ if (thisBase.isGreaterThan(branchPoint) && !soft)
+ throw new NodeNotFoundException(vernum); //!!! InternalError, really
+
+ if (this.version.equals(vernum))
+ return null;
+ else if (this.version.isLessThan(branchPoint))
+ return _next;
+ else if (vernum.size() <= this.version.size()) {
+ if (vernum.size() < this.version.size() || branchPoint.last() == 0)
+ return _next; // keep going
+ else
+ return null;
+ }
+ else {
+ Node branch = getBranch(vernum.at(this.version.size()));
+ if (branch != null || soft)
+ return branch;
+ else
+ throw new BranchNotFoundException(vernum.getBase(this.version.size()+1));
+ }
+ }
+}
+
1.2 +13 -13 jakarta-turbine-maven/src/java/org/apache/maven/jrcs/rcs/BranchNotFoundException.java
Index: BranchNotFoundException.java
===================================================================
RCS file: /home/cvs/jakarta-turbine-maven/src/java/org/apache/maven/jrcs/rcs/BranchNotFoundException.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- BranchNotFoundException.java 20 Feb 2002 16:20:03 -0000 1.1
+++ BranchNotFoundException.java 20 Feb 2002 22:02:59 -0000 1.2
@@ -1,13 +1,13 @@
-package org.apache.maven.jrcs.rcs;
-
-import java.lang.*;
-
-public class BranchNotFoundException extends NodeNotFoundException
-{
- public BranchNotFoundException() {
- super();
- }
- public BranchNotFoundException(Version v) {
- super(v);
- }
-}
+package org.apache.maven.jrcs.rcs;
+
+import java.lang.*;
+
+public class BranchNotFoundException extends NodeNotFoundException
+{
+ public BranchNotFoundException() {
+ super();
+ }
+ public BranchNotFoundException(Version v) {
+ super(v);
+ }
+}
1.2 +14 -14 jakarta-turbine-maven/src/java/org/apache/maven/jrcs/rcs/HeadAlreadySetException.java
Index: HeadAlreadySetException.java
===================================================================
RCS file: /home/cvs/jakarta-turbine-maven/src/java/org/apache/maven/jrcs/rcs/HeadAlreadySetException.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- HeadAlreadySetException.java 20 Feb 2002 16:20:03 -0000 1.1
+++ HeadAlreadySetException.java 20 Feb 2002 22:02:59 -0000 1.2
@@ -1,14 +1,14 @@
-package org.apache.maven.jrcs.rcs;
-
-public class HeadAlreadySetException extends IllegalArgumentException {
- public HeadAlreadySetException() {
- }
-
- public HeadAlreadySetException(String v) {
- super(v);
- }
-
- public HeadAlreadySetException(Version v) {
- super(v.toString());
- }
-}
+package org.apache.maven.jrcs.rcs;
+
+public class HeadAlreadySetException extends IllegalArgumentException {
+ public HeadAlreadySetException() {
+ }
+
+ public HeadAlreadySetException(String v) {
+ super(v);
+ }
+
+ public HeadAlreadySetException(Version v) {
+ super(v.toString());
+ }
+}
1.2 +16 -16 jakarta-turbine-maven/src/java/org/apache/maven/jrcs/rcs/InvalidBranchVersionNumberException.java
Index: InvalidBranchVersionNumberException.java
===================================================================
RCS file: /home/cvs/jakarta-turbine-maven/src/java/org/apache/maven/jrcs/rcs/InvalidBranchVersionNumberException.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- InvalidBranchVersionNumberException.java 20 Feb 2002 16:20:03 -0000 1.1
+++ InvalidBranchVersionNumberException.java 20 Feb 2002 22:02:59 -0000 1.2
@@ -1,16 +1,16 @@
-package org.apache.maven.jrcs.rcs;
-
-public class InvalidBranchVersionNumberException extends InvalidVersionNumberException {
-
- public InvalidBranchVersionNumberException() {
- }
-
- public InvalidBranchVersionNumberException(String v) {
- super(v);
- }
-
- public InvalidBranchVersionNumberException(Version v) {
- super(v);
- }
-
-}
+package org.apache.maven.jrcs.rcs;
+
+public class InvalidBranchVersionNumberException extends InvalidVersionNumberException {
+
+ public InvalidBranchVersionNumberException() {
+ }
+
+ public InvalidBranchVersionNumberException(String v) {
+ super(v);
+ }
+
+ public InvalidBranchVersionNumberException(Version v) {
+ super(v);
+ }
+
+}
1.2 +12 -12 jakarta-turbine-maven/src/java/org/apache/maven/jrcs/rcs/InvalidFileFormatException.java
Index: InvalidFileFormatException.java
===================================================================
RCS file: /home/cvs/jakarta-turbine-maven/src/java/org/apache/maven/jrcs/rcs/InvalidFileFormatException.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- InvalidFileFormatException.java 20 Feb 2002 16:20:03 -0000 1.1
+++ InvalidFileFormatException.java 20 Feb 2002 22:02:59 -0000 1.2
@@ -1,12 +1,12 @@
-package org.apache.maven.jrcs.rcs;
-
-public class InvalidFileFormatException extends RCSException {
-
- public InvalidFileFormatException() {
- super();
- }
-
- public InvalidFileFormatException(String msg) {
- super(msg);
- }
-}
+package org.apache.maven.jrcs.rcs;
+
+public class InvalidFileFormatException extends RCSException {
+
+ public InvalidFileFormatException() {
+ super();
+ }
+
+ public InvalidFileFormatException(String msg) {
+ super(msg);
+ }
+}
1.2 +17 -17 jakarta-turbine-maven/src/java/org/apache/maven/jrcs/rcs/InvalidTrunkVersionNumberException.java
Index: InvalidTrunkVersionNumberException.java
===================================================================
RCS file: /home/cvs/jakarta-turbine-maven/src/java/org/apache/maven/jrcs/rcs/InvalidTrunkVersionNumberException.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- InvalidTrunkVersionNumberException.java 20 Feb 2002 16:20:03 -0000 1.1
+++ InvalidTrunkVersionNumberException.java 20 Feb 2002 22:02:59 -0000 1.2
@@ -1,17 +1,17 @@
-package org.apache.maven.jrcs.rcs;
-
-public class InvalidTrunkVersionNumberException
-extends InvalidVersionNumberException
-{
-
- public InvalidTrunkVersionNumberException() {
- }
-
- public InvalidTrunkVersionNumberException(String v) {
- super(v);
- }
-
- public InvalidTrunkVersionNumberException(Version v) {
- super(v);
- }
-}
+package org.apache.maven.jrcs.rcs;
+
+public class InvalidTrunkVersionNumberException
+extends InvalidVersionNumberException
+{
+
+ public InvalidTrunkVersionNumberException() {
+ }
+
+ public InvalidTrunkVersionNumberException(String v) {
+ super(v);
+ }
+
+ public InvalidTrunkVersionNumberException(Version v) {
+ super(v);
+ }
+}
1.2 +14 -14 jakarta-turbine-maven/src/java/org/apache/maven/jrcs/rcs/InvalidVersionNumberException.java
Index: InvalidVersionNumberException.java
===================================================================
RCS file: /home/cvs/jakarta-turbine-maven/src/java/org/apache/maven/jrcs/rcs/InvalidVersionNumberException.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- InvalidVersionNumberException.java 20 Feb 2002 16:20:03 -0000 1.1
+++ InvalidVersionNumberException.java 20 Feb 2002 22:02:59 -0000 1.2
@@ -1,14 +1,14 @@
-package org.apache.maven.jrcs.rcs;
-
-public class InvalidVersionNumberException extends IllegalArgumentException {
- public InvalidVersionNumberException() {
- }
-
- public InvalidVersionNumberException(String v) {
- super(v);
- }
-
- public InvalidVersionNumberException(Version v) {
- super(v.toString());
- }
-}
+package org.apache.maven.jrcs.rcs;
+
+public class InvalidVersionNumberException extends IllegalArgumentException {
+ public InvalidVersionNumberException() {
+ }
+
+ public InvalidVersionNumberException(String v) {
+ super(v);
+ }
+
+ public InvalidVersionNumberException(Version v) {
+ super(v.toString());
+ }
+}
1.2 +24 -24 jakarta-turbine-maven/src/java/org/apache/maven/jrcs/rcs/Line.java
Index: Line.java
===================================================================
RCS file: /home/cvs/jakarta-turbine-maven/src/java/org/apache/maven/jrcs/rcs/Line.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- Line.java 20 Feb 2002 16:20:03 -0000 1.1
+++ Line.java 20 Feb 2002 22:02:59 -0000 1.2
@@ -1,24 +1,24 @@
-package org.apache.maven.jrcs.rcs;
-
-class Line {
- public Node revision;
- public final Object text;
-
- public Line(Node revision, Object text) {
- this.text = text;
- this.revision = revision;
- }
-
- public boolean equals(Object other) {
- if (this == other)
- return true;
- else if (! (other instanceof Line))
- return false;
- else
- return this.text.equals(((Line) other).text);
- }
-
- public int hashCode() {
- return text.hashCode();
- }
-}
+package org.apache.maven.jrcs.rcs;
+
+class Line {
+ public Node revision;
+ public final Object text;
+
+ public Line(Node revision, Object text) {
+ this.text = text;
+ this.revision = revision;
+ }
+
+ public boolean equals(Object other) {
+ if (this == other)
+ return true;
+ else if (! (other instanceof Line))
+ return false;
+ else
+ return this.text.equals(((Line) other).text);
+ }
+
+ public int hashCode() {
+ return text.hashCode();
+ }
+}
1.2 +69 -69 jakarta-turbine-maven/src/java/org/apache/maven/jrcs/rcs/Lines.java
Index: Lines.java
===================================================================
RCS file: /home/cvs/jakarta-turbine-maven/src/java/org/apache/maven/jrcs/rcs/Lines.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- Lines.java 20 Feb 2002 16:20:03 -0000 1.1
+++ Lines.java 20 Feb 2002 22:02:59 -0000 1.2
@@ -1,69 +1,69 @@
-package org.apache.maven.jrcs.rcs;
-
-import java.util.List;
-import java.util.LinkedList;
-import java.util.ArrayList;
-import java.util.Iterator;
-import java.text.Format;
-import java.text.MessageFormat;
-
-class Lines extends ArrayList {
-
- public static final Format annotationFormat = new MessageFormat(
- "{0,, } ({1} {2, date,dd-MMM-yyyy}):"
- );
-
- public Lines() {
- }
-
- public Lines(String text) {
- this(null, org.apache.maven.jrcs.diff.Diff.stringToArray(text));
- }
- public Lines(Node release, String text) {
- this(release, org.apache.maven.jrcs.diff.Diff.stringToArray(text));
- }
-
- public Lines(Object[] text) {
- this(null, text);
- }
-
- public Lines(Node release, Object[] text) {
- for(int i = 0; i < text.length; i++)
- super.add(new Line(release, text[i]));
- }
-
- public boolean add(Object o) {
- return super.add((Line) o);
- }
-
- public Object[] toArray() {
- return toArray(false);
- }
-
- public Object[] toArray(boolean annotate) {
- Object[] result = new Object[this.size()];
- Iterator r = this.iterator();
- int i = 0;
- while (r.hasNext()) {
- Line l = (Line) r.next();
- Object o = l.text;
- if (annotate) {
- Node rev = l.revision;
- o = annotationFormat.format(new Object[] {rev.version, rev._author, rev._date});
- }
- result[i++] = o;
- }
- return result;
- }
-
- public String toString() {
- return toString(false);
- }
-
- public String toString(boolean annotate) {
- return org.apache.maven.jrcs.diff.Diff.arrayToString(this.toArray(annotate));
- }
-}
-
-
-
+package org.apache.maven.jrcs.rcs;
+
+import java.util.List;
+import java.util.LinkedList;
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.text.Format;
+import java.text.MessageFormat;
+
+class Lines extends ArrayList {
+
+ public static final Format annotationFormat = new MessageFormat(
+ "{0,, } ({1} {2, date,dd-MMM-yyyy}):"
+ );
+
+ public Lines() {
+ }
+
+ public Lines(String text) {
+ this(null, org.apache.maven.jrcs.diff.Diff.stringToArray(text));
+ }
+ public Lines(Node release, String text) {
+ this(release, org.apache.maven.jrcs.diff.Diff.stringToArray(text));
+ }
+
+ public Lines(Object[] text) {
+ this(null, text);
+ }
+
+ public Lines(Node release, Object[] text) {
+ for(int i = 0; i < text.length; i++)
+ super.add(new Line(release, text[i]));
+ }
+
+ public boolean add(Object o) {
+ return super.add((Line) o);
+ }
+
+ public Object[] toArray() {
+ return toArray(false);
+ }
+
+ public Object[] toArray(boolean annotate) {
+ Object[] result = new Object[this.size()];
+ Iterator r = this.iterator();
+ int i = 0;
+ while (r.hasNext()) {
+ Line l = (Line) r.next();
+ Object o = l.text;
+ if (annotate) {
+ Node rev = l.revision;
+ o = annotationFormat.format(new Object[] {rev.version, rev._author, rev._date});
+ }
+ result[i++] = o;
+ }
+ return result;
+ }
+
+ public String toString() {
+ return toString(false);
+ }
+
+ public String toString(boolean annotate) {
+ return org.apache.maven.jrcs.diff.Diff.arrayToString(this.toArray(annotate));
+ }
+}
+
+
+
1.2 +334 -334 jakarta-turbine-maven/src/java/org/apache/maven/jrcs/rcs/Node.java
Index: Node.java
===================================================================
RCS file: /home/cvs/jakarta-turbine-maven/src/java/org/apache/maven/jrcs/rcs/Node.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- Node.java 20 Feb 2002 16:20:03 -0000 1.1
+++ Node.java 20 Feb 2002 22:02:59 -0000 1.2
@@ -1,334 +1,334 @@
-package org.apache.maven.jrcs.rcs;
-
-import org.apache.maven.jrcs.diff.*;
-
-import java.util.*;
-import java.text.Format;
-import java.text.DateFormat;
-import java.text.SimpleDateFormat;
-import java.text.MessageFormat;
-
-abstract class Node
-extends org.apache.maven.jrcs.util.ToString
-implements Comparable
-{
-
- public final Version version;
- protected Date _date = new Date();
- protected String _author = System.getProperty("user.name");
- protected String _state = "Exp";
- protected String _log = "";
- protected String _locker = "";
- protected Object[] _text;
- protected Node _rcsnext;
- protected Node _parent;
- protected Node _next;
- protected TreeMap _branches = null;
- protected Phrases _phrases = null;
-
- protected static final Format dateFormatter = new MessageFormat(
- "\t{0,number,##00}." +
- "{1,number,00}." +
- "{2,number,00}." +
- "{3,number,00}." +
- "{4,number,00}." +
- "{5,number,00}"
- );
- protected static final DateFormat dateFormat = new SimpleDateFormat("yy.MM.dd.HH.mm.ss");
- protected static final DateFormat dateFormat2K = new SimpleDateFormat("yyyy.MM.dd.HH.mm.ss");
-
-
- protected Node(Node other) {
- this(other.version, null);
- this._date = other._date;
- this._author = other._author;
- this._state = other._state;
- this._log = other._log;
- this._locker = other._locker;
- }
-
- protected Node(Version vernum, Node _rcsnext) {
- if(vernum == null)
- throw new IllegalArgumentException(vernum.toString());
- this.version = (Version) vernum.clone();
- this.setRCSNext(_rcsnext);
- }
-
-
- static Node newNode(Version vernum, Node _rcsnext)
- throws InvalidVersionNumberException
- {
- if (vernum.isTrunk())
- return new TrunkNode(vernum, (TrunkNode) _rcsnext);
- else
- return new BranchNode(vernum, (BranchNode) _rcsnext);
- }
-
- static Node newNode(Version vernum)
- throws InvalidVersionNumberException
- {
- return newNode(vernum, null);
- }
-
- public int compareTo(Object other) {
- if (other == this)
- return 0;
- else if (!(other instanceof Node))
- return -1;
- else
- return version.compareTo(((Node) other).version);
- }
-
- protected boolean isGhost() {
- return version.isGhost() || _text == null;
- }
-
- protected BranchNode getBranch(int no) {
- if (_branches == null)
- return null;
- else if (no == 0) {
- Integer branchNo = (Integer) _branches.lastKey();
- return (BranchNode) (branchNo == null ? null : _branches.get(branchNo));
- }
- else
- return (BranchNode) _branches.get(new Integer(no));
- }
-
- protected Node root() {
- Node result = this;
- while (result._parent != null) {
- result = result._parent;
- }
- return result;
- }
-
- protected void setLocker(String user) {
- _locker = user.intern();
- }
-
- protected void setAuthor(String user) {
- _author = user.intern();
- }
-
- protected void setDate(int[] value) {
- this._date = new GregorianCalendar(value[0] + (value[0] <= 99 ? 1900 : 0),
- value[1]-1, value[2],
- value[3],value[ 4], value[5]).getTime();
- }
-
- protected void setState(String value) {
- _state = value;
- }
-
- protected void setRCSNext(Node node) {
- _rcsnext = node;
- }
-
- protected void setLog(String value) {
- _log = value;
- }
-
- protected void setText(String value) {
- this._text = org.apache.maven.jrcs.diff.Diff.stringToArray(value);
- }
-
- protected void setText(Object[] value) {
- this._text = Arrays.asList(value).toArray();
- }
-
- protected void addBranch(BranchNode node) {
- if (node.version.isLessThan(this.version))
- throw new IllegalArgumentException();
-
- int branchno = node.version.at(this.version.size());
- if (_branches == null)
- _branches = new TreeMap();
- _branches.put(new Integer(branchno), node);
- node._parent = this;
- }
-
- protected Version nextVersion() {
- return this.version.next();
- }
-
- protected Version newBranchVersion() {
- Version result = new Version(this.version);
- if (_branches == null || _branches.size() <= 0)
- result.__addBranch(1);
- else
- result.__addBranch(((Integer) _branches.lastKey()).intValue());
- result.__addBranch(1);
- return result;
- }
-
- protected String getRevision(Version vernum) {
- return null;
- }
-
- protected Node getNext() {
- return _rcsnext;
- }
-
- protected Path pathTo(Version vernum)
- throws NodeNotFoundException
- {
- return pathTo(vernum, false);
- }
-
- protected Path pathTo(Version vernum, boolean soft)
- throws NodeNotFoundException
- {
- Path path = new Path();
-
- Node target = this;
- do {
- path.add(target);
- target = target.nextInPathTo(vernum, soft);
- } while (target != null);
- return path;
- }
-
-
- protected abstract Node nextInPathTo(Version vernum, boolean soft)
- throws NodeNotFoundException;
- protected abstract Node deltaRevision();
-
- protected void patch(List original)
- throws InvalidFileFormatException,
- NodeNotFoundException,
- org.apache.maven.jrcs.diff.PatchFailedException
- {
- patch(original, false);
- }
-
- protected void patch(List original, boolean annotate)
- throws InvalidFileFormatException,
- NodeNotFoundException,
- org.apache.maven.jrcs.diff.PatchFailedException
- {
- Revision revision = new Revision();
- for (int it = 0; it < _text.length; it++) {
- String cmd = _text[it].toString();
-
- java.util.StringTokenizer t = new StringTokenizer(cmd, "ad ", true);
- char action;
- int n;
- int count;
-
- try {
- action = t.nextToken().charAt(0);
- n = Integer.parseInt(t.nextToken());
- t.nextToken(); // skip the space
- count = Integer.parseInt(t.nextToken());
- }
- catch(Exception e) {
- throw new InvalidFileFormatException(version + ":line:" + ":" + e.getMessage());
- }
-
- if (action == 'd')
- revision.addDelta(new DeleteDelta(new Chunk(n-1, count)));
- else if (action == 'a') {
- revision.addDelta(new AddDelta(n, new Chunk(getTextLines(it+1, it+1+count), 0, count, n-1)));
- it += count;
- }
- else
- throw new InvalidFileFormatException(version.toString());
- }
- revision.applyTo(original);
- }
-
- public void toString(StringBuffer s) {
- toString(s, "\n");
- }
-
- public void toString(StringBuffer s, String EOL) {
- String EOI = ";"+EOL;
- String NLT = EOL + "\t";
-
- s.append(EOL);
- s.append(version.toString() + EOL);
-
- s.append("_date");
- if (_date != null) {
- DateFormat formatter = dateFormat;
- Calendar cal = new GregorianCalendar();
- cal.setTime(_date);
- if (cal.get(Calendar.YEAR) > 1999)
- formatter = dateFormat2K;
- s.append("\t"+formatter.format(_date));
- }
- s.append(";\tauthor");
- if (_author != null)
- s.append(" " + _author);
- s.append(";\tstate");
- if (_state != null) {
- s.append(" ");
- s.append(_state);
- }
- s.append(EOI);
-
- s.append("branches");
- if (_branches != null) {
- for(Iterator i = _branches.values().iterator(); i.hasNext();) {
- Node n = (Node) i.next();
- if (n != null)
- s.append(NLT + n.version);
- }
- }
- s.append(EOI);
-
- s.append("next\t");
- if (_rcsnext != null)
- s.append(_rcsnext.version.toString());
- s.append(EOI);
- }
-
-
- protected String toText() {
- final StringBuffer s = new StringBuffer();
- toText(s, "\n");
- return s.toString();
- }
-
- protected void toText(StringBuffer s, String EOL) {
- s.append(EOL + EOL);
- s.append(version.toString() + EOL);
-
- s.append("log" + EOL);
- s.append(Archive.quoteString(_log));
- s.append(EOL);
-
- if (_phrases != null)
- s.append(_phrases.toString());
-
- s.append("text" + EOL);
- s.append(Archive.quoteString(Diff.arrayToString(_text)+"\n"));
- s.append(EOL);
-
- if (_branches != null) {
- for(Iterator i = _branches.values().iterator(); i.hasNext();) {
- Node n = (Node) i.next();
- if (n != null)
- n.toText(s, EOL);
- }
- }
- }
-
- protected List getTextLines() {
- return getTextLines(new LinkedList());
- }
-
- protected List getTextLines(int from, int to) {
- return getTextLines(new LinkedList(), from, to);
- }
-
- protected List getTextLines(List lines) {
- return getTextLines(lines, 0, _text.length);
- }
- protected List getTextLines(List lines, int from, int to) {
- for(int i = from; i < to; i++)
- lines.add(new Line(deltaRevision(), _text[i]));
- return lines;
- }
-}
-
+package org.apache.maven.jrcs.rcs;
+
+import org.apache.maven.jrcs.diff.*;
+
+import java.util.*;
+import java.text.Format;
+import java.text.DateFormat;
+import java.text.SimpleDateFormat;
+import java.text.MessageFormat;
+
+abstract class Node
+extends org.apache.maven.jrcs.util.ToString
+implements Comparable
+{
+
+ public final Version version;
+ protected Date _date = new Date();
+ protected String _author = System.getProperty("user.name");
+ protected String _state = "Exp";
+ protected String _log = "";
+ protected String _locker = "";
+ protected Object[] _text;
+ protected Node _rcsnext;
+ protected Node _parent;
+ protected Node _next;
+ protected TreeMap _branches = null;
+ protected Phrases _phrases = null;
+
+ protected static final Format dateFormatter = new MessageFormat(
+ "\t{0,number,##00}." +
+ "{1,number,00}." +
+ "{2,number,00}." +
+ "{3,number,00}." +
+ "{4,number,00}." +
+ "{5,number,00}"
+ );
+ protected static final DateFormat dateFormat = new SimpleDateFormat("yy.MM.dd.HH.mm.ss");
+ protected static final DateFormat dateFormat2K = new SimpleDateFormat("yyyy.MM.dd.HH.mm.ss");
+
+
+ protected Node(Node other) {
+ this(other.version, null);
+ this._date = other._date;
+ this._author = other._author;
+ this._state = other._state;
+ this._log = other._log;
+ this._locker = other._locker;
+ }
+
+ protected Node(Version vernum, Node _rcsnext) {
+ if(vernum == null)
+ throw new IllegalArgumentException(vernum.toString());
+ this.version = (Version) vernum.clone();
+ this.setRCSNext(_rcsnext);
+ }
+
+
+ static Node newNode(Version vernum, Node _rcsnext)
+ throws InvalidVersionNumberException
+ {
+ if (vernum.isTrunk())
+ return new TrunkNode(vernum, (TrunkNode) _rcsnext);
+ else
+ return new BranchNode(vernum, (BranchNode) _rcsnext);
+ }
+
+ static Node newNode(Version vernum)
+ throws InvalidVersionNumberException
+ {
+ return newNode(vernum, null);
+ }
+
+ public int compareTo(Object other) {
+ if (other == this)
+ return 0;
+ else if (!(other instanceof Node))
+ return -1;
+ else
+ return version.compareTo(((Node) other).version);
+ }
+
+ protected boolean isGhost() {
+ return version.isGhost() || _text == null;
+ }
+
+ protected BranchNode getBranch(int no) {
+ if (_branches == null)
+ return null;
+ else if (no == 0) {
+ Integer branchNo = (Integer) _branches.lastKey();
+ return (BranchNode) (branchNo == null ? null : _branches.get(branchNo));
+ }
+ else
+ return (BranchNode) _branches.get(new Integer(no));
+ }
+
+ protected Node root() {
+ Node result = this;
+ while (result._parent != null) {
+ result = result._parent;
+ }
+ return result;
+ }
+
+ protected void setLocker(String user) {
+ _locker = user.intern();
+ }
+
+ protected void setAuthor(String user) {
+ _author = user.intern();
+ }
+
+ protected void setDate(int[] value) {
+ this._date = new GregorianCalendar(value[0] + (value[0] <= 99 ? 1900 : 0),
+ value[1]-1, value[2],
+ value[3],value[ 4], value[5]).getTime();
+ }
+
+ protected void setState(String value) {
+ _state = value;
+ }
+
+ protected void setRCSNext(Node node) {
+ _rcsnext = node;
+ }
+
+ protected void setLog(String value) {
+ _log = value;
+ }
+
+ protected void setText(String value) {
+ this._text = org.apache.maven.jrcs.diff.Diff.stringToArray(value);
+ }
+
+ protected void setText(Object[] value) {
+ this._text = Arrays.asList(value).toArray();
+ }
+
+ protected void addBranch(BranchNode node) {
+ if (node.version.isLessThan(this.version))
+ throw new IllegalArgumentException();
+
+ int branchno = node.version.at(this.version.size());
+ if (_branches == null)
+ _branches = new TreeMap();
+ _branches.put(new Integer(branchno), node);
+ node._parent = this;
+ }
+
+ protected Version nextVersion() {
+ return this.version.next();
+ }
+
+ protected Version newBranchVersion() {
+ Version result = new Version(this.version);
+ if (_branches == null || _branches.size() <= 0)
+ result.__addBranch(1);
+ else
+ result.__addBranch(((Integer) _branches.lastKey()).intValue());
+ result.__addBranch(1);
+ return result;
+ }
+
+ protected String getRevision(Version vernum) {
+ return null;
+ }
+
+ protected Node getNext() {
+ return _rcsnext;
+ }
+
+ protected Path pathTo(Version vernum)
+ throws NodeNotFoundException
+ {
+ return pathTo(vernum, false);
+ }
+
+ protected Path pathTo(Version vernum, boolean soft)
+ throws NodeNotFoundException
+ {
+ Path path = new Path();
+
+ Node target = this;
+ do {
+ path.add(target);
+ target = target.nextInPathTo(vernum, soft);
+ } while (target != null);
+ return path;
+ }
+
+
+ protected abstract Node nextInPathTo(Version vernum, boolean soft)
+ throws NodeNotFoundException;
+ protected abstract Node deltaRevision();
+
+ protected void patch(List original)
+ throws InvalidFileFormatException,
+ NodeNotFoundException,
+ org.apache.maven.jrcs.diff.PatchFailedException
+ {
+ patch(original, false);
+ }
+
+ protected void patch(List original, boolean annotate)
+ throws InvalidFileFormatException,
+ NodeNotFoundException,
+ org.apache.maven.jrcs.diff.PatchFailedException
+ {
+ Revision revision = new Revision();
+ for (int it = 0; it < _text.length; it++) {
+ String cmd = _text[it].toString();
+
+ java.util.StringTokenizer t = new StringTokenizer(cmd, "ad ", true);
+ char action;
+ int n;
+ int count;
+
+ try {
+ action = t.nextToken().charAt(0);
+ n = Integer.parseInt(t.nextToken());
+ t.nextToken(); // skip the space
+ count = Integer.parseInt(t.nextToken());
+ }
+ catch(Exception e) {
+ throw new InvalidFileFormatException(version + ":line:" + ":" + e.getMessage());
+ }
+
+ if (action == 'd')
+ revision.addDelta(new DeleteDelta(new Chunk(n-1, count)));
+ else if (action == 'a') {
+ revision.addDelta(new AddDelta(n, new Chunk(getTextLines(it+1, it+1+count), 0, count, n-1)));
+ it += count;
+ }
+ else
+ throw new InvalidFileFormatException(version.toString());
+ }
+ revision.applyTo(original);
+ }
+
+ public void toString(StringBuffer s) {
+ toString(s, "\n");
+ }
+
+ public void toString(StringBuffer s, String EOL) {
+ String EOI = ";"+EOL;
+ String NLT = EOL + "\t";
+
+ s.append(EOL);
+ s.append(version.toString() + EOL);
+
+ s.append("_date");
+ if (_date != null) {
+ DateFormat formatter = dateFormat;
+ Calendar cal = new GregorianCalendar();
+ cal.setTime(_date);
+ if (cal.get(Calendar.YEAR) > 1999)
+ formatter = dateFormat2K;
+ s.append("\t"+formatter.format(_date));
+ }
+ s.append(";\tauthor");
+ if (_author != null)
+ s.append(" " + _author);
+ s.append(";\tstate");
+ if (_state != null) {
+ s.append(" ");
+ s.append(_state);
+ }
+ s.append(EOI);
+
+ s.append("branches");
+ if (_branches != null) {
+ for(Iterator i = _branches.values().iterator(); i.hasNext();) {
+ Node n = (Node) i.next();
+ if (n != null)
+ s.append(NLT + n.version);
+ }
+ }
+ s.append(EOI);
+
+ s.append("next\t");
+ if (_rcsnext != null)
+ s.append(_rcsnext.version.toString());
+ s.append(EOI);
+ }
+
+
+ protected String toText() {
+ final StringBuffer s = new StringBuffer();
+ toText(s, "\n");
+ return s.toString();
+ }
+
+ protected void toText(StringBuffer s, String EOL) {
+ s.append(EOL + EOL);
+ s.append(version.toString() + EOL);
+
+ s.append("log" + EOL);
+ s.append(Archive.quoteString(_log));
+ s.append(EOL);
+
+ if (_phrases != null)
+ s.append(_phrases.toString());
+
+ s.append("text" + EOL);
+ s.append(Archive.quoteString(Diff.arrayToString(_text)+"\n"));
+ s.append(EOL);
+
+ if (_branches != null) {
+ for(Iterator i = _branches.values().iterator(); i.hasNext();) {
+ Node n = (Node) i.next();
+ if (n != null)
+ n.toText(s, EOL);
+ }
+ }
+ }
+
+ protected List getTextLines() {
+ return getTextLines(new LinkedList());
+ }
+
+ protected List getTextLines(int from, int to) {
+ return getTextLines(new LinkedList(), from, to);
+ }
+
+ protected List getTextLines(List lines) {
+ return getTextLines(lines, 0, _text.length);
+ }
+ protected List getTextLines(List lines, int from, int to) {
+ for(int i = from; i < to; i++)
+ lines.add(new Line(deltaRevision(), _text[i]));
+ return lines;
+ }
+}
+
1.2 +19 -19 jakarta-turbine-maven/src/java/org/apache/maven/jrcs/rcs/NodeNotFoundException.java
Index: NodeNotFoundException.java
===================================================================
RCS file: /home/cvs/jakarta-turbine-maven/src/java/org/apache/maven/jrcs/rcs/NodeNotFoundException.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- NodeNotFoundException.java 20 Feb 2002 16:20:03 -0000 1.1
+++ NodeNotFoundException.java 20 Feb 2002 22:02:59 -0000 1.2
@@ -1,19 +1,19 @@
-package org.apache.maven.jrcs.rcs;
-
-import java.lang.*;
-
-class NodeNotFoundException extends IllegalArgumentException
-{
- public NodeNotFoundException() {
- super();
- }
-
- public NodeNotFoundException(String msg) {
- super(msg);
- }
-
- public NodeNotFoundException(Version v) {
- super(v.toString());
- }
-}
-
+package org.apache.maven.jrcs.rcs;
+
+import java.lang.*;
+
+class NodeNotFoundException extends IllegalArgumentException
+{
+ public NodeNotFoundException() {
+ super();
+ }
+
+ public NodeNotFoundException(String msg) {
+ super(msg);
+ }
+
+ public NodeNotFoundException(Version v) {
+ super(v.toString());
+ }
+}
+
1.2 +190 -190 jakarta-turbine-maven/src/java/org/apache/maven/jrcs/rcs/ParseException.java
Index: ParseException.java
===================================================================
RCS file: /home/cvs/jakarta-turbine-maven/src/java/org/apache/maven/jrcs/rcs/ParseException.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- ParseException.java 20 Feb 2002 16:20:03 -0000 1.1
+++ ParseException.java 20 Feb 2002 22:02:59 -0000 1.2
@@ -1,190 +1,190 @@
-package org.apache.maven.jrcs.rcs;
-
-/**
- * This exception is thrown when parse errors are encountered.
- * You can explicitly create objects of this exception type by
- * calling the method generateParseException in the generated
- * parser.
- *
- * You can modify this class to customize your error reporting
- * mechanisms so long as you retain the public fields.
- */
-public class ParseException extends Exception {
-
- /**
- * 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>
- */
- public ParseException(Token currentTokenVal,
- int[][] expectedTokenSequencesVal,
- String[] tokenImageVal
- )
- {
- super("");
- specialConstructor = true;
- currentToken = currentTokenVal;
- expectedTokenSequences = expectedTokenSequencesVal;
- tokenImage = tokenImageVal;
- }
-
- /**
- * The following constructors are for use by you for whatever
- * purpose you can think of. Constructing the exception in this
- * manner makes the exception behave in the normal way - i.e., as
- * documented in the class "Throwable". The fields "errorToken",
- * "expectedTokenSequences", and "tokenImage" do not contain
- * relevant information. The JavaCC generated code does not use
- * these constructors.
- */
-
- public ParseException() {
- super();
- specialConstructor = false;
- }
-
- 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
- * this object has been created due to a parse error, the token
- * followng this token will (therefore) be the first error token.
- */
- public Token currentToken;
-
- /**
- * Each entry in this array is an array of integers. Each array
- * of integers represents a sequence of tokens (by their ordinal
- * values) that is expected at this point of the parse.
- */
- public int[][] expectedTokenSequences;
-
- /**
- * This is a reference to the "tokenImage" array of the generated
- * parser within which the parse error occurred. This array is
- * defined in the generated ...Constants interface.
- */
- 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
- * 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
- * gets displayed.
- */
- public String getMessage() {
- if (!specialConstructor) {
- return super.getMessage();
- }
- String expected = "";
- int maxSize = 0;
- for (int i = 0; i < expectedTokenSequences.length; i++) {
- if (maxSize < expectedTokenSequences[i].length) {
- maxSize = expectedTokenSequences[i].length;
- }
- for (int j = 0; j < expectedTokenSequences[i].length; j++) {
- expected += tokenImage[expectedTokenSequences[i][j]] + " ";
- }
- if (expectedTokenSequences[i][expectedTokenSequences[i].length - 1] != 0) {
- expected += "...";
- }
- expected += eol + " ";
- }
- String retval = "Encountered \"";
- Token tok = currentToken.next;
- for (int i = 0; i < maxSize; i++) {
- if (i != 0) retval += " ";
- if (tok.kind == 0) {
- retval += tokenImage[0];
- break;
- }
- retval += add_escapes(tok.image);
- tok = tok.next;
- }
- retval += "\" at line " + currentToken.next.beginLine + ", column " + currentToken.next.beginColumn + "." + eol;
- if (expectedTokenSequences.length == 1) {
- retval += "Was expecting:" + eol + " ";
- } else {
- retval += "Was expecting one of:" + eol + " ";
- }
- retval += expected;
- return retval;
- }
-
- /**
- * 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) {
- 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();
- }
-
-}
+package org.apache.maven.jrcs.rcs;
+
+/**
+ * This exception is thrown when parse errors are encountered.
+ * You can explicitly create objects of this exception type by
+ * calling the method generateParseException in the generated
+ * parser.
+ *
+ * You can modify this class to customize your error reporting
+ * mechanisms so long as you retain the public fields.
+ */
+public class ParseException extends Exception {
+
+ /**
+ * 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>
+ */
+ public ParseException(Token currentTokenVal,
+ int[][] expectedTokenSequencesVal,
+ String[] tokenImageVal
+ )
+ {
+ super("");
+ specialConstructor = true;
+ currentToken = currentTokenVal;
+ expectedTokenSequences = expectedTokenSequencesVal;
+ tokenImage = tokenImageVal;
+ }
+
+ /**
+ * The following constructors are for use by you for whatever
+ * purpose you can think of. Constructing the exception in this
+ * manner makes the exception behave in the normal way - i.e., as
+ * documented in the class "Throwable". The fields "errorToken",
+ * "expectedTokenSequences", and "tokenImage" do not contain
+ * relevant information. The JavaCC generated code does not use
+ * these constructors.
+ */
+
+ public ParseException() {
+ super();
+ specialConstructor = false;
+ }
+
+ 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
+ * this object has been created due to a parse error, the token
+ * followng this token will (therefore) be the first error token.
+ */
+ public Token currentToken;
+
+ /**
+ * Each entry in this array is an array of integers. Each array
+ * of integers represents a sequence of tokens (by their ordinal
+ * values) that is expected at this point of the parse.
+ */
+ public int[][] expectedTokenSequences;
+
+ /**
+ * This is a reference to the "tokenImage" array of the generated
+ * parser within which the parse error occurred. This array is
+ * defined in the generated ...Constants interface.
+ */
+ 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
+ * 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
+ * gets displayed.
+ */
+ public String getMessage() {
+ if (!specialConstructor) {
+ return super.getMessage();
+ }
+ String expected = "";
+ int maxSize = 0;
+ for (int i = 0; i < expectedTokenSequences.length; i++) {
+ if (maxSize < expectedTokenSequences[i].length) {
+ maxSize = expectedTokenSequences[i].length;
+ }
+ for (int j = 0; j < expectedTokenSequences[i].length; j++) {
+ expected += tokenImage[expectedTokenSequences[i][j]] + " ";
+ }
+ if (expectedTokenSequences[i][expectedTokenSequences[i].length - 1] != 0) {
+ expected += "...";
+ }
+ expected += eol + " ";
+ }
+ String retval = "Encountered \"";
+ Token tok = currentToken.next;
+ for (int i = 0; i < maxSize; i++) {
+ if (i != 0) retval += " ";
+ if (tok.kind == 0) {
+ retval += tokenImage[0];
+ break;
+ }
+ retval += add_escapes(tok.image);
+ tok = tok.next;
+ }
+ retval += "\" at line " + currentToken.next.beginLine + ", column " + currentToken.next.beginColumn + "." + eol;
+ if (expectedTokenSequences.length == 1) {
+ retval += "Was expecting:" + eol + " ";
+ } else {
+ retval += "Was expecting one of:" + eol + " ";
+ }
+ retval += expected;
+ return retval;
+ }
+
+ /**
+ * 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) {
+ 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();
+ }
+
+}
1.2 +71 -71 jakarta-turbine-maven/src/java/org/apache/maven/jrcs/rcs/Path.java
Index: Path.java
===================================================================
RCS file: /home/cvs/jakarta-turbine-maven/src/java/org/apache/maven/jrcs/rcs/Path.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- Path.java 20 Feb 2002 16:20:03 -0000 1.1
+++ Path.java 20 Feb 2002 22:02:59 -0000 1.2
@@ -1,71 +1,71 @@
-package org.apache.maven.jrcs.rcs;
-
-import java.util.List;
-import java.util.LinkedList;
-import java.util.Iterator;
-
-class Path {
- protected List _path = new LinkedList();
-
- public Path() {
- }
-
- public void add(Node node) {
- _path.add(node);
- }
-
- public int size() {
- return _path.size();
- }
-
- public Node last() {
- if (size() == 0)
- return null;
- else
- return (Node) _path.get(size()-1);
- }
-
- public List patch()
- throws InvalidFileFormatException,
- org.apache.maven.jrcs.diff.PatchFailedException,
- NodeNotFoundException
- {
- return patch(false);
- }
-
- public List patch(boolean annotate)
- throws InvalidFileFormatException,
- org.apache.maven.jrcs.diff.PatchFailedException,
- NodeNotFoundException
- {
- return patch(new Lines(), annotate);
- }
-
- public List patch(List lines)
- throws InvalidFileFormatException,
- org.apache.maven.jrcs.diff.PatchFailedException,
- NodeNotFoundException
- {
- return patch(lines, false);
- }
-
- public List patch(List lines, boolean annotate)
- throws InvalidFileFormatException,
- org.apache.maven.jrcs.diff.PatchFailedException,
- NodeNotFoundException
- {
- Iterator p = _path.iterator();
-
- // get full text of first node
- TrunkNode head = (TrunkNode) p.next();
- head.patch0(lines, annotate);
-
- // the rest are patches
- while(p.hasNext()) {
- Node n = (Node) p.next();
- n.patch(lines, annotate);
- }
- return lines;
- }
-
-}
+package org.apache.maven.jrcs.rcs;
+
+import java.util.List;
+import java.util.LinkedList;
+import java.util.Iterator;
+
+class Path {
+ protected List _path = new LinkedList();
+
+ public Path() {
+ }
+
+ public void add(Node node) {
+ _path.add(node);
+ }
+
+ public int size() {
+ return _path.size();
+ }
+
+ public Node last() {
+ if (size() == 0)
+ return null;
+ else
+ return (Node) _path.get(size()-1);
+ }
+
+ public List patch()
+ throws InvalidFileFormatException,
+ org.apache.maven.jrcs.diff.PatchFailedException,
+ NodeNotFoundException
+ {
+ return patch(false);
+ }
+
+ public List patch(boolean annotate)
+ throws InvalidFileFormatException,
+ org.apache.maven.jrcs.diff.PatchFailedException,
+ NodeNotFoundException
+ {
+ return patch(new Lines(), annotate);
+ }
+
+ public List patch(List lines)
+ throws InvalidFileFormatException,
+ org.apache.maven.jrcs.diff.PatchFailedException,
+ NodeNotFoundException
+ {
+ return patch(lines, false);
+ }
+
+ public List patch(List lines, boolean annotate)
+ throws InvalidFileFormatException,
+ org.apache.maven.jrcs.diff.PatchFailedException,
+ NodeNotFoundException
+ {
+ Iterator p = _path.iterator();
+
+ // get full text of first node
+ TrunkNode head = (TrunkNode) p.next();
+ head.patch0(lines, annotate);
+
+ // the rest are patches
+ while(p.hasNext()) {
+ Node n = (Node) p.next();
+ n.patch(lines, annotate);
+ }
+ return lines;
+ }
+
+}
1.2 +25 -25 jakarta-turbine-maven/src/java/org/apache/maven/jrcs/rcs/Phrases.java
Index: Phrases.java
===================================================================
RCS file: /home/cvs/jakarta-turbine-maven/src/java/org/apache/maven/jrcs/rcs/Phrases.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- Phrases.java 20 Feb 2002 16:20:03 -0000 1.1
+++ Phrases.java 20 Feb 2002 22:02:59 -0000 1.2
@@ -1,25 +1,25 @@
-package org.apache.maven.jrcs.rcs;
-
-import java.util.*;
-
-class Phrases extends TreeMap
-{
- public void toString(StringBuffer s, String EOL) {
- Iterator i = keySet().iterator();
- while (i.hasNext()) {
- String key = i.next().toString();
- String value = get(key).toString();
- s.append(key.toString());
- s.append(" ");
- s.append(value);
- s.append(EOL);
- }
- }
-
- public String toString() {
- StringBuffer s = new StringBuffer();
- toString(s, "\n");
- return s.toString();
- }
-}
-
+package org.apache.maven.jrcs.rcs;
+
+import java.util.*;
+
+class Phrases extends TreeMap
+{
+ public void toString(StringBuffer s, String EOL) {
+ Iterator i = keySet().iterator();
+ while (i.hasNext()) {
+ String key = i.next().toString();
+ String value = get(key).toString();
+ s.append(key.toString());
+ s.append(" ");
+ s.append(value);
+ s.append(EOL);
+ }
+ }
+
+ public String toString() {
+ StringBuffer s = new StringBuffer();
+ toString(s, "\n");
+ return s.toString();
+ }
+}
+
1.2 +15 -15 jakarta-turbine-maven/src/java/org/apache/maven/jrcs/rcs/RCSException.java
Index: RCSException.java
===================================================================
RCS file: /home/cvs/jakarta-turbine-maven/src/java/org/apache/maven/jrcs/rcs/RCSException.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- RCSException.java 20 Feb 2002 16:20:03 -0000 1.1
+++ RCSException.java 20 Feb 2002 22:02:59 -0000 1.2
@@ -1,15 +1,15 @@
-package org.apache.maven.jrcs.rcs;
-
-public class RCSException extends Exception {
-
- public RCSException() {
- }
-
- public RCSException(String v) {
- super(v);
- }
-
- public RCSException(Version v) {
- super(v.toString());
- }
-}
+package org.apache.maven.jrcs.rcs;
+
+public class RCSException extends Exception {
+
+ public RCSException() {
+ }
+
+ public RCSException(String v) {
+ super(v);
+ }
+
+ public RCSException(Version v) {
+ super(v.toString());
+ }
+}
1.2 +80 -80 jakarta-turbine-maven/src/java/org/apache/maven/jrcs/rcs/Token.java
Index: Token.java
===================================================================
RCS file: /home/cvs/jakarta-turbine-maven/src/java/org/apache/maven/jrcs/rcs/Token.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- Token.java 20 Feb 2002 16:20:03 -0000 1.1
+++ Token.java 20 Feb 2002 22:02:59 -0000 1.2
@@ -1,80 +1,80 @@
-package org.apache.maven.jrcs.rcs;
-
-/**
- * Describes the input token stream.
- */
-
-public class Token {
-
- /**
- * 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 string image of the token.
- */
- public String image;
-
- /**
- * A reference to the next regular (non-special) token from the input
- * stream. If this is the last token from the input stream, or if the
- * token manager has not read tokens beyond this one, this field is
- * set to null. This is true only if this token is also a regular
- * token. Otherwise, see below for a description of the contents of
- * this field.
- */
- public Token next;
-
- /**
- * This field is used to access special tokens that occur prior to this
- * token, but after the immediately preceding regular (non-special) token.
- * If there are no such special tokens, this field is set to null.
- * When there are more than one such special token, this field refers
- * to the last of these special tokens, which in turn refers to the next
- * previous special token through its specialToken field, and so on
- * until the first special token (whose specialToken field is null).
- * The next fields of special tokens refer to other special tokens that
- * immediately follow it (without an intervening regular token). If there
- * is no such token, this field is null.
- */
- public Token specialToken;
-
- /**
- * Returns the image.
- */
- public final String toString()
- {
- return image;
- }
-
- /**
- * Returns a new Token object, by default. However, if you want, you
- * 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 :
- *
- * case MyParserConstants.ID : return new IDToken();
- *
- * to the following switch statement. Then you can cast matchedToken
- * variable to the appropriate type and use it in your lexical actions.
- */
- public static final Token newToken(int ofKind)
- {
- switch(ofKind)
- {
- default : return new Token();
- }
- }
-
-}
+package org.apache.maven.jrcs.rcs;
+
+/**
+ * Describes the input token stream.
+ */
+
+public class Token {
+
+ /**
+ * 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 string image of the token.
+ */
+ public String image;
+
+ /**
+ * A reference to the next regular (non-special) token from the input
+ * stream. If this is the last token from the input stream, or if the
+ * token manager has not read tokens beyond this one, this field is
+ * set to null. This is true only if this token is also a regular
+ * token. Otherwise, see below for a description of the contents of
+ * this field.
+ */
+ public Token next;
+
+ /**
+ * This field is used to access special tokens that occur prior to this
+ * token, but after the immediately preceding regular (non-special) token.
+ * If there are no such special tokens, this field is set to null.
+ * When there are more than one such special token, this field refers
+ * to the last of these special tokens, which in turn refers to the next
+ * previous special token through its specialToken field, and so on
+ * until the first special token (whose specialToken field is null).
+ * The next fields of special tokens refer to other special tokens that
+ * immediately follow it (without an intervening regular token). If there
+ * is no such token, this field is null.
+ */
+ public Token specialToken;
+
+ /**
+ * Returns the image.
+ */
+ public final String toString()
+ {
+ return image;
+ }
+
+ /**
+ * Returns a new Token object, by default. However, if you want, you
+ * 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 :
+ *
+ * case MyParserConstants.ID : return new IDToken();
+ *
+ * to the following switch statement. Then you can cast matchedToken
+ * variable to the appropriate type and use it in your lexical actions.
+ */
+ public static final Token newToken(int ofKind)
+ {
+ switch(ofKind)
+ {
+ default : return new Token();
+ }
+ }
+
+}
1.2 +133 -133 jakarta-turbine-maven/src/java/org/apache/maven/jrcs/rcs/TokenMgrError.java
Index: TokenMgrError.java
===================================================================
RCS file: /home/cvs/jakarta-turbine-maven/src/java/org/apache/maven/jrcs/rcs/TokenMgrError.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- TokenMgrError.java 20 Feb 2002 16:20:03 -0000 1.1
+++ TokenMgrError.java 20 Feb 2002 22:02:59 -0000 1.2
@@ -1,133 +1,133 @@
-/* Generated By:JavaCC: Do not edit this line. TokenMgrError.java Version 0.7pre2 */
-package org.apache.maven.jrcs.rcs;
-
-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;
-
- /**
- * An attempt wass made to create a second instance of a static token manager.
- */
- static final int STATIC_LEXER_ERROR = 1;
-
- /**
- * Tried to change to an invalid lexical state.
- */
- static final int INVALID_LEXICAL_STATE = 2;
-
- /**
- * 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 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;
- }
- }
- 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.
- */
- private static final 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();
- }
-
- /*
- * Constructors of various flavors follow.
- */
-
- public TokenMgrError() {
- }
-
- 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);
- }
-}
+/* Generated By:JavaCC: Do not edit this line. TokenMgrError.java Version 0.7pre2 */
+package org.apache.maven.jrcs.rcs;
+
+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;
+
+ /**
+ * An attempt wass made to create a second instance of a static token manager.
+ */
+ static final int STATIC_LEXER_ERROR = 1;
+
+ /**
+ * Tried to change to an invalid lexical state.
+ */
+ static final int INVALID_LEXICAL_STATE = 2;
+
+ /**
+ * 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 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;
+ }
+ }
+ 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.
+ */
+ private static final 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();
+ }
+
+ /*
+ * Constructors of various flavors follow.
+ */
+
+ public TokenMgrError() {
+ }
+
+ 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);
+ }
+}
1.2 +83 -83 jakarta-turbine-maven/src/java/org/apache/maven/jrcs/rcs/TrunkNode.java
Index: TrunkNode.java
===================================================================
RCS file: /home/cvs/jakarta-turbine-maven/src/java/org/apache/maven/jrcs/rcs/TrunkNode.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- TrunkNode.java 20 Feb 2002 16:20:03 -0000 1.1
+++ TrunkNode.java 20 Feb 2002 22:02:59 -0000 1.2
@@ -1,83 +1,83 @@
-package org.apache.maven.jrcs.rcs;
-
-import java.util.List;
-import java.util.LinkedList;
-
-class TrunkNode extends Node
-{
-
- TrunkNode(TrunkNode other) {
- super(other);
- }
-
- /**
- * the next field in a Trunk node points to the immediate
- * previos revision
- */
- TrunkNode(Version vernum, TrunkNode next)
- throws InvalidTrunkVersionNumberException
- {
- super(vernum, next);
- if (vernum.size() > 2)
- throw new InvalidTrunkVersionNumberException(vernum);
- }
-
- protected void setRCSNext(Node node) {
- super.setRCSNext(node);
- if (this._parent != null)
- this._parent._next = null;
- this._parent = node;
- if (this._parent != null)
- this._parent._next = this;
- }
-
-
- protected Node deltaRevision() {
- return (_next != null ? _next : this);
- }
-
- protected Node nextInPathTo(Version vernum, boolean soft)
- throws NodeNotFoundException
- {
- Version branchPoint = vernum.getBase(2);
- if (this.version.isLessThan(branchPoint)) {
- if (soft)
- return null;
- else
- throw new NodeNotFoundException(vernum);
- }
-
- Version thisBase = this.version.getBase(branchPoint.size());
- if (thisBase.isGreaterThan(branchPoint))
- return _parent;
- else if (vernum.size() > this.version.size()) {
- Node branch = getBranch(vernum.at(this.version.size()));
- if (branch != null || soft)
- return branch;
- else
- throw new BranchNotFoundException(vernum.getBase(this.version.size()+1));
- }
- else
- return null;
- }
-
- /**
- * Provide the initial patch.
- * Used only for head nodes.
- * @param original Where to add the patch to.
- * @param annotate True if the lines should be annotated with version numbers.
- */
- protected void patch0(List original, boolean annotate)
- throws InvalidFileFormatException,
- NodeNotFoundException,
- org.apache.maven.jrcs.diff.PatchFailedException
- {
- Node root = this.root();
- for (int it = 0; it < _text.length; it++) {
- original.add(new Line(root, _text[it]));
- }
- if (annotate && _parent != null)
- _parent.pathTo(root.version).patch(original, true);
- }
-}
-
+package org.apache.maven.jrcs.rcs;
+
+import java.util.List;
+import java.util.LinkedList;
+
+class TrunkNode extends Node
+{
+
+ TrunkNode(TrunkNode other) {
+ super(other);
+ }
+
+ /**
+ * the next field in a Trunk node points to the immediate
+ * previos revision
+ */
+ TrunkNode(Version vernum, TrunkNode next)
+ throws InvalidTrunkVersionNumberException
+ {
+ super(vernum, next);
+ if (vernum.size() > 2)
+ throw new InvalidTrunkVersionNumberException(vernum);
+ }
+
+ protected void setRCSNext(Node node) {
+ super.setRCSNext(node);
+ if (this._parent != null)
+ this._parent._next = null;
+ this._parent = node;
+ if (this._parent != null)
+ this._parent._next = this;
+ }
+
+
+ protected Node deltaRevision() {
+ return (_next != null ? _next : this);
+ }
+
+ protected Node nextInPathTo(Version vernum, boolean soft)
+ throws NodeNotFoundException
+ {
+ Version branchPoint = vernum.getBase(2);
+ if (this.version.isLessThan(branchPoint)) {
+ if (soft)
+ return null;
+ else
+ throw new NodeNotFoundException(vernum);
+ }
+
+ Version thisBase = this.version.getBase(branchPoint.size());
+ if (thisBase.isGreaterThan(branchPoint))
+ return _parent;
+ else if (vernum.size() > this.version.size()) {
+ Node branch = getBranch(vernum.at(this.version.size()));
+ if (branch != null || soft)
+ return branch;
+ else
+ throw new BranchNotFoundException(vernum.getBase(this.version.size()+1));
+ }
+ else
+ return null;
+ }
+
+ /**
+ * Provide the initial patch.
+ * Used only for head nodes.
+ * @param original Where to add the patch to.
+ * @param annotate True if the lines should be annotated with version numbers.
+ */
+ protected void patch0(List original, boolean annotate)
+ throws InvalidFileFormatException,
+ NodeNotFoundException,
+ org.apache.maven.jrcs.diff.PatchFailedException
+ {
+ Node root = this.root();
+ for (int it = 0; it < _text.length; it++) {
+ original.add(new Line(root, _text[it]));
+ }
+ if (annotate && _parent != null)
+ _parent.pathTo(root.version).patch(original, true);
+ }
+}
+
1.2 +225 -225 jakarta-turbine-maven/src/java/org/apache/maven/jrcs/rcs/Version.java
Index: Version.java
===================================================================
RCS file: /home/cvs/jakarta-turbine-maven/src/java/org/apache/maven/jrcs/rcs/Version.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- Version.java 20 Feb 2002 16:20:03 -0000 1.1
+++ Version.java 20 Feb 2002 22:02:59 -0000 1.2
@@ -1,225 +1,225 @@
-package org.apache.maven.jrcs.rcs;
-
-import java.util.*;
-
-public class Version
-extends org.apache.maven.jrcs.util.ToString
-implements Cloneable, Comparable
-{
- int[] numbers = new int[0];
-
- public Version(int major) {
- numbers = new int[]{major};
- }
-
- public Version(int major, int minor) {
- numbers = new int[]{major, minor};
- }
-
- public Version(Integer[] num) {
- numbers = new int[num.length];
- for(int i = 0; i < num.length; i++)
- numbers[i] = num[i].intValue();
- }
-
- public Version(int[] num) {
- numbers = (int[]) num.clone();
- }
-
- public Version(String v) throws InvalidVersionNumberException {
- if (v.endsWith("."))
- v = v + "0";
- StringTokenizer t = new StringTokenizer(v, ".");
-
- int count = t.countTokens();
- if (even(count) && v.endsWith(".0"))
- count--; // allow a .0 ending only in branch revisions
-
- numbers = new int[count];
- for(int i = 0; i < count; i++) {
- try {
- numbers[i] = Integer.parseInt(t.nextToken());
- } catch(NumberFormatException e) {
- throw new InvalidVersionNumberException(v);
- }
- }
- }
-
- public Version(Version v) {
- this.numbers = (int[]) v.numbers.clone();
- if (!Arrays.equals(this.numbers, v.numbers))
- throw new java.lang.IllegalStateException(numbers.toString());
- }
-
- public Version() {
- }
-
- public Object clone()
- {
- return new Version(this);
- }
-
- public int[] getNumbers() {
- return (int[]) this.numbers.clone();
- }
-
- public int compareVersions(Version ver) {
- int[] nthis = this.numbers;
- int[] nthat = ver.numbers;
-
- int i;
- for(i = 0; i < nthis.length; i++) {
- if (i >= nthat.length || nthis[i] > nthat[i])
- return 1;
- else if (nthis[i] < nthat[i])
- return -1;
- }
- // all matched up to i-1
- if (nthat.length > i)
- return -1;
- else
- return 0;
- }
-
- public int compareTo(Object other) {
- if (other == this)
- return 0;
- else if (!(other instanceof Version))
- throw new IllegalArgumentException(other.toString());
- else {
- Version otherver = (Version) other;
- if (this.size() < otherver.size())
- return -1;
- else if (this.size() > otherver.size())
- return 1;
- else
- return -toString().compareTo(otherver.toString());
- }
- }
-
- public boolean isGreaterThan(Version ver) {
- return compareVersions(ver) > 0;
- }
-
- public boolean isGreaterOrEqualThan(Version ver) {
- return compareVersions(ver) >= 0;
- }
-
- public boolean isLessThan(Version ver) {
- return compareVersions(ver) < 0;
- }
-
- public boolean isLessOrEqualThan(Version ver) {
- return compareVersions(ver) <= 0;
- }
-
- public boolean equals(Object o) {
- if (this == o)
- return true;
- else if (! (o instanceof Version) )
- return false;
- else if (hashCode() != o.hashCode())
- return false;
- else
- return compareTo((Version) o) == 0;
- }
-
- public int hashCode() {
- return toString().hashCode();
- }
-
- public int at(int pos) {
- return numbers[pos];
- }
-
- public int last() {
- return at(size()-1);
- }
-
- public Version getBase(int positions) {
- positions = (positions > numbers.length ? numbers.length : positions);
- int[] result = new int[positions];
- System.arraycopy(this.numbers, 0, result, 0, positions);
- return new Version(result);
- }
-
- public Version getBranchPoint() {
- return getBase(size() - 1);
- }
-
- public Version next() {
- Version result = new Version(this);
- result.numbers[this.numbers.length-1] = this.last()+1;
- return result;
- }
-
- protected void __addBranch(Integer branch) {
- __addBranch(branch.intValue());
- }
-
- protected void __addBranch(int branch) {
- int[] newnum = new int[numbers.length + 1];
- System.arraycopy(this.numbers, 0, newnum, 0, numbers.length);
- newnum[numbers.length] = branch;
- this.numbers = newnum;
- }
-
- public Version newBranch(int branch) {
- int[] newnum = new int[numbers.length + 1];
- System.arraycopy(this.numbers, 0, newnum, 0, numbers.length);
- newnum[numbers.length] = branch;
-
- Version result = new Version();
- result.numbers = newnum;
- return result;
- }
-
- public int size() {
- return numbers.length;
- }
-
- public boolean isTrunk() {
- return (size() >= 1) && (size() <= 2);
- }
-
- public boolean isBranch() {
- return size() > 2;
- }
-
- public boolean isRevision() {
- return even();
- }
-
- public boolean isGhost() {
- for(int i = 0; i < size(); i++)
- if (numbers[i] <= 0)
- return true;
- return false;
- }
-
- public boolean even(int n) {
- return n % 2 == 0;
- }
-
- public boolean even() {
- return even(size());
- }
-
- public boolean odd(int n) {
- return !even(n);
- }
- public boolean odd() {
- return !even();
- }
-
- public void toString(StringBuffer s) {
- if (size() > 0) {
- s.append(Integer.toString(numbers[0]));
- for(int i = 1; i < numbers.length; i++) {
- s.append(".");
- s.append(Integer.toString(numbers[i]));
- }
- }
- }
-}
-
+package org.apache.maven.jrcs.rcs;
+
+import java.util.*;
+
+public class Version
+extends org.apache.maven.jrcs.util.ToString
+implements Cloneable, Comparable
+{
+ int[] numbers = new int[0];
+
+ public Version(int major) {
+ numbers = new int[]{major};
+ }
+
+ public Version(int major, int minor) {
+ numbers = new int[]{major, minor};
+ }
+
+ public Version(Integer[] num) {
+ numbers = new int[num.length];
+ for(int i = 0; i < num.length; i++)
+ numbers[i] = num[i].intValue();
+ }
+
+ public Version(int[] num) {
+ numbers = (int[]) num.clone();
+ }
+
+ public Version(String v) throws InvalidVersionNumberException {
+ if (v.endsWith("."))
+ v = v + "0";
+ StringTokenizer t = new StringTokenizer(v, ".");
+
+ int count = t.countTokens();
+ if (even(count) && v.endsWith(".0"))
+ count--; // allow a .0 ending only in branch revisions
+
+ numbers = new int[count];
+ for(int i = 0; i < count; i++) {
+ try {
+ numbers[i] = Integer.parseInt(t.nextToken());
+ } catch(NumberFormatException e) {
+ throw new InvalidVersionNumberException(v);
+ }
+ }
+ }
+
+ public Version(Version v) {
+ this.numbers = (int[]) v.numbers.clone();
+ if (!Arrays.equals(this.numbers, v.numbers))
+ throw new java.lang.IllegalStateException(numbers.toString());
+ }
+
+ public Version() {
+ }
+
+ public Object clone()
+ {
+ return new Version(this);
+ }
+
+ public int[] getNumbers() {
+ return (int[]) this.numbers.clone();
+ }
+
+ public int compareVersions(Version ver) {
+ int[] nthis = this.numbers;
+ int[] nthat = ver.numbers;
+
+ int i;
+ for(i = 0; i < nthis.length; i++) {
+ if (i >= nthat.length || nthis[i] > nthat[i])
+ return 1;
+ else if (nthis[i] < nthat[i])
+ return -1;
+ }
+ // all matched up to i-1
+ if (nthat.length > i)
+ return -1;
+ else
+ return 0;
+ }
+
+ public int compareTo(Object other) {
+ if (other == this)
+ return 0;
+ else if (!(other instanceof Version))
+ throw new IllegalArgumentException(other.toString());
+ else {
+ Version otherver = (Version) other;
+ if (this.size() < otherver.size())
+ return -1;
+ else if (this.size() > otherver.size())
+ return 1;
+ else
+ return -toString().compareTo(otherver.toString());
+ }
+ }
+
+ public boolean isGreaterThan(Version ver) {
+ return compareVersions(ver) > 0;
+ }
+
+ public boolean isGreaterOrEqualThan(Version ver) {
+ return compareVersions(ver) >= 0;
+ }
+
+ public boolean isLessThan(Version ver) {
+ return compareVersions(ver) < 0;
+ }
+
+ public boolean isLessOrEqualThan(Version ver) {
+ return compareVersions(ver) <= 0;
+ }
+
+ public boolean equals(Object o) {
+ if (this == o)
+ return true;
+ else if (! (o instanceof Version) )
+ return false;
+ else if (hashCode() != o.hashCode())
+ return false;
+ else
+ return compareTo((Version) o) == 0;
+ }
+
+ public int hashCode() {
+ return toString().hashCode();
+ }
+
+ public int at(int pos) {
+ return numbers[pos];
+ }
+
+ public int last() {
+ return at(size()-1);
+ }
+
+ public Version getBase(int positions) {
+ positions = (positions > numbers.length ? numbers.length : positions);
+ int[] result = new int[positions];
+ System.arraycopy(this.numbers, 0, result, 0, positions);
+ return new Version(result);
+ }
+
+ public Version getBranchPoint() {
+ return getBase(size() - 1);
+ }
+
+ public Version next() {
+ Version result = new Version(this);
+ result.numbers[this.numbers.length-1] = this.last()+1;
+ return result;
+ }
+
+ protected void __addBranch(Integer branch) {
+ __addBranch(branch.intValue());
+ }
+
+ protected void __addBranch(int branch) {
+ int[] newnum = new int[numbers.length + 1];
+ System.arraycopy(this.numbers, 0, newnum, 0, numbers.length);
+ newnum[numbers.length] = branch;
+ this.numbers = newnum;
+ }
+
+ public Version newBranch(int branch) {
+ int[] newnum = new int[numbers.length + 1];
+ System.arraycopy(this.numbers, 0, newnum, 0, numbers.length);
+ newnum[numbers.length] = branch;
+
+ Version result = new Version();
+ result.numbers = newnum;
+ return result;
+ }
+
+ public int size() {
+ return numbers.length;
+ }
+
+ public boolean isTrunk() {
+ return (size() >= 1) && (size() <= 2);
+ }
+
+ public boolean isBranch() {
+ return size() > 2;
+ }
+
+ public boolean isRevision() {
+ return even();
+ }
+
+ public boolean isGhost() {
+ for(int i = 0; i < size(); i++)
+ if (numbers[i] <= 0)
+ return true;
+ return false;
+ }
+
+ public boolean even(int n) {
+ return n % 2 == 0;
+ }
+
+ public boolean even() {
+ return even(size());
+ }
+
+ public boolean odd(int n) {
+ return !even(n);
+ }
+ public boolean odd() {
+ return !even();
+ }
+
+ public void toString(StringBuffer s) {
+ if (size() > 0) {
+ s.append(Integer.toString(numbers[0]));
+ for(int i = 1; i < numbers.length; i++) {
+ s.append(".");
+ s.append(Integer.toString(numbers[i]));
+ }
+ }
+ }
+}
+
--
To unsubscribe, e-mail: <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>