1 /* Generated By:JavaCC: Do not edit this line. Token.java Version 4.1 */
2 /* JavaCCOptions:TOKEN_EXTENDS=,KEEP_LINE_COL=null */
3 package org.apache.lucene.queryParser;
6 * Describes the input token stream.
12 * An integer that describes the kind of this token. This numbering
13 * system is determined by JavaCCParser, and a table of these numbers is
14 * stored in the file ...Constants.java.
18 /** The line number of the first character of this Token. */
20 /** The column number of the first character of this Token. */
21 public int beginColumn;
22 /** The line number of the last character of this Token. */
24 /** The column number of the last character of this Token. */
28 * The string image of the token.
33 * A reference to the next regular (non-special) token from the input
34 * stream. If this is the last token from the input stream, or if the
35 * token manager has not read tokens beyond this one, this field is
36 * set to null. This is true only if this token is also a regular
37 * token. Otherwise, see below for a description of the contents of
43 * This field is used to access special tokens that occur prior to this
44 * token, but after the immediately preceding regular (non-special) token.
45 * If there are no such special tokens, this field is set to null.
46 * When there are more than one such special token, this field refers
47 * to the last of these special tokens, which in turn refers to the next
48 * previous special token through its specialToken field, and so on
49 * until the first special token (whose specialToken field is null).
50 * The next fields of special tokens refer to other special tokens that
51 * immediately follow it (without an intervening regular token). If there
52 * is no such token, this field is null.
54 public Token specialToken;
57 * An optional attribute value of the Token.
58 * Tokens which are not used as syntactic sugar will often contain
59 * meaningful values that will be used later on by the compiler or
60 * interpreter. This attribute value is often different from the image.
61 * Any subclass of Token that actually wants to return a non-null value can
62 * override this method as appropriate.
64 public Object getValue() {
69 * No-argument constructor
74 * Constructs a new token for the specified Image.
76 public Token(int kind)
82 * Constructs a new token for the specified Image and Kind.
84 public Token(int kind, String image)
93 public String toString()
99 * Returns a new Token object, by default. However, if you want, you
100 * can create and return subclass objects based on the value of ofKind.
101 * Simply add the cases to the switch for all those special cases.
102 * For example, if you have a subclass of Token called IDToken that
103 * you want to create if ofKind is ID, simply add something like :
105 * case MyParserConstants.ID : return new IDToken(ofKind, image);
107 * to the following switch statement. Then you can cast matchedToken
108 * variable to the appropriate type and use sit in your lexical actions.
110 public static Token newToken(int ofKind, String image)
114 default : return new Token(ofKind, image);
118 public static Token newToken(int ofKind)
120 return newToken(ofKind, null);
124 /* JavaCC - OriginalChecksum=c147cc166a7cf8812c7c39bc8c5eb868 (do not edit this line) */