KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > cayenne > exp > parser > Token


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,
14  * software distributed under the License is distributed on an
15  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16  * KIND, either express or implied. See the License for the
17  * specific language governing permissions and limitations
18  * under the License.
19  ****************************************************************/

20
21
22 package org.apache.cayenne.exp.parser;
23
24 /**
25  * Describes the input token stream.
26  */

27
28 class Token {
29
30   /**
31    * An integer that describes the kind of this token. This numbering
32    * system is determined by JavaCCParser, and a table of these numbers is
33    * stored in the file ...Constants.java.
34    */

35   public int kind;
36
37   /**
38    * beginLine and beginColumn describe the position of the first character
39    * of this token; endLine and endColumn describe the position of the
40    * last character of this token.
41    */

42   public int beginLine, beginColumn, endLine, endColumn;
43
44   /**
45    * The string image of the token.
46    */

47   public String JavaDoc image;
48
49   /**
50    * A reference to the next regular (non-special) token from the input
51    * stream. If this is the last token from the input stream, or if the
52    * token manager has not read tokens beyond this one, this field is
53    * set to null. This is true only if this token is also a regular
54    * token. Otherwise, see below for a description of the contents of
55    * this field.
56    */

57   public Token next;
58
59   /**
60    * This field is used to access special tokens that occur prior to this
61    * token, but after the immediately preceding regular (non-special) token.
62    * If there are no such special tokens, this field is set to null.
63    * When there are more than one such special token, this field refers
64    * to the last of these special tokens, which in turn refers to the next
65    * previous special token through its specialToken field, and so on
66    * until the first special token (whose specialToken field is null).
67    * The next fields of special tokens refer to other special tokens that
68    * immediately follow it (without an intervening regular token). If there
69    * is no such token, this field is null.
70    */

71   public Token specialToken;
72
73   /**
74    * Returns the image.
75    */

76   public String JavaDoc toString()
77   {
78      return image;
79   }
80
81   /**
82    * Returns a new Token object, by default. However, if you want, you
83    * can create and return subclass objects based on the value of ofKind.
84    * Simply add the cases to the switch for all those special cases.
85    * For example, if you have a subclass of Token called IDToken that
86    * you want to create if ofKind is ID, simlpy add something like :
87    *
88    * case MyParserConstants.ID : return new IDToken();
89    *
90    * to the following switch statement. Then you can cast matchedToken
91    * variable to the appropriate type and use it in your lexical actions.
92    */

93   public static final Token newToken(int ofKind)
94   {
95      switch(ofKind)
96      {
97        default : return new Token();
98      }
99   }
100
101 }
102
Popular Tags