001    /* Generated By:JavaCC: Do not edit this line. Token.java Version 3.0 */
002    package org.hackystat.telemetry.analyzer.language.parser.impl;
003    
004    /**
005     * Describes the input token stream.
006     */
007    
008    public class Token {
009    
010      /**
011       * An integer that describes the kind of this token.  This numbering
012       * system is determined by JavaCCParser, and a table of these numbers is
013       * stored in the file ...Constants.java.
014       */
015      public int kind;
016    
017      /**
018       * beginLine and beginColumn describe the position of the first character
019       * of this token; endLine and endColumn describe the position of the
020       * last character of this token.
021       */
022      public int beginLine, beginColumn, endLine, endColumn;
023    
024      /**
025       * The string image of the token.
026       */
027      public String image;
028    
029      /**
030       * A reference to the next regular (non-special) token from the input
031       * stream.  If this is the last token from the input stream, or if the
032       * token manager has not read tokens beyond this one, this field is
033       * set to null.  This is true only if this token is also a regular
034       * token.  Otherwise, see below for a description of the contents of
035       * this field.
036       */
037      public Token next;
038    
039      /**
040       * This field is used to access special tokens that occur prior to this
041       * token, but after the immediately preceding regular (non-special) token.
042       * If there are no such special tokens, this field is set to null.
043       * When there are more than one such special token, this field refers
044       * to the last of these special tokens, which in turn refers to the next
045       * previous special token through its specialToken field, and so on
046       * until the first special token (whose specialToken field is null).
047       * The next fields of special tokens refer to other special tokens that
048       * immediately follow it (without an intervening regular token).  If there
049       * is no such token, this field is null.
050       */
051      public Token specialToken;
052    
053      /**
054       * Returns the image.
055       */
056      @Override
057      public String toString()
058      {
059         return image;
060      }
061    
062      /**
063       * Returns a new Token object, by default. However, if you want, you
064       * can create and return subclass objects based on the value of ofKind.
065       * Simply add the cases to the switch for all those special cases.
066       * For example, if you have a subclass of Token called IDToken that
067       * you want to create if ofKind is ID, simlpy add something like :
068       *
069       *    case MyParserConstants.ID : return new IDToken();
070       *
071       * to the following switch statement. Then you can cast matchedToken
072       * variable to the appropriate type and use it in your lexical actions.
073       */
074      public static final Token newToken(int ofKind)
075      {
076         switch(ofKind)
077         {
078           default : return new Token();
079         }
080      }
081    
082    }