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    //cobertura - put the import on its own line - otherwise, it messes up the script that changes the package.
043    package net.sourceforge.cobertura.javancss.parser.debug;
044    
045    /**
046     * Describes the input token stream.
047     */
048    
049    public class Token {
050    
051      /**
052       * An integer that describes the kind of this token.  This numbering
053       * system is determined by JavaCCParser, and a table of these numbers is
054       * stored in the file ...Constants.java.
055       */
056      public int kind;
057    
058      /** The line number of the first character of this Token. */
059      public int beginLine;
060      /** The column number of the first character of this Token. */
061      public int beginColumn;
062      /** The line number of the last character of this Token. */
063      public int endLine;
064      /** The column number of the last character of this Token. */
065      public int endColumn;
066    
067      /**
068       * The string image of the token.
069       */
070      public String image;
071    
072      /**
073       * A reference to the next regular (non-special) token from the input
074       * stream.  If this is the last token from the input stream, or if the
075       * token manager has not read tokens beyond this one, this field is
076       * set to null.  This is true only if this token is also a regular
077       * token.  Otherwise, see below for a description of the contents of
078       * this field.
079       */
080      public Token next;
081    
082      /**
083       * This field is used to access special tokens that occur prior to this
084       * token, but after the immediately preceding regular (non-special) token.
085       * If there are no such special tokens, this field is set to null.
086       * When there are more than one such special token, this field refers
087       * to the last of these special tokens, which in turn refers to the next
088       * previous special token through its specialToken field, and so on
089       * until the first special token (whose specialToken field is null).
090       * The next fields of special tokens refer to other special tokens that
091       * immediately follow it (without an intervening regular token).  If there
092       * is no such token, this field is null.
093       */
094      public Token specialToken;
095    
096      /**
097       * An optional attribute value of the Token.
098       * Tokens which are not used as syntactic sugar will often contain
099       * meaningful values that will be used later on by the compiler or
100       * interpreter. This attribute value is often different from the image.
101       * Any subclass of Token that actually wants to return a non-null value can
102       * override this method as appropriate.
103       */
104      public Object getValue() {
105        return null;
106      }
107    
108      /**
109       * No-argument constructor
110       */
111      public Token() {}
112    
113      /**
114       * Constructs a new token for the specified Image.
115       */
116      public Token(int kind)
117      {
118         this(kind, null);
119      }
120    
121      /**
122       * Constructs a new token for the specified Image and Kind.
123       */
124      public Token(int kind, String image)
125      {
126         this.kind = kind;
127         this.image = image;
128      }
129    
130      /**
131       * Returns the image.
132       */
133      public String toString()
134      {
135         return image;
136      }
137    
138      /**
139       * Returns a new Token object, by default. However, if you want, you
140       * can create and return subclass objects based on the value of ofKind.
141       * Simply add the cases to the switch for all those special cases.
142       * For example, if you have a subclass of Token called IDToken that
143       * you want to create if ofKind is ID, simply add something like :
144       *
145       *    case MyParserConstants.ID : return new IDToken(ofKind, image);
146       *
147       * to the following switch statement. Then you can cast matchedToken
148       * variable to the appropriate type and use sit in your lexical actions.
149       */
150      public static Token newToken(int ofKind, String image)
151      {
152         switch(ofKind)
153         {
154           default : return new Token(ofKind, image);
155         }
156      }
157    
158      public static Token newToken(int ofKind)
159      {
160         return newToken(ofKind, null);
161      }
162    
163    }
164    /* JavaCC - OriginalChecksum=15522ecc409e4693bb99cff1a147148b (do not edit this line) */