KickJava   Java API By Example, From Geeks To Geeks.

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


1 /* Generated By:JavaCC: Do not edit this line. Token.java Version 3.0 */
2
3 /*****************************************************************
4  * Licensed to the Apache Software Foundation (ASF) under one
5  * or more contributor license agreements. See the NOTICE file
6  * distributed with this work for additional information
7  * regarding copyright ownership. The ASF licenses this file
8  * to you under the Apache License, Version 2.0 (the
9  * "License"); you may not use this file except in compliance
10  * with the License. You may obtain a copy of the License at
11  *
12  * http://www.apache.org/licenses/LICENSE-2.0
13  *
14  * Unless required by applicable law or agreed to in writing,
15  * software distributed under the License is distributed on an
16  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
17  * KIND, either express or implied. See the License for the
18  * specific language governing permissions and limitations
19  * under the License.
20  ****************************************************************/

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

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

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

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

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

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

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

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

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