KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > versant > core > ejb > query > Token


1
2 /*
3  * Copyright (c) 1998 - 2005 Versant Corporation
4  * All rights reserved. This program and the accompanying materials
5  * are made available under the terms of the Eclipse Public License v1.0
6  * which accompanies this distribution, and is available at
7  * http://www.eclipse.org/legal/epl-v10.html
8  *
9  * Contributors:
10  * Versant Corporation - initial API and implementation
11  */

12 /* Generated By:JavaCC: Do not edit this line. Token.java Version 3.0 */
13 package com.versant.core.ejb.query;
14
15 /**
16  * Describes the input token stream.
17  */

18
19 public class Token {
20
21   /**
22    * An integer that describes the kind of this token. This numbering
23    * system is determined by JavaCCParser, and a table of these numbers is
24    * stored in the file ...Constants.java.
25    */

26   public int kind;
27
28   /**
29    * beginLine and beginColumn describe the position of the first character
30    * of this token; endLine and endColumn describe the position of the
31    * last character of this token.
32    */

33   public int beginLine, beginColumn, endLine, endColumn;
34
35   /**
36    * The string image of the token.
37    */

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

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

62   public Token specialToken;
63
64   /**
65    * Returns the image.
66    */

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

84   public static final Token newToken(int ofKind)
85   {
86      switch(ofKind)
87      {
88        default : return new Token();
89      }
90   }
91
92 }
93
Popular Tags