001/* Generated By:JavaCC: Do not edit this line. Token.java Version 3.0 */
002/**
003 * Licensed to the Apache Software Foundation (ASF) under one
004 * or more contributor license agreements.  See the NOTICE file
005 * distributed with this work for additional information
006 * regarding copyright ownership.  The ASF licenses this file
007 * to you under the Apache License, Version 2.0 (the
008 * "License"); you may not use this file except in compliance
009 * with the License.  You may obtain a copy of the License at
010 *
011 *     http://www.apache.org/licenses/LICENSE-2.0
012 *
013 * Unless required by applicable law or agreed to in writing, software
014 * distributed under the License is distributed on an "AS IS" BASIS,
015 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
016 * See the License for the specific language governing permissions and
017 * limitations under the License.
018 */
019
020package org.apache.hadoop.record.compiler.generated;
021
022import org.apache.hadoop.classification.InterfaceAudience;
023import org.apache.hadoop.classification.InterfaceStability;
024
025/**
026 * Describes the input token stream.
027 * 
028 * @deprecated Replaced by <a href="https://hadoop.apache.org/avro/">Avro</a>.
029 */
030@Deprecated
031@InterfaceAudience.Public
032@InterfaceStability.Stable
033public class Token {
034
035  /**
036   * An integer that describes the kind of this token.  This numbering
037   * system is determined by JavaCCParser, and a table of these numbers is
038   * stored in the file ...Constants.java.
039   */
040  public int kind;
041
042  /**
043   * beginLine and beginColumn describe the position of the first character
044   * of this token; endLine and endColumn describe the position of the
045   * last character of this token.
046   */
047  public int beginLine, beginColumn, endLine, endColumn;
048
049  /**
050   * The string image of the token.
051   */
052  public String image;
053
054  /**
055   * A reference to the next regular (non-special) token from the input
056   * stream.  If this is the last token from the input stream, or if the
057   * token manager has not read tokens beyond this one, this field is
058   * set to null.  This is true only if this token is also a regular
059   * token.  Otherwise, see below for a description of the contents of
060   * this field.
061   */
062  public Token next;
063
064  /**
065   * This field is used to access special tokens that occur prior to this
066   * token, but after the immediately preceding regular (non-special) token.
067   * If there are no such special tokens, this field is set to null.
068   * When there are more than one such special token, this field refers
069   * to the last of these special tokens, which in turn refers to the next
070   * previous special token through its specialToken field, and so on
071   * until the first special token (whose specialToken field is null).
072   * The next fields of special tokens refer to other special tokens that
073   * immediately follow it (without an intervening regular token).  If there
074   * is no such token, this field is null.
075   */
076  public Token specialToken;
077
078  /**
079   * Returns the image.
080   */
081  @Override
082  public String toString()
083  {
084    return image;
085  }
086
087  /**
088   * Returns a new Token object, by default. However, if you want, you
089   * can create and return subclass objects based on the value of ofKind.
090   * Simply add the cases to the switch for all those special cases.
091   * For example, if you have a subclass of Token called IDToken that
092   * you want to create if ofKind is ID, simlpy add something like :
093   *
094   *    case MyParserConstants.ID : return new IDToken();
095   *
096   * to the following switch statement. Then you can cast matchedToken
097   * variable to the appropriate type and use it in your lexical actions.
098   */
099  public static final Token newToken(int ofKind)
100  {
101    switch(ofKind)
102      {
103      default : return new Token();
104      }
105  }
106
107}