001    /* Generated By:JavaCC: Do not edit this line. Token.java Version 4.1 */
002    /* JavaCCOptions:TOKEN_EXTENDS=,KEEP_LINE_COL=null */
003    package org.jfree.formula.parser;
004    
005    /**
006     * Describes the input token stream.
007     */
008    
009    public class Token {
010    
011      /**
012       * An integer that describes the kind of this token.  This numbering
013       * system is determined by JavaCCParser, and a table of these numbers is
014       * stored in the file ...Constants.java.
015       */
016      public int kind;
017    
018      /** The line number of the first character of this Token. */
019      public int beginLine;
020      /** The column number of the first character of this Token. */
021      public int beginColumn;
022      /** The line number of the last character of this Token. */
023      public int endLine;
024      /** The column number of the last character of this Token. */
025      public int endColumn;
026    
027      /**
028       * The string image of the token.
029       */
030      public String image;
031    
032      /**
033       * A reference to the next regular (non-special) token from the input
034       * stream.  If this is the last token from the input stream, or if the
035       * token manager has not read tokens beyond this one, this field is
036       * set to null.  This is true only if this token is also a regular
037       * token.  Otherwise, see below for a description of the contents of
038       * this field.
039       */
040      public Token next;
041    
042      /**
043       * This field is used to access special tokens that occur prior to this
044       * token, but after the immediately preceding regular (non-special) token.
045       * If there are no such special tokens, this field is set to null.
046       * When there are more than one such special token, this field refers
047       * to the last of these special tokens, which in turn refers to the next
048       * previous special token through its specialToken field, and so on
049       * until the first special token (whose specialToken field is null).
050       * The next fields of special tokens refer to other special tokens that
051       * immediately follow it (without an intervening regular token).  If there
052       * is no such token, this field is null.
053       */
054      public Token specialToken;
055    
056      /**
057       * An optional attribute value of the Token.
058       * Tokens which are not used as syntactic sugar will often contain
059       * meaningful values that will be used later on by the compiler or
060       * interpreter. This attribute value is often different from the image.
061       * Any subclass of Token that actually wants to return a non-null value can
062       * override this method as appropriate.
063       */
064      public Object getValue() {
065        return null;
066      }
067    
068      /**
069       * No-argument constructor
070       */
071      public Token() {}
072    
073      /**
074       * Constructs a new token for the specified Image.
075       */
076      public Token(int kind)
077      {
078         this(kind, null);
079      }
080    
081      /**
082       * Constructs a new token for the specified Image and Kind.
083       */
084      public Token(int kind, String image)
085      {
086         this.kind = kind;
087         this.image = image;
088      }
089    
090      /**
091       * Returns the image.
092       */
093      public String toString()
094      {
095         return image;
096      }
097    
098      /**
099       * Returns a new Token object, by default. However, if you want, you
100       * can create and return subclass objects based on the value of ofKind.
101       * Simply add the cases to the switch for all those special cases.
102       * For example, if you have a subclass of Token called IDToken that
103       * you want to create if ofKind is ID, simply add something like :
104       *
105       *    case MyParserConstants.ID : return new IDToken(ofKind, image);
106       *
107       * to the following switch statement. Then you can cast matchedToken
108       * variable to the appropriate type and use sit in your lexical actions.
109       */
110      public static Token newToken(int ofKind, String image)
111      {
112         switch(ofKind)
113         {
114           default : return new Token(ofKind, image);
115         }
116      }
117    
118      public static Token newToken(int ofKind)
119      {
120         return newToken(ofKind, null);
121      }
122    
123    }
124    /* JavaCC - OriginalChecksum=fad79c62e640d221ba36a5eaf0835bf0 (do not edit this line) */