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/03/03 23:14:20 UTC
cvs commit: jakarta-turbine-maven/src/java/org/apache/maven/jrcs/rcs ArchiveParser.java ArchiveParser.jj ArchiveParserConstants.java ArchiveParserTokenManager.java Node.java ParseException.java Token.java TokenMgrError.java
juanco 02/03/03 14:14:20
Modified: src/java/org/apache/maven/jrcs/rcs ArchiveParser.java
ArchiveParser.jj ArchiveParserConstants.java
ArchiveParserTokenManager.java Node.java
ParseException.java Token.java TokenMgrError.java
Log:
updated JavaCC .jj parser and regenerated .java parser
Revision Changes Path
1.9 +674 -856 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.8
retrieving revision 1.9
diff -u -r1.8 -r1.9
--- ArchiveParser.java 3 Mar 2002 21:57:20 -0000 1.8
+++ ArchiveParser.java 3 Mar 2002 22:14:20 -0000 1.9
@@ -1,60 +1,6 @@
+/* Generated By:JavaCC: Do not edit this line. ArchiveParser.java */
package org.apache.maven.jrcs.rcs;
-
-/* ====================================================================
- * The Apache Software License, Version 1.1
- *
- * Copyright (c) 2002 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/>.
- */
-
import java.util.Map;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
@@ -63,827 +9,699 @@
/**
* Parses an RCS/CVS style version control archive into an Archive.
* This class is NOT thread safe.
- *
+ *
* @author <a href="mailto:juanco@suigeneris.org">Juanco Anez</a>
- * @version $Id: ArchiveParser.java,v 1.8 2002/03/03 21:57:20 juanco Exp $
+ * @version $Id: ArchiveParser.java,v 1.9 2002/03/03 22:14:20 juanco Exp $
* @see Archive
*/
-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 FileInputStream(args[0]));
- }
- catch (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, InputStream input) throws ParseException
- {
- ArchiveParser parser = new ArchiveParser(input);
- parser.archive(arc);
- }
-
- public static void load(Archive arc, String fname) throws FileNotFoundException, ParseException
- {
- load(arc, new 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);
- }
+class ArchiveParser implements ArchiveParserConstants {
- 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);
- }
+ static final String ident = "RCS ArchiveParser Parser $version$:";
- final public void locks(Archive arc) throws ParseException
+ public static void main(String args[]) {
+ ArchiveParser parser;
+ if (args.length == 0)
{
- 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:
- ;
- }
+ System.out.println(ident + " Reading from standard input . . .");
+ parser = new ArchiveParser(System.in);
}
-
- final public void comment(Archive arc) throws ParseException
+ else if (args.length == 1)
{
- String s;
- jj_consume_token(COMMENT);
- switch (jj_nt.kind)
- {
- case STRING:
- s = string();
- arc.setComment(s);
- break;
- default:
- ;
- }
- jj_consume_token(29);
+ System.out.println(ident + " Reading from file " + args[0] + " . . .");
+ try
+ {
+ parser = new ArchiveParser(new FileInputStream(args[0]));
+ }
+ catch (java.io.FileNotFoundException e)
+ {
+ System.out.println(ident + " File " + args[0] + " not found.");
+ return;
+ }
}
-
- final public void expand(Archive arc) throws ParseException
+ else
{
- String s;
- jj_consume_token(EXPAND);
- switch (jj_nt.kind)
- {
- case STRING:
- s = string();
- arc.setExpand(s);
- break;
- default:
- ;
- }
- jj_consume_token(29);
+ 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();
+ }
- 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());
- }
+ public static void load(Archive arc, InputStream input) throws ParseException
+ {
+ ArchiveParser parser = new ArchiveParser(input);
+ parser.archive(arc);
+ }
- 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");
- }
+ public static void load(Archive arc, String fname) throws FileNotFoundException, ParseException
+ {
+ load(arc, new FileInputStream(fname) );
+ }
- final public String simpleWord() throws ParseException
+ public void parse()
+ {
+ try
{
- 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");
+ archive(null);
+ System.out.println("RCS ArchiveParser Parser version 1.1: RCS ArchiveParser parsed successfully.");
}
-
- final public String pair() throws ParseException
+ catch (ParseException e)
{
- 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");
+ System.out.println("RCS ArchiveParser Parser version 1.1: Encountered errors during parse.");
}
+ }
- 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.getPhrases());
- }
-
- final public void text(Archive arc) throws ParseException
- {
- Version v;
- Node node;
- String log;
- String txt;
- v = version();
- node = arc.getNode(v);
- jj_consume_token(LOG);
- log = string();
- node.setLog(log);
- newPhrases(node.getPhrases());
- 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;
- }
+/**
+* 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.getNode(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_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;
+ }
+
+ 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;
+ }
+
+ public ArchiveParserTokenManager token_source;
+ JavaCharStream 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 JavaCharStream(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 JavaCharStream(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 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 enable_tracing()
- {
- }
-
- final public void disable_tracing()
- {
- }
+ final public void disable_tracing() {
+ }
}
1.7 +4 -4 jakarta-turbine-maven/src/java/org/apache/maven/jrcs/rcs/ArchiveParser.jj
Index: ArchiveParser.jj
===================================================================
RCS file: /home/cvs/jakarta-turbine-maven/src/java/org/apache/maven/jrcs/rcs/ArchiveParser.jj,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -r1.6 -r1.7
--- ArchiveParser.jj 3 Mar 2002 21:57:20 -0000 1.6
+++ ArchiveParser.jj 3 Mar 2002 22:14:20 -0000 1.7
@@ -90,7 +90,7 @@
* This class is NOT thread safe.
*
* @author <a href="mailto:juanco@suigeneris.org">Juanco Anez</a>
- * @version $Id: ArchiveParser.jj,v 1.6 2002/03/03 21:57:20 juanco Exp $
+ * @version $Id: ArchiveParser.jj,v 1.7 2002/03/03 22:14:20 juanco Exp $
* @see Archive
*/
class ArchiveParser {
@@ -264,7 +264,7 @@
{
( comment(arc)
| expand(arc)
- | newPhrase(arc._phrases)
+ | newPhrase(arc.phrases)
)*
}
@@ -392,7 +392,7 @@
<STATE> [ s = id() { node.setState(s); } ] ";"
<BRANCHES> ( v = version() { node.addBranch(arc.newBranchNode(v)); } )* ";"
<NEXT> [ v = version() { node.setRCSNext(arc.newNode(v));} ] ";"
- newPhrases(node._phrases)
+ newPhrases(node.phrases)
}
void text(Archive arc) :
@@ -412,7 +412,7 @@
{
node.setLog(log);
}
- newPhrases(node._phrases)
+ newPhrases(node.phrases)
<TEXT> txt = string()
{
1.3 +1 -54 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.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- ArchiveParserConstants.java 20 Feb 2002 22:02:59 -0000 1.2
+++ ArchiveParserConstants.java 3 Mar 2002 22:14:20 -0000 1.3
@@ -1,58 +1,5 @@
+/* Generated By:JavaCC: Do not edit this line. ArchiveParserConstants.java */
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 {
1.4 +13 -62 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.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- ArchiveParserTokenManager.java 20 Feb 2002 22:07:46 -0000 1.3
+++ ArchiveParserTokenManager.java 3 Mar 2002 22:14:20 -0000 1.4
@@ -1,63 +1,14 @@
+/* Generated By:JavaCC: Do not edit this line. ArchiveParserTokenManager.java */
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/>.
- */
-
-import java.util.*;
+import java.util.Map;
+import java.io.FileInputStream;
+import java.io.FileNotFoundException;
+import java.io.InputStream;
public class ArchiveParserTokenManager implements ArchiveParserConstants
{
+ public java.io.PrintStream debugStream = System.out;
+ public void setDebugStream(java.io.PrintStream ds) { debugStream = ds; }
private final int jjStopStringLiteralDfa_0(int pos, long active0)
{
switch (pos)
@@ -801,22 +752,22 @@
static final long[] jjtoSkip = {
0x3eL,
};
-private ASCII_UCodeESC_CharStream input_stream;
+private JavaCharStream 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)
+public ArchiveParserTokenManager(JavaCharStream stream)
{
- if (ASCII_UCodeESC_CharStream.staticFlag)
+ if (JavaCharStream.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)
+public ArchiveParserTokenManager(JavaCharStream stream, int lexState)
{
this(stream);
SwitchTo(lexState);
}
-public void ReInit(ASCII_UCodeESC_CharStream stream)
+public void ReInit(JavaCharStream stream)
{
jjmatchedPos = jjnewStateCnt = 0;
curLexState = defaultLexState;
@@ -830,7 +781,7 @@
for (i = 14; i-- > 0;)
jjrounds[i] = 0x80000000;
}
-public void ReInit(ASCII_UCodeESC_CharStream stream, int lexState)
+public void ReInit(JavaCharStream stream, int lexState)
{
ReInit(stream);
SwitchTo(lexState);
1.11 +5 -5 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.10
retrieving revision 1.11
diff -u -r1.10 -r1.11
--- Node.java 3 Mar 2002 21:57:20 -0000 1.10
+++ Node.java 3 Mar 2002 22:14:20 -0000 1.11
@@ -88,7 +88,7 @@
* @see Archive
*
* @author <a href="mailto:juanco@suigeneris.org">Juanco Anez</a>
- * @version $Id: Node.java,v 1.10 2002/03/03 21:57:20 juanco Exp $
+ * @version $Id: Node.java,v 1.11 2002/03/03 22:14:20 juanco Exp $
*/
public abstract class Node
extends ToString
@@ -109,7 +109,7 @@
protected Node parent;
protected Node child;
protected TreeMap branches = null;
- protected Phrases _phrases = null;
+ protected Phrases phrases = null;
protected static final Format dateFormatter = new MessageFormat(
"\t{0,number,##00}." +
@@ -670,9 +670,9 @@
s.append(Archive.quoteString(log));
s.append(EOL);
- if (_phrases != null)
+ if (phrases != null)
{
- s.append(_phrases.toString());
+ s.append(phrases.toString());
}
s.append("text" + EOL);
@@ -788,7 +788,7 @@
protected Phrases getPhrases()
{
- return _phrases;
+ return phrases;
}
}
1.5 +174 -249 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.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- ParseException.java 23 Feb 2002 13:52:59 -0000 1.4
+++ ParseException.java 3 Mar 2002 22:14:20 -0000 1.5
@@ -1,60 +1,6 @@
+/* Generated By:JavaCC: Do not edit this line. ParseException.java Version 2.1 */
package org.apache.maven.jrcs.rcs;
-/* ====================================================================
- * The Apache Software License, Version 1.1
- *
- * Copyright (c) 2002 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/>.
- */
-
-
/**
* This exception is thrown when parse errors are encountered.
* You can explicitly create objects of this exception type by
@@ -64,204 +10,183 @@
* You can modify this class to customize your error reporting
* mechanisms so long as you retain the public fields.
*/
-public class ParseException extends Exception
-{
+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;
+ /**
+ * 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();
}
-
- /**
- * 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;
+ 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 + " ";
}
-
- public ParseException(String message)
- {
- super(message);
- specialConstructor = false;
+ 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;
}
-
- /**
- * 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();
+ retval += "\" at line " + currentToken.next.beginLine + ", column " + currentToken.next.beginColumn;
+ retval += "." + 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.5 +72 -128 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.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- Token.java 23 Feb 2002 13:52:59 -0000 1.4
+++ Token.java 3 Mar 2002 22:14:20 -0000 1.5
@@ -1,137 +1,81 @@
+/* Generated By:JavaCC: Do not edit this line. Token.java Version 2.1 */
package org.apache.maven.jrcs.rcs;
-/* ====================================================================
- * The Apache Software License, Version 1.1
- *
- * Copyright (c) 2002 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/>.
- */
-
-
/**
* Describes the input token stream.
*/
-public class Token
-{
+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();
- }
- }
+ /**
+ * 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.5 +126 -191 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.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- TokenMgrError.java 23 Feb 2002 13:52:59 -0000 1.4
+++ TokenMgrError.java 3 Mar 2002 22:14:20 -0000 1.5
@@ -1,198 +1,133 @@
-/* Generated By:JavaCC: Do not edit this line. TokenMgrError.java Version 0.7pre2 */
+/* Generated By:JavaCC: Do not edit this line. TokenMgrError.java Version 2.1 */
package org.apache.maven.jrcs.rcs;
-/* ====================================================================
- * The Apache Software License, Version 1.1
- *
- * Copyright (c) 2002 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 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++)
+ /*
+ * 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))
{
- 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;
- }
+ 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);
- }
+ }
+ 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);
+ }
}
--
To unsubscribe, e-mail: <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>