001 /*
002 * Cobertura - http://cobertura.sourceforge.net/
003 *
004 * This file was taken from JavaNCSS
005 * http://www.kclee.com/clemens/java/javancss/
006 * Copyright (C) 2000 Chr. Clemens Lee <clemens a.t kclee d.o.t com>
007 *
008 * Cobertura is free software; you can redistribute it and/or modify
009 * it under the terms of the GNU General Public License as published
010 * by the Free Software Foundation; either version 2 of the License,
011 * or (at your option) any later version.
012 *
013 * Cobertura is distributed in the hope that it will be useful, but
014 * WITHOUT ANY WARRANTY; without even the implied warranty of
015 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
016 * General Public License for more details.
017 *
018 * You should have received a copy of the GNU General Public License
019 * along with Cobertura; if not, write to the Free Software
020 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
021 * USA
022 */
023
024
025 /*
026 *
027 * WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING
028 *
029 * WARNING TO COBERTURA DEVELOPERS
030 *
031 * DO NOT MODIFY THIS FILE!
032 *
033 * MODIFY THE FILES UNDER THE JAVANCSS DIRECTORY LOCATED AT THE ROOT OF THE COBERTURA PROJECT.
034 *
035 * FOLLOW THE PROCEDURE FOR MERGING THE LATEST JAVANCSS INTO COBERTURA LOCATED AT
036 * javancss/coberturaREADME.txt
037 *
038 * WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING
039 */
040 /* Generated By:JavaCC: Do not edit this line. Token.java Version 4.1 */
041 /* JavaCCOptions:TOKEN_EXTENDS=,KEEP_LINE_COL=null */
042 package net.sourceforge.cobertura.javancss.parser;
043
044 /**
045 * Describes the input token stream.
046 */
047
048 public class Token {
049
050 /**
051 * An integer that describes the kind of this token. This numbering
052 * system is determined by JavaCCParser, and a table of these numbers is
053 * stored in the file ...Constants.java.
054 */
055 public int kind;
056
057 /** The line number of the first character of this Token. */
058 public int beginLine;
059 /** The column number of the first character of this Token. */
060 public int beginColumn;
061 /** The line number of the last character of this Token. */
062 public int endLine;
063 /** The column number of the last character of this Token. */
064 public int endColumn;
065
066 /**
067 * The string image of the token.
068 */
069 public String image;
070
071 /**
072 * A reference to the next regular (non-special) token from the input
073 * stream. If this is the last token from the input stream, or if the
074 * token manager has not read tokens beyond this one, this field is
075 * set to null. This is true only if this token is also a regular
076 * token. Otherwise, see below for a description of the contents of
077 * this field.
078 */
079 public Token next;
080
081 /**
082 * This field is used to access special tokens that occur prior to this
083 * token, but after the immediately preceding regular (non-special) token.
084 * If there are no such special tokens, this field is set to null.
085 * When there are more than one such special token, this field refers
086 * to the last of these special tokens, which in turn refers to the next
087 * previous special token through its specialToken field, and so on
088 * until the first special token (whose specialToken field is null).
089 * The next fields of special tokens refer to other special tokens that
090 * immediately follow it (without an intervening regular token). If there
091 * is no such token, this field is null.
092 */
093 public Token specialToken;
094
095 /**
096 * An optional attribute value of the Token.
097 * Tokens which are not used as syntactic sugar will often contain
098 * meaningful values that will be used later on by the compiler or
099 * interpreter. This attribute value is often different from the image.
100 * Any subclass of Token that actually wants to return a non-null value can
101 * override this method as appropriate.
102 */
103 public Object getValue() {
104 return null;
105 }
106
107 /**
108 * No-argument constructor
109 */
110 public Token() {}
111
112 /**
113 * Constructs a new token for the specified Image.
114 */
115 public Token(int kind)
116 {
117 this(kind, null);
118 }
119
120 /**
121 * Constructs a new token for the specified Image and Kind.
122 */
123 public Token(int kind, String image)
124 {
125 this.kind = kind;
126 this.image = image;
127 }
128
129 /**
130 * Returns the image.
131 */
132 public String toString()
133 {
134 return image;
135 }
136
137 /**
138 * Returns a new Token object, by default. However, if you want, you
139 * can create and return subclass objects based on the value of ofKind.
140 * Simply add the cases to the switch for all those special cases.
141 * For example, if you have a subclass of Token called IDToken that
142 * you want to create if ofKind is ID, simply add something like :
143 *
144 * case MyParserConstants.ID : return new IDToken(ofKind, image);
145 *
146 * to the following switch statement. Then you can cast matchedToken
147 * variable to the appropriate type and use sit in your lexical actions.
148 */
149 public static Token newToken(int ofKind, String image)
150 {
151 switch(ofKind)
152 {
153 default : return new Token(ofKind, image);
154 }
155 }
156
157 public static Token newToken(int ofKind)
158 {
159 return newToken(ofKind, null);
160 }
161
162 }
163 /* JavaCC - OriginalChecksum=48c8965b1d2c7366d2b53a19209a1660 (do not edit this line) */