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/* Parser for matrices written in matlab format.
004
005 Copyright (c) 1998-2008 The Regents of the University of California.
006 All rights reserved.
007 Permission is hereby granted, without written agreement and without
008 license or royalty fees, to use, copy, modify, and distribute this
009 software and its documentation for any purpose, provided that the above
010 copyright notice and the following two paragraphs appear in all copies
011 of this software.
012
013 IN NO EVENT SHALL THE UNIVERSITY OF CALIFORNIA BE LIABLE TO ANY PARTY
014 FOR DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES
015 ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF
016 THE UNIVERSITY OF CALIFORNIA HAS BEEN ADVISED OF THE POSSIBILITY OF
017 SUCH DAMAGE.
018
019 THE UNIVERSITY OF CALIFORNIA SPECIFICALLY DISCLAIMS ANY WARRANTIES,
020 INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
021 MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE
022 PROVIDED HEREUNDER IS ON AN "AS IS" BASIS, AND THE UNIVERSITY OF
023 CALIFORNIA HAS NO OBLIGATION TO PROVIDE MAINTENANCE, SUPPORT, UPDATES,
024 ENHANCEMENTS, OR MODIFICATIONS.
025
026                                        PT_COPYRIGHT_VERSION_2
027                                        COPYRIGHTENDKEY
028 */
029package ptolemy.data.expr;
030
031/**
032 * Describes the input token stream.
033 */
034
035public class Token implements java.io.Serializable {
036
037    /**
038     * The version identifier for this Serializable class.
039     * Increment only if the <i>serialized</i> form of the
040     * class changes.
041     */
042    private static final long serialVersionUID = 1L;
043
044    /**
045     * An integer that describes the kind of this token.  This numbering
046     * system is determined by JavaCCParser, and a table of these numbers is
047     * stored in the file ...Constants.java.
048     */
049    public int kind;
050
051    /** The line number of the first character of this Token. */
052    public int beginLine;
053    /** The column number of the first character of this Token. */
054    public int beginColumn;
055    /** The line number of the last character of this Token. */
056    public int endLine;
057    /** The column number of the last character of this Token. */
058    public int endColumn;
059
060    /**
061     * The string image of the token.
062     */
063    public String image;
064
065    /**
066     * A reference to the next regular (non-special) token from the input
067     * stream.  If this is the last token from the input stream, or if the
068     * token manager has not read tokens beyond this one, this field is
069     * set to null.  This is true only if this token is also a regular
070     * token.  Otherwise, see below for a description of the contents of
071     * this field.
072     */
073    public Token next;
074
075    /**
076     * This field is used to access special tokens that occur prior to this
077     * token, but after the immediately preceding regular (non-special) token.
078     * If there are no such special tokens, this field is set to null.
079     * When there are more than one such special token, this field refers
080     * to the last of these special tokens, which in turn refers to the next
081     * previous special token through its specialToken field, and so on
082     * until the first special token (whose specialToken field is null).
083     * The next fields of special tokens refer to other special tokens that
084     * immediately follow it (without an intervening regular token).  If there
085     * is no such token, this field is null.
086     */
087    public Token specialToken;
088
089    /**
090     * An optional attribute value of the Token.
091     * Tokens which are not used as syntactic sugar will often contain
092     * meaningful values that will be used later on by the compiler or
093     * interpreter. This attribute value is often different from the image.
094     * Any subclass of Token that actually wants to return a non-null value can
095     * override this method as appropriate.
096     */
097    public Object getValue() {
098        return null;
099    }
100
101    /**
102     * No-argument constructor
103     */
104    public Token() {
105    }
106
107    /**
108     * Constructs a new token for the specified Image.
109     */
110    public Token(int kind) {
111        this(kind, null);
112    }
113
114    /**
115     * Constructs a new token for the specified Image and Kind.
116     */
117    public Token(int kind, String image) {
118        this.kind = kind;
119        this.image = image;
120    }
121
122    /**
123     * Returns the image.
124     */
125    @Override
126    public String toString() {
127        return image;
128    }
129
130    /**
131     * Returns a new Token object, by default. However, if you want, you
132     * can create and return subclass objects based on the value of ofKind.
133     * Simply add the cases to the switch for all those special cases.
134     * For example, if you have a subclass of Token called IDToken that
135     * you want to create if ofKind is ID, simply add something like :
136     *
137     *    case MyParserConstants.ID : return new IDToken(ofKind, image);
138     *
139     * to the following switch statement. Then you can cast matchedToken
140     * variable to the appropriate type and use sit in your lexical actions.
141     */
142    public static Token newToken(int ofKind, String image) {
143        switch (ofKind) {
144        default:
145            return new Token(ofKind, image);
146        }
147    }
148
149    public static Token newToken(int ofKind) {
150        return newToken(ofKind, null);
151    }
152
153}
154/* JavaCC - OriginalChecksum=3478151e8ab2100d919adca7c00d859d (do not edit this line) */