01: /* Generated By:JavaCC: Do not edit this line. Token.java Version 2.1 */
02: // package com.tchibo.misc.lucene;
03: package vqwiki.utils.lucene;
04:
05: /**
06: * Describes the input token stream.
07: *
08: * @version $Id: Token.java 234 2003-04-15 23:11:06Z garethc $
09: */
10:
11: public class Token {
12:
13: /**
14: * beginLine and beginColumn describe the position of the first character
15: * of this token; endLine and endColumn describe the position of the
16: * last character of this token.
17: */
18: public int beginLine, beginColumn, endLine, endColumn;
19:
20: /**
21: * The string image of the token.
22: */
23: public String image;
24:
25: /**
26: * An integer that describes the kind of this token. This numbering
27: * system is determined by JavaCCParser, and a table of these numbers is
28: * stored in the file ...Constants.java.
29: */
30: public int kind;
31:
32: /**
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
38: * this field.
39: */
40: public Token next;
41:
42: /**
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.
53: */
54: public Token specialToken;
55:
56: /**
57: * Returns a new Token object, by default. However, if you want, you
58: * can create and return subclass objects based on the value of ofKind.
59: * Simply add the cases to the switch for all those special cases.
60: * For example, if you have a subclass of Token called IDToken that
61: * you want to create if ofKind is ID, simlpy add something like :
62: *
63: * case MyParserConstants.ID : return new IDToken();
64: *
65: * to the following switch statement. Then you can cast matchedToken
66: * variable to the appropriate type and use it in your lexical actions.
67: *
68: * @param ofKind TODO: Document this parameter.
69: * @return TODO: Document the result.
70: */
71: public final static Token newToken(int ofKind) {
72: switch (ofKind) {
73: default:
74: return new Token();
75: }
76: }
77:
78: /**
79: * Returns the image.
80: *
81: * @return TODO: Document the result.
82: */
83: public final String toString() {
84: return image;
85: }
86:
87: }
|