Home | History | Annotate | Download | only in Mini
      1 /*
      2  * Licensed to the Apache Software Foundation (ASF) under one or more
      3  * contributor license agreements.  See the NOTICE file distributed with
      4  * this work for additional information regarding copyright ownership.
      5  * The ASF licenses this file to You under the Apache License, Version 2.0
      6  * (the "License"); you may not use this file except in compliance with
      7  * the License.  You may obtain a copy of the License at
      8  *
      9  *      http://www.apache.org/licenses/LICENSE-2.0
     10  *
     11  *  Unless required by applicable law or agreed to in writing, software
     12  *  distributed under the License is distributed on an "AS IS" BASIS,
     13  *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
     14  *  See the License for the specific language governing permissions and
     15  *  limitations under the License.
     16  *
     17  */
     18 /* Generated By:JavaCC: Do not edit this line. Token.java Version 0.7pre3 */
     19 package Mini;
     20 
     21 /**
     22  * Describes the input token stream.
     23  */
     24 
     25 public class Token {
     26 
     27   /**
     28    * An integer that describes the kind of this token.  This numbering
     29    * system is determined by JavaCCParser, and a table of these numbers is
     30    * stored in the file ...Constants.java.
     31    */
     32   public int kind;
     33 
     34   /**
     35    * beginLine and beginColumn describe the position of the first character
     36    * of this token; endLine and endColumn describe the position of the
     37    * last character of this token.
     38    */
     39   public int beginLine, beginColumn, endLine, endColumn;
     40 
     41   /**
     42    * The string image of the token.
     43    */
     44   public String image;
     45 
     46   /**
     47    * A reference to the next regular (non-special) token from the input
     48    * stream.  If this is the last token from the input stream, or if the
     49    * token manager has not read tokens beyond this one, this field is
     50    * set to null.  This is true only if this token is also a regular
     51    * token.  Otherwise, see below for a description of the contents of
     52    * this field.
     53    */
     54   public Token next;
     55 
     56   /**
     57    * This field is used to access special tokens that occur prior to this
     58    * token, but after the immediately preceding regular (non-special) token.
     59    * If there are no such special tokens, this field is set to null.
     60    * When there are more than one such special token, this field refers
     61    * to the last of these special tokens, which in turn refers to the next
     62    * previous special token through its specialToken field, and so on
     63    * until the first special token (whose specialToken field is null).
     64    * The next fields of special tokens refer to other special tokens that
     65    * immediately follow it (without an intervening regular token).  If there
     66    * is no such token, this field is null.
     67    */
     68   public Token specialToken;
     69 
     70   /**
     71    * Returns the image.
     72    */
     73   @Override
     74   public final String toString()
     75   {
     76      return image;
     77   }
     78 
     79   /**
     80    * Returns a new Token object, by default. However, if you want, you
     81    * can create and return subclass objects based on the value of ofKind.
     82    * Simply add the cases to the switch for all those special cases.
     83    * For example, if you have a subclass of Token called IDToken that
     84    * you want to create if ofKind is ID, simlpy add something like :
     85    *
     86    *    case MyParserConstants.ID : return new IDToken();
     87    *
     88    * to the following switch statement. Then you can cast matchedToken
     89    * variable to the appropriate type and use it in your lexical actions.
     90    */
     91   public static Token newToken(int ofKind)
     92   {
     93      switch(ofKind)
     94      {
     95        default : return new Token();
     96      }
     97   }
     98 
     99 }
    100