KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > taglibs > standard > lang > jpath > expression > Token


1 /*
2  * Copyright 1999,2004 The Apache Software Foundation.
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */

16
17 /* Generated By:JavaCC: Do not edit this line. Token.java Version 0.7pre3 */
18 package org.apache.taglibs.standard.lang.jpath.expression;
19
20 /**
21  * Describes the input token stream.
22  */

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

31   public int kind;
32
33   /**
34    * beginLine and beginColumn describe the position of the first character
35    * of this token; endLine and endColumn describe the position of the
36    * last character of this token.
37    */

38   public int beginLine, beginColumn, endLine, endColumn;
39
40   /**
41    * The string image of the token.
42    */

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

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

67   public Token specialToken;
68
69   /**
70    * Returns the image.
71    */

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

89   public static final Token newToken(int ofKind)
90   {
91      switch(ofKind)
92      {
93        default : return new Token();
94      }
95   }
96
97 }
98
Popular Tags