001    /* Generated By:JavaCC: Do not edit this line. Token.java Version 0.7pre3 */
002    
003    /*
004     * Cobertura - http://cobertura.sourceforge.net/
005     *
006     * This file was taken from JavaNCSS
007     * http://www.kclee.com/clemens/java/javancss/
008     * Copyright (C) 2000 Chr. Clemens Lee <clemens a.t kclee d.o.t com>
009     *
010     * Cobertura is free software; you can redistribute it and/or modify
011     * it under the terms of the GNU General Public License as published
012     * by the Free Software Foundation; either version 2 of the License,
013     * or (at your option) any later version.
014     *
015     * Cobertura is distributed in the hope that it will be useful, but
016     * WITHOUT ANY WARRANTY; without even the implied warranty of
017     * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
018     * General Public License for more details.
019     *
020     * You should have received a copy of the GNU General Public License
021     * along with Cobertura; if not, write to the Free Software
022     * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
023     * USA
024     */
025    package net.sourceforge.cobertura.javancss;
026    
027    /**
028     * Describes the input token stream.
029     */
030    
031    public class Token {
032    
033      /**
034       * An integer that describes the kind of this token.  This numbering
035       * system is determined by JavaCCParser, and a table of these numbers is
036       * stored in the file ...Constants.java.
037       */
038      public int kind;
039    
040      /**
041       * beginLine and beginColumn describe the position of the first character
042       * of this token; endLine and endColumn describe the position of the
043       * last character of this token.
044       */
045      public int beginLine, beginColumn, endLine, endColumn;
046    
047      /**
048       * The string image of the token.
049       */
050      public String image;
051    
052      /**
053       * A reference to the next regular (non-special) token from the input
054       * stream.  If this is the last token from the input stream, or if the
055       * token manager has not read tokens beyond this one, this field is
056       * set to null.  This is true only if this token is also a regular
057       * token.  Otherwise, see below for a description of the contents of
058       * this field.
059       */
060      public Token next;
061    
062      /**
063       * This field is used to access special tokens that occur prior to this
064       * token, but after the immediately preceding regular (non-special) token.
065       * If there are no such special tokens, this field is set to null.
066       * When there are more than one such special token, this field refers
067       * to the last of these special tokens, which in turn refers to the next
068       * previous special token through its specialToken field, and so on
069       * until the first special token (whose specialToken field is null).
070       * The next fields of special tokens refer to other special tokens that
071       * immediately follow it (without an intervening regular token).  If there
072       * is no such token, this field is null.
073       */
074      public Token specialToken;
075    
076      /**
077       * Returns the image.
078       */
079      public final String toString()
080      {
081         return image;
082      }
083    
084      /**
085       * Returns a new Token object, by default. However, if you want, you
086       * can create and return subclass objects based on the value of ofKind.
087       * Simply add the cases to the switch for all those special cases.
088       * For example, if you have a subclass of Token called IDToken that
089       * you want to create if ofKind is ID, simlpy add something like :
090       *
091       *    case MyParserConstants.ID : return new IDToken();
092       *
093       * to the following switch statement. Then you can cast matchedToken
094       * variable to the appropriate type and use it in your lexical actions.
095       */
096      public static final Token newToken(int ofKind)
097      {
098         switch(ofKind)
099         {
100           default : return new Token();
101         }
102      }
103    
104    }