01: /* Generated By:JavaCC: Do not edit this line. Token.java Version 3.0 */
02: package com.jeta.forms.gui.common.parsers;
03:
04: /**
05: * Describes the input token stream.
06: */
07:
08: public class Token {
09:
10: /**
11: * An integer that describes the kind of this token. This numbering system
12: * is determined by JavaCCParser, and a table of these numbers is stored in
13: * the file ...Constants.java.
14: */
15: public int kind;
16:
17: /**
18: * beginLine and beginColumn describe the position of the first character of
19: * this token; endLine and endColumn describe the position of the last
20: * character of this token.
21: */
22: public int beginLine, beginColumn, endLine, endColumn;
23:
24: /**
25: * The string image of the token.
26: */
27: public String image;
28:
29: /**
30: * A reference to the next regular (non-special) token from the input
31: * stream. If this is the last token from the input stream, or if the token
32: * manager has not read tokens beyond this one, this field is set to null.
33: * This is true only if this token is also a regular token. Otherwise, see
34: * below for a description of the contents of this field.
35: */
36: public Token next;
37:
38: /**
39: * This field is used to access special tokens that occur prior to this
40: * token, but after the immediately preceding regular (non-special) token.
41: * If there are no such special tokens, this field is set to null. When
42: * there are more than one such special token, this field refers to the last
43: * of these special tokens, which in turn refers to the next previous
44: * special token through its specialToken field, and so on until the first
45: * special token (whose specialToken field is null). The next fields of
46: * special tokens refer to other special tokens that immediately follow it
47: * (without an intervening regular token). If there is no such token, this
48: * field is null.
49: */
50: public Token specialToken;
51:
52: /**
53: * Returns the image.
54: */
55: public String toString() {
56: return image;
57: }
58:
59: /**
60: * Returns a new Token object, by default. However, if you want, you can
61: * create and return subclass objects based on the value of ofKind. Simply
62: * add the cases to the switch for all those special cases. For example, if
63: * you have a subclass of Token called IDToken that you want to create if
64: * ofKind is ID, simlpy add something like :
65: *
66: * case MyParserConstants.ID : return new IDToken();
67: *
68: * to the following switch statement. Then you can cast matchedToken
69: * variable to the appropriate type and use it in your lexical actions.
70: */
71: public static final Token newToken(int ofKind) {
72: switch (ofKind) {
73: default:
74: return new Token();
75: }
76: }
77:
78: }
|