KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > netbeans > modules > debugger > jpda > expr > Token


1 /*
2  * The contents of this file are subject to the terms of the Common Development
3  * and Distribution License (the License). You may not use this file except in
4  * compliance with the License.
5  *
6  * You can obtain a copy of the License at http://www.netbeans.org/cddl.html
7  * or http://www.netbeans.org/cddl.txt.
8  *
9  * When distributing Covered Code, include this CDDL Header Notice in each file
10  * and include the License file at http://www.netbeans.org/cddl.txt.
11  * If applicable, add the following below the CDDL Header, with the fields
12  * enclosed by brackets [] replaced by your own identifying information:
13  * "Portions Copyrighted [year] [name of copyright owner]"
14  *
15  * The Original Software is NetBeans. The Initial Developer of the Original
16  * Software is Sun Microsystems, Inc. Portions Copyright 1997-2006 Sun
17  * Microsystems, Inc. All Rights Reserved.
18  */

19
20 /* Generated By:JavaCC: Do not edit this line. Token.java Version 3.0 */
21 package org.netbeans.modules.debugger.jpda.expr;
22
23 /**
24  * Describes the input token stream.
25  */

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

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

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

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

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

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

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

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