View Javadoc

    1   /* Generated By:JavaCC: Do not edit this line. Token.java Version 3.0 */
    2   /***************************************************************************************
    3    * Copyright (c) Jonas BonŽr, Alexandre Vasseur. All rights reserved.                 *
    4    * http://aspectwerkz.codehaus.org                                                    *
    5    * ---------------------------------------------------------------------------------- *
    6    * The software in this package is published under the terms of the LGPL license      *
    7    * a copy of which has been included with this distribution in the license.txt file.  *
    8    **************************************************************************************/
    9   package org.codehaus.aspectwerkz.expression.ast;
    10
    11  /***
    12   * Describes the input token stream.
    13   */
    14
    15  public class Token {
    16
    17      /***
    18       * An integer that describes the kind of this token. This numbering system is determined by JavaCCParser, and a
    19       * table of these numbers is stored in the file ...Constants.java.
    20       */
    21      public int kind;
    22
    23      /***
    24       * beginLine and beginColumn describe the position of the first character of this token; endLine and endColumn
    25       * describe the position of the last character of this token.
    26       */
    27      public int beginLine, beginColumn, endLine, endColumn;
    28
    29      /***
    30       * The string image of the token.
    31       */
    32      public String image;
    33
    34      /***
    35       * A reference to the next regular (non-special) token from the input stream. If this is the last token from the
    36       * input stream, or if the token manager has not read tokens beyond this one, this field is set to null. This is
    37       * true only if this token is also a regular token. Otherwise, see below for a description of the contents of this
    38       * field.
    39       */
    40      public Token next;
    41
    42      /***
    43       * This field is used to access special tokens that occur prior to this token, but after the immediately preceding
    44       * regular (non-special) token. If there are no such special tokens, this field is set to null. When there are more
    45       * than one such special token, this field refers to the last of these special tokens, which in turn refers to the
    46       * next previous special token through its specialToken field, and so on until the first special token (whose
    47       * specialToken field is null). The next fields of special tokens refer to other special tokens that immediately
    48       * follow it (without an intervening regular token). If there is no such token, this field is null.
    49       */
    50      public Token specialToken;
    51
    52      /***
    53       * Returns the image.
    54       */
    55      public String toString() {
    56          return image;
    57      }
    58
    59      /***
    60       * Returns a new Token object, by default. However, if you want, you can create and return subclass objects based on
    61       * the value of ofKind. Simply add the cases to the switch for all those special cases. For example, if you have a
    62       * subclass of Token called IDToken that you want to create if ofKind is ID, simlpy add something like : case
    63       * MyParserConstants.ID : return new IDToken(); to the following switch statement. Then you can cast matchedToken
    64       * variable to the appropriate type and use it in your lexical actions.
    65       */
    66      public static final Token newToken(int ofKind) {
    67          switch (ofKind) {
    68              default:
    69                  return new Token();
    70          }
    71      }
    72
    73  }