KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > codehaus > aspectwerkz > annotation > expression > ast > Token


1 /* Generated By:JavaCC: Do not edit this line. Token.java Version 3.0 */
2
3 /**************************************************************************************
4  * Copyright (c) Jonas BonŽr, Alexandre Vasseur. All rights reserved. *
5  * http://aspectwerkz.codehaus.org *
6  * ---------------------------------------------------------------------------------- *
7  * The software in this package is published under the terms of the LGPL license *
8  * a copy of which has been included with this distribution in the license.txt file. *
9  **************************************************************************************/

10 package org.codehaus.aspectwerkz.annotation.expression.ast;
11
12 /**
13  * Describes the input token stream.
14  */

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

20     public int kind;
21
22     /**
23      * beginLine and beginColumn describe the position of the first character of this token; endLine and endColumn
24      * describe the position of the last character of this token.
25      */

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

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

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

44     public int endColumn;
45
46     /**
47      * The string image of the token.
48      */

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

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

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

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

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