View Javadoc
1   /* Generated By:JavaCC: Do not edit this line. Token.java Version 5.0 */
2   /* JavaCCOptions:TOKEN_EXTENDS=,KEEP_LINE_COL=null,SUPPORT_CLASS_VISIBILITY_PUBLIC=true */
3   /* Copyright (C) 2002 Albert Tumanov
4   
5   This library is free software; you can redistribute it and/or
6   modify it under the terms of the GNU Lesser General Public
7   License as published by the Free Software Foundation; either
8   version 2.1 of the License, or (at your option) any later version.
9   
10  This library is distributed in the hope that it will be useful,
11  but WITHOUT ANY WARRANTY; without even the implied warranty of
12  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13  Lesser General Public License for more details.
14  
15  You should have received a copy of the GNU Lesser General Public
16  License along with this library; if not, write to the Free Software
17  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18  
19  */
20  
21  package net.sourceforge.pmd.lang.plsql.ast;
22  
23  /**
24   * Describes the input token stream.
25   */
26  
27  public class Token implements java.io.Serializable {
28  
29    /**
30     * The version identifier for this Serializable class.
31     * Increment only if the <i>serialized</i> form of the
32     * class changes.
33     */
34    private static final long serialVersionUID = 1L;
35  
36    /**
37     * An integer that describes the kind of this token.  This numbering
38     * system is determined by JavaCCParser, and a table of these numbers is
39     * stored in the file ...Constants.java.
40     */
41    public int kind;
42  
43    /** The line number of the first character of this Token. */
44    public int beginLine;
45    /** The column number of the first character of this Token. */
46    public int beginColumn;
47    /** The line number of the last character of this Token. */
48    public int endLine;
49    /** The column number of the last character of this Token. */
50    public int endColumn;
51  
52    /**
53     * The string image of the token.
54     */
55    public String image;
56  
57    /**
58     * A reference to the next regular (non-special) token from the input
59     * stream.  If this is the last token from the input stream, or if the
60     * token manager has not read tokens beyond this one, this field is
61     * set to null.  This is true only if this token is also a regular
62     * token.  Otherwise, see below for a description of the contents of
63     * this field.
64     */
65    public Token next;
66  
67    /**
68     * This field is used to access special tokens that occur prior to this
69     * token, but after the immediately preceding regular (non-special) token.
70     * If there are no such special tokens, this field is set to null.
71     * When there are more than one such special token, this field refers
72     * to the last of these special tokens, which in turn refers to the next
73     * previous special token through its specialToken field, and so on
74     * until the first special token (whose specialToken field is null).
75     * The next fields of special tokens refer to other special tokens that
76     * immediately follow it (without an intervening regular token).  If there
77     * is no such token, this field is null.
78     */
79    public Token specialToken;
80  
81    /**
82     * An optional attribute value of the Token.
83     * Tokens which are not used as syntactic sugar will often contain
84     * meaningful values that will be used later on by the compiler or
85     * interpreter. This attribute value is often different from the image.
86     * Any subclass of Token that actually wants to return a non-null value can
87     * override this method as appropriate.
88     */
89    public Object getValue() {
90      return null;
91    }
92  
93    /**
94     * No-argument constructor
95     */
96    public Token() {}
97  
98    /**
99     * Constructs a new token for the specified Image.
100    */
101   public Token(int kind)
102   {
103     this(kind, null);
104   }
105 
106   /**
107    * Constructs a new token for the specified Image and Kind.
108    */
109   public Token(int kind, String image)
110   {
111     this.kind = kind;
112     this.image = image;
113   }
114 
115   /**
116    * Returns the image.
117    */
118   public String toString()
119   {
120     return image;
121   }
122 
123   /**
124    * Returns a new Token object, by default. However, if you want, you
125    * can create and return subclass objects based on the value of ofKind.
126    * Simply add the cases to the switch for all those special cases.
127    * For example, if you have a subclass of Token called IDToken that
128    * you want to create if ofKind is ID, simply add something like :
129    *
130    *    case MyParserConstants.ID : return new IDToken(ofKind, image);
131    *
132    * to the following switch statement. Then you can cast matchedToken
133    * variable to the appropriate type and use sit in your lexical actions.
134    */
135   public static Token newToken(int ofKind, String image)
136   {
137     switch(ofKind)
138     {
139       default : return new Token(ofKind, image);
140     }
141   }
142 
143   public static Token newToken(int ofKind)
144   {
145     return newToken(ofKind, null);
146   }
147 
148 }
149 /* JavaCC - OriginalChecksum=24ca477238e72ac9c11ff63c8ce9c549 (do not edit this line) */