001    /* Generated By:JavaCC: Do not edit this line. Token.java Version 2.1 */
002    package org.activemq.selector;
003    
004    /**
005     * Describes the input token stream.
006     */
007    
008    public class Token {
009    
010        /**
011         * An integer that describes the kind of this token.  This numbering
012         * system is determined by JavaCCParser, and a table of these numbers is
013         * stored in the file ...Constants.java.
014         */
015        public int kind;
016    
017        /**
018         * beginLine and beginColumn describe the position of the first character
019         * of this token; endLine and endColumn describe the position of the
020         * last character of this token.
021         */
022        public int beginLine, beginColumn, endLine, endColumn;
023    
024        /**
025         * The string image of the token.
026         */
027        public String image;
028    
029        /**
030         * A reference to the next regular (non-special) token from the input
031         * stream.  If this is the last token from the input stream, or if the
032         * token manager has not read tokens beyond this one, this field is
033         * set to null.  This is true only if this token is also a regular
034         * token.  Otherwise, see below for a description of the contents of
035         * this field.
036         */
037        public Token next;
038    
039        /**
040         * This field is used to access special tokens that occur prior to this
041         * token, but after the immediately preceding regular (non-special) token.
042         * If there are no such special tokens, this field is set to null.
043         * When there are more than one such special token, this field refers
044         * to the last of these special tokens, which in turn refers to the next
045         * previous special token through its specialToken field, and so on
046         * until the first special token (whose specialToken field is null).
047         * The next fields of special tokens refer to other special tokens that
048         * immediately follow it (without an intervening regular token).  If there
049         * is no such token, this field is null.
050         */
051        public Token specialToken;
052    
053        /**
054         * Returns the image.
055         */
056        public final String toString() {
057            return image;
058        }
059    
060        /**
061         * Returns a new Token object, by default. However, if you want, you
062         * can create and return subclass objects based on the value of ofKind.
063         * Simply add the cases to the switch for all those special cases.
064         * For example, if you have a subclass of Token called IDToken that
065         * you want to create if ofKind is ID, simlpy add something like :
066         * <p/>
067         * case MyParserConstants.ID : return new IDToken();
068         * <p/>
069         * to the following switch statement. Then you can cast matchedToken
070         * variable to the appropriate type and use it in your lexical actions.
071         */
072        public static final Token newToken(int ofKind) {
073            switch (ofKind) {
074                default :
075                    return new Token();
076            }
077        }
078    
079    }