2
* Copyright (C) 2001-2012 Michael Fuchs
4
* This file is part of herold.
6
* herold is free software: you can redistribute it and/or modify
7
* it under the terms of the GNU General Public License as published by
8
* the Free Software Foundation, either version 3 of the License, or
9
* (at your option) any later version.
11
* herold is distributed in the hope that it will be useful,
12
* but WITHOUT ANY WARRANTY; without even the implied warranty of
13
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14
* GNU General Public License for more details.
16
* You should have received a copy of the GNU General Public License
17
* along with herold. If not, see <http://www.gnu.org/licenses/>.
19
package org.dbdoclet.trafo.xml.tokenizer.parser;
22
* Describes the input token stream.
25
@SuppressWarnings("all")
26
public class Token implements java.io.Serializable {
29
* The version identifier for this Serializable class.
30
* Increment only if the <i>serialized</i> form of the
33
private static final long serialVersionUID = 1L;
36
* An integer that describes the kind of this token. This numbering
37
* system is determined by JavaCCParser, and a table of these numbers is
38
* stored in the file ...Constants.java.
42
/** The line number of the first character of this Token. */
44
/** The column number of the first character of this Token. */
45
public int beginColumn;
46
/** The line number of the last character of this Token. */
48
/** The column number of the last character of this Token. */
52
* The string image of the token.
57
* A reference to the next regular (non-special) token from the input
58
* stream. If this is the last token from the input stream, or if the
59
* token manager has not read tokens beyond this one, this field is
60
* set to null. This is true only if this token is also a regular
61
* token. Otherwise, see below for a description of the contents of
67
* This field is used to access special tokens that occur prior to this
68
* token, but after the immediately preceding regular (non-special) token.
69
* If there are no such special tokens, this field is set to null.
70
* When there are more than one such special token, this field refers
71
* to the last of these special tokens, which in turn refers to the next
72
* previous special token through its specialToken field, and so on
73
* until the first special token (whose specialToken field is null).
74
* The next fields of special tokens refer to other special tokens that
75
* immediately follow it (without an intervening regular token). If there
76
* is no such token, this field is null.
78
public Token specialToken;
81
* An optional attribute value of the Token.
82
* Tokens which are not used as syntactic sugar will often contain
83
* meaningful values that will be used later on by the compiler or
84
* interpreter. This attribute value is often different from the image.
85
* Any subclass of Token that actually wants to return a non-null value can
86
* override this method as appropriate.
88
public Object getValue() {
93
* No-argument constructor
98
* Constructs a new token for the specified Image.
100
public Token(int kind)
106
* Constructs a new token for the specified Image and Kind.
108
public Token(int kind, String image)
117
public String toString()
123
* Returns a new Token object, by default. However, if you want, you
124
* can create and return subclass objects based on the value of ofKind.
125
* Simply add the cases to the switch for all those special cases.
126
* For example, if you have a subclass of Token called IDToken that
127
* you want to create if ofKind is ID, simply add something like :
129
* case MyParserConstants.ID : return new IDToken(ofKind, image);
131
* to the following switch statement. Then you can cast matchedToken
132
* variable to the appropriate type and use sit in your lexical actions.
134
public static Token newToken(int ofKind, String image)
138
default : return new Token(ofKind, image);
142
public static Token newToken(int ofKind)
144
return newToken(ofKind, null);
148
/* JavaCC - OriginalChecksum=32dcceb3d060b8c3753de8b101388514 (do not edit this line) */