KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > net > sourceforge > cobertura > javancss > Token


1 /* Generated By:JavaCC: Do not edit this line. Token.java Version 0.7pre3 */
2
3 /*
4  * Cobertura - http://cobertura.sourceforge.net/
5  *
6  * This file was taken from JavaNCSS
7  * http://www.kclee.com/clemens/java/javancss/
8  * Copyright (C) 2000 Chr. Clemens Lee <clemens a.t kclee d.o.t com>
9  *
10  * Cobertura is free software; you can redistribute it and/or modify
11  * it under the terms of the GNU General Public License as published
12  * by the Free Software Foundation; either version 2 of the License,
13  * or (at your option) any later version.
14  *
15  * Cobertura is distributed in the hope that it will be useful, but
16  * WITHOUT ANY WARRANTY; without even the implied warranty of
17  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
18  * General Public License for more details.
19  *
20  * You should have received a copy of the GNU General Public License
21  * along with Cobertura; if not, write to the Free Software
22  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
23  * USA
24  */

25
26 package net.sourceforge.cobertura.javancss;
27
28 import java.io.Serializable JavaDoc;
29
30 /**
31  * Describes the input token stream.
32  */

33
34 class Token implements Serializable JavaDoc
35 {
36
37     private static final long serialVersionUID = 0L;
38
39     /**
40      * An integer that describes the kind of this token. This numbering
41      * system is determined by JavaCCParser, and a table of these numbers is
42      * stored in the file ...Constants.java.
43      */

44     int kind;
45
46     /**
47      * beginLine and beginColumn describe the position of the first character
48      * of this token; endLine and endColumn describe the position of the
49      * last character of this token.
50      */

51     int beginLine, beginColumn, endLine, endColumn;
52
53     /**
54      * The string image of the token.
55      */

56     String JavaDoc image;
57
58     /**
59      * A reference to the next regular (non-special) token from the input
60      * stream. If this is the last token from the input stream, or if the
61      * token manager has not read tokens beyond this one, this field is
62      * set to null. This is true only if this token is also a regular
63      * token. Otherwise, see below for a description of the contents of
64      * this field.
65      */

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

80     Token specialToken;
81
82     /**
83      * Returns the image.
84      */

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

102     static final Token newToken(int ofKind)
103     {
104         switch (ofKind)
105         {
106             default:
107                 return new Token();
108         }
109     }
110
111 }
112
Popular Tags