001 /* 002 * Cobertura - http://cobertura.sourceforge.net/ 003 * 004 * This file was taken from JavaNCSS 005 * http://www.kclee.com/clemens/java/javancss/ 006 * Copyright (C) 2000 Chr. Clemens Lee <clemens a.t kclee d.o.t com> 007 * 008 * Cobertura is free software; you can redistribute it and/or modify 009 * it under the terms of the GNU General Public License as published 010 * by the Free Software Foundation; either version 2 of the License, 011 * or (at your option) any later version. 012 * 013 * Cobertura is distributed in the hope that it will be useful, but 014 * WITHOUT ANY WARRANTY; without even the implied warranty of 015 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 016 * General Public License for more details. 017 * 018 * You should have received a copy of the GNU General Public License 019 * along with Cobertura; if not, write to the Free Software 020 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 021 * USA 022 */ 023 024 025 /* 026 * 027 * WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING 028 * 029 * WARNING TO COBERTURA DEVELOPERS 030 * 031 * DO NOT MODIFY THIS FILE! 032 * 033 * MODIFY THE FILES UNDER THE JAVANCSS DIRECTORY LOCATED AT THE ROOT OF THE COBERTURA PROJECT. 034 * 035 * FOLLOW THE PROCEDURE FOR MERGING THE LATEST JAVANCSS INTO COBERTURA LOCATED AT 036 * javancss/coberturaREADME.txt 037 * 038 * WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING 039 */ 040 /* Generated By:JavaCC: Do not edit this line. Token.java Version 3.0 */ 041 /** 042 * Describes the input token stream. 043 */ 044 045 package net.sourceforge.cobertura.javancss.parser.java15; 046 047 public class Token { 048 049 /** 050 * An integer that describes the kind of this token. This numbering 051 * system is determined by JavaCCParser, and a table of these numbers is 052 * stored in the file ...Constants.java. 053 */ 054 public int kind; 055 056 /** 057 * beginLine and beginColumn describe the position of the first character 058 * of this token; endLine and endColumn describe the position of the 059 * last character of this token. 060 */ 061 public int beginLine, beginColumn, endLine, endColumn; 062 063 /** 064 * The string image of the token. 065 */ 066 public String image; 067 068 /** 069 * A reference to the next regular (non-special) token from the input 070 * stream. If this is the last token from the input stream, or if the 071 * token manager has not read tokens beyond this one, this field is 072 * set to null. This is true only if this token is also a regular 073 * token. Otherwise, see below for a description of the contents of 074 * this field. 075 */ 076 public Token next; 077 078 /** 079 * This field is used to access special tokens that occur prior to this 080 * token, but after the immediately preceding regular (non-special) token. 081 * If there are no such special tokens, this field is set to null. 082 * When there are more than one such special token, this field refers 083 * to the last of these special tokens, which in turn refers to the next 084 * previous special token through its specialToken field, and so on 085 * until the first special token (whose specialToken field is null). 086 * The next fields of special tokens refer to other special tokens that 087 * immediately follow it (without an intervening regular token). If there 088 * is no such token, this field is null. 089 */ 090 public Token specialToken; 091 092 /** 093 * Returns the image. 094 */ 095 public String toString() 096 { 097 return image; 098 } 099 100 /** 101 * Returns a new Token object, by default. However, if you want, you 102 * can create and return subclass objects based on the value of ofKind. 103 * Simply add the cases to the switch for all those special cases. 104 * For example, if you have a subclass of Token called IDToken that 105 * you want to create if ofKind is ID, simlpy add something like : 106 * 107 * case MyParserConstants.ID : return new IDToken(); 108 * 109 * to the following switch statement. Then you can cast matchedToken 110 * variable to the appropriate type and use it in your lexical actions. 111 */ 112 public static final Token newToken(int ofKind) 113 { 114 switch(ofKind) 115 { 116 default : return new Token(); 117 case JavaParser15Constants.RUNSIGNEDSHIFT: 118 case JavaParser15Constants.RSIGNEDSHIFT: 119 case JavaParser15Constants.GT: 120 return new GTToken(); 121 } 122 } 123 124 public static class GTToken extends Token 125 { 126 int realKind = JavaParser15Constants.GT; 127 } 128 }