From: Tim P <ti...@us...> - 2008-03-17 23:44:00
|
Update of /cvsroot/webmacro/webmacro/src/org/webmacro/parser In directory sc8-pr-cvs9.sourceforge.net:/tmp/cvs-serv21172/src/org/webmacro/parser Modified Files: Token.java Log Message: Generated with 4.1, not 3.0, only a change in comment Index: Token.java =================================================================== RCS file: /cvsroot/webmacro/webmacro/src/org/webmacro/parser/Token.java,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** Token.java 27 May 2005 19:44:58 -0000 1.5 --- Token.java 17 Mar 2008 23:43:44 -0000 1.6 *************** *** 1,3 **** ! /* Generated By:JavaCC: Do not edit this line. Token.java Version 3.0 */ package org.webmacro.parser; --- 1,3 ---- ! /* Generated By:JavaCC: Do not edit this line. Token.java Version 4.1 */ package org.webmacro.parser; *************** *** 15,24 **** 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; /** --- 15,26 ---- public int kind; ! /** The line number of the first character of this Token. */ ! public int beginLine; ! /** The column number of the first character of this Token. */ ! public int beginColumn; ! /** The line number of the last character of this Token. */ ! public int endLine; ! /** The column number of the last character of this Token. */ ! public int endColumn; /** *************** *** 52,55 **** --- 54,79 ---- /** + * No-argument contructor + */ + public Token() {} + + /** + * Constructs a new token for the specified Image. + */ + public Token(int kind) + { + this(kind, null); + } + + /** + * Constructs a new token for the specified Image and Kind. + */ + public Token(int kind, String image) + { + this.kind = kind; + this.image = image; + } + + /** * Returns the image. */ *************** *** 64,81 **** * 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(); } } } --- 88,110 ---- * 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, simply add something like : * ! * case MyParserConstants.ID : return new IDToken(ofKind, image); * * to the following switch statement. Then you can cast matchedToken * variable to the appropriate type and use it in your lexical actions. */ ! public static final Token newToken(int ofKind, String image) { switch(ofKind) { ! default : return new Token(ofKind, image); } } + public static final Token newToken(int ofKind) + { + return newToken(ofKind, null); + } + } |