01: /* Generated By:JavaCC: Do not edit this line. Token.java Version 3.0 */
02: /**
03: * JSP Parser for PMD.
04: * @author Pietern, Application Engineers NV/SA, http://www.ae.be
05: */package net.sourceforge.pmd.jsp.ast;
06:
07: /**
08: * Describes the input token stream.
09: */
10:
11: public class Token {
12:
13: /**
14: * An integer that describes the kind of this token. This numbering
15: * system is determined by JavaCCParser, and a table of these numbers is
16: * stored in the file ...Constants.java.
17: */
18: public int kind;
19:
20: /**
21: * beginLine and beginColumn describe the position of the first character
22: * of this token; endLine and endColumn describe the position of the
23: * last character of this token.
24: */
25: public int beginLine, beginColumn, endLine, endColumn;
26:
27: /**
28: * The string image of the token.
29: */
30: public String image;
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 the image.
58: */
59: public String toString() {
60: return image;
61: }
62:
63: /**
64: * Returns a new Token object, by default. However, if you want, you
65: * can create and return subclass objects based on the value of ofKind.
66: * Simply add the cases to the switch for all those special cases.
67: * For example, if you have a subclass of Token called IDToken that
68: * you want to create if ofKind is ID, simlpy add something like :
69: * <p/>
70: * case MyParserConstants.ID : return new IDToken();
71: * <p/>
72: * to the following switch statement. Then you can cast matchedToken
73: * variable to the appropriate type and use it in your lexical actions.
74: */
75: public static final Token newToken(int ofKind) {
76: switch (ofKind) {
77: default:
78: return new Token();
79: }
80: }
81:
82: }
|