01: /*
02: * The contents of this file are subject to the
03: * Mozilla Public License Version 1.1 (the "License");
04: * you may not use this file except in compliance with the License.
05: * You may obtain a copy of the License at http://www.mozilla.org/MPL/
06: *
07: * Software distributed under the License is distributed on an "AS IS"
08: * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied.
09: * See the License for the specific language governing rights and
10: * limitations under the License.
11: *
12: * The Initial Developer of the Original Code is Simulacra Media Ltd.
13: * Portions created by Simulacra Media Ltd are Copyright (C) Simulacra Media Ltd, 2004.
14: *
15: * All Rights Reserved.
16: *
17: * Contributor(s):
18: */
19:
20: /* Generated By:JavaCC: Do not edit this line. Token.java Version 2.1 */
21: package org.openharmonise.commons.xml.parser;
22:
23: /**
24: * Describes the input token stream.
25: */
26:
27: public class Token {
28:
29: /**
30: * An integer that describes the kind of this token. This numbering
31: * system is determined by JavaCCParser, and a table of these numbers is
32: * stored in the file ...Constants.java.
33: */
34: public int kind;
35:
36: /**
37: * beginLine and beginColumn describe the position of the first character
38: * of this token; endLine and endColumn describe the position of the
39: * last character of this token.
40: */
41: public int beginLine, beginColumn, endLine, endColumn;
42:
43: /**
44: * The string image of the token.
45: */
46: public String image;
47:
48: /**
49: * A reference to the next regular (non-special) token from the input
50: * stream. If this is the last token from the input stream, or if the
51: * token manager has not read tokens beyond this one, this field is
52: * set to null. This is true only if this token is also a regular
53: * token. Otherwise, see below for a description of the contents of
54: * this field.
55: */
56: public Token next;
57:
58: /**
59: * This field is used to access special tokens that occur prior to this
60: * token, but after the immediately preceding regular (non-special) token.
61: * If there are no such special tokens, this field is set to null.
62: * When there are more than one such special token, this field refers
63: * to the last of these special tokens, which in turn refers to the next
64: * previous special token through its specialToken field, and so on
65: * until the first special token (whose specialToken field is null).
66: * The next fields of special tokens refer to other special tokens that
67: * immediately follow it (without an intervening regular token). If there
68: * is no such token, this field is null.
69: */
70: public Token specialToken;
71:
72: /**
73: * Returns the image.
74: */
75: public final String toString() {
76: return image;
77: }
78:
79: /**
80: * Returns a new Token object, by default. However, if you want, you
81: * can create and return subclass objects based on the value of ofKind.
82: * Simply add the cases to the switch for all those special cases.
83: * For example, if you have a subclass of Token called IDToken that
84: * you want to create if ofKind is ID, simlpy add something like :
85: *
86: * case MyParserConstants.ID : return new IDToken();
87: *
88: * to the following switch statement. Then you can cast matchedToken
89: * variable to the appropriate type and use it in your lexical actions.
90: */
91: public static final Token newToken(int ofKind) {
92: switch (ofKind) {
93: default:
94: return new Token();
95: }
96: }
97:
98: }
|