1 /* Generated By:JavaCC: Do not edit this line. Token.java Version 3.0 */
2 /**
3  * Licensed to the Apache Software Foundation (ASF) under one
4  * or more contributor license agreements.  See the NOTICE file
5  * distributed with this work for additional information
6  * regarding copyright ownership.  The ASF licenses this file
7  * to you under the Apache License, Version 2.0 (the
8  * "License"); you may not use this file except in compliance
9  * with the License.  You may obtain a copy of the License at
10  *
11  *     http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing, software
14  * distributed under the License is distributed on an "AS IS" BASIS,
15  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16  * See the License for the specific language governing permissions and
17  * limitations under the License.
18  */
19 
20 package org.apache.hadoop.record.compiler.generated;
21 
22 /**
23  * Describes the input token stream.
24  */
25 
26 public class Token {
27 
28   /**
29    * An integer that describes the kind of this token.  This numbering
30    * system is determined by JavaCCParser, and a table of these numbers is
31    * stored in the file ...Constants.java.
32    */
33   public int kind;
34 
35   /**
36    * beginLine and beginColumn describe the position of the first character
37    * of this token; endLine and endColumn describe the position of the
38    * last character of this token.
39    */
40   public int beginLine, beginColumn, endLine, endColumn;
41 
42   /**
43    * The string image of the token.
44    */
45   public String image;
46 
47   /**
48    * A reference to the next regular (non-special) token from the input
49    * stream.  If this is the last token from the input stream, or if the
50    * token manager has not read tokens beyond this one, this field is
51    * set to null.  This is true only if this token is also a regular
52    * token.  Otherwise, see below for a description of the contents of
53    * this field.
54    */
55   public Token next;
56 
57   /**
58    * This field is used to access special tokens that occur prior to this
59    * token, but after the immediately preceding regular (non-special) token.
60    * If there are no such special tokens, this field is set to null.
61    * When there are more than one such special token, this field refers
62    * to the last of these special tokens, which in turn refers to the next
63    * previous special token through its specialToken field, and so on
64    * until the first special token (whose specialToken field is null).
65    * The next fields of special tokens refer to other special tokens that
66    * immediately follow it (without an intervening regular token).  If there
67    * is no such token, this field is null.
68    */
69   public Token specialToken;
70 
71   /**
72    * Returns the image.
73    */
toString()74   public String toString()
75   {
76     return image;
77   }
78 
79   /**
80    * Returns a new Token object, by default. However, if you want, you
81    * can create and return subclass objects based on the value of ofKind.
82    * Simply add the cases to the switch for all those special cases.
83    * For example, if you have a subclass of Token called IDToken that
84    * you want to create if ofKind is ID, simlpy add something like :
85    *
86    *    case MyParserConstants.ID : return new IDToken();
87    *
88    * to the following switch statement. Then you can cast matchedToken
89    * variable to the appropriate type and use it in your lexical actions.
90    */
newToken(int ofKind)91   public static final Token newToken(int ofKind)
92   {
93     switch(ofKind)
94       {
95       default : return new Token();
96       }
97   }
98 
99 }
100