001/* Generated By:JavaCC: Do not edit this line. Token.java Version 5.0 */
002/* JavaCCOptions:TOKEN_EXTENDS=,KEEP_LINE_COL=null,SUPPORT_CLASS_VISIBILITY_PUBLIC=true */
003/*
004 *  jDTAUS Core RI Client Container
005 *  Copyright (C) 2005 Christian Schulte
006 *  <cs@schulte.it>
007 *
008 *  This library is free software; you can redistribute it and/or
009 *  modify it under the terms of the GNU Lesser General Public
010 *  License as published by the Free Software Foundation; either
011 *  version 2.1 of the License, or any later version.
012 *
013 *  This library is distributed in the hope that it will be useful,
014 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
015 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
016 *  Lesser General Public License for more details.
017 *
018 *  You should have received a copy of the GNU Lesser General Public
019 *  License along with this library; if not, write to the Free Software
020 *  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
021 *
022 *  $JDTAUS: VersionParser.jj 8641 2012-09-27 06:45:17Z schulte $
023 *
024 */
025package org.jdtaus.core.container.ri.client.versioning;
026
027/**
028 * Describes the input token stream.
029 */
030
031public class Token implements java.io.Serializable {
032
033  /**
034   * The version identifier for this Serializable class.
035   * Increment only if the <i>serialized</i> form of the
036   * class changes.
037   */
038  private static final long serialVersionUID = 1L;
039
040  /**
041   * An integer that describes the kind of this token.  This numbering
042   * system is determined by JavaCCParser, and a table of these numbers is
043   * stored in the file ...Constants.java.
044   */
045  public int kind;
046
047  /** The line number of the first character of this Token. */
048  public int beginLine;
049  /** The column number of the first character of this Token. */
050  public int beginColumn;
051  /** The line number of the last character of this Token. */
052  public int endLine;
053  /** The column number of the last character of this Token. */
054  public int endColumn;
055
056  /**
057   * The string image of the token.
058   */
059  public String image;
060
061  /**
062   * A reference to the next regular (non-special) token from the input
063   * stream.  If this is the last token from the input stream, or if the
064   * token manager has not read tokens beyond this one, this field is
065   * set to null.  This is true only if this token is also a regular
066   * token.  Otherwise, see below for a description of the contents of
067   * this field.
068   */
069  public Token next;
070
071  /**
072   * This field is used to access special tokens that occur prior to this
073   * token, but after the immediately preceding regular (non-special) token.
074   * If there are no such special tokens, this field is set to null.
075   * When there are more than one such special token, this field refers
076   * to the last of these special tokens, which in turn refers to the next
077   * previous special token through its specialToken field, and so on
078   * until the first special token (whose specialToken field is null).
079   * The next fields of special tokens refer to other special tokens that
080   * immediately follow it (without an intervening regular token).  If there
081   * is no such token, this field is null.
082   */
083  public Token specialToken;
084
085  /**
086   * An optional attribute value of the Token.
087   * Tokens which are not used as syntactic sugar will often contain
088   * meaningful values that will be used later on by the compiler or
089   * interpreter. This attribute value is often different from the image.
090   * Any subclass of Token that actually wants to return a non-null value can
091   * override this method as appropriate.
092   */
093  public Object getValue() {
094    return null;
095  }
096
097  /**
098   * No-argument constructor
099   */
100  public Token() {}
101
102  /**
103   * Constructs a new token for the specified Image.
104   */
105  public Token(int kind)
106  {
107    this(kind, null);
108  }
109
110  /**
111   * Constructs a new token for the specified Image and Kind.
112   */
113  public Token(int kind, String image)
114  {
115    this.kind = kind;
116    this.image = image;
117  }
118
119  /**
120   * Returns the image.
121   */
122  public String toString()
123  {
124    return image;
125  }
126
127  /**
128   * Returns a new Token object, by default. However, if you want, you
129   * can create and return subclass objects based on the value of ofKind.
130   * Simply add the cases to the switch for all those special cases.
131   * For example, if you have a subclass of Token called IDToken that
132   * you want to create if ofKind is ID, simply add something like :
133   *
134   *    case MyParserConstants.ID : return new IDToken(ofKind, image);
135   *
136   * to the following switch statement. Then you can cast matchedToken
137   * variable to the appropriate type and use sit in your lexical actions.
138   */
139  public static Token newToken(int ofKind, String image)
140  {
141    switch(ofKind)
142    {
143      default : return new Token(ofKind, image);
144    }
145  }
146
147  public static Token newToken(int ofKind)
148  {
149    return newToken(ofKind, null);
150  }
151
152}
153/* JavaCC - OriginalChecksum=cd65f0cb804df8f7ace1ac371dcf906a (do not edit this line) */