| 1 | /* Generated By:JavaCC: Do not edit this line. Token.java Version 5.0 */ |
| 2 | /* JavaCCOptions:TOKEN_EXTENDS=,KEEP_LINE_COL=null,SUPPORT_CLASS_VISIBILITY_PUBLIC=true */ |
| 3 | /* |
| 4 | * jDTAUS Core RI Client Container |
| 5 | * Copyright (C) 2005 Christian Schulte |
| 6 | * <cs@schulte.it> |
| 7 | * |
| 8 | * This library is free software; you can redistribute it and/or |
| 9 | * modify it under the terms of the GNU Lesser General Public |
| 10 | * License as published by the Free Software Foundation; either |
| 11 | * version 2.1 of the License, or any later version. |
| 12 | * |
| 13 | * This library is distributed in the hope that it will be useful, |
| 14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
| 16 | * Lesser General Public License for more details. |
| 17 | * |
| 18 | * You should have received a copy of the GNU Lesser General Public |
| 19 | * License along with this library; if not, write to the Free Software |
| 20 | * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA |
| 21 | * |
| 22 | * $JDTAUS: VersionParser.jj 8641 2012-09-27 06:45:17Z schulte $ |
| 23 | * |
| 24 | */ |
| 25 | package org.jdtaus.core.container.ri.client.versioning; |
| 26 | |
| 27 | /** |
| 28 | * Describes the input token stream. |
| 29 | */ |
| 30 | |
| 31 | public class Token implements java.io.Serializable { |
| 32 | |
| 33 | /** |
| 34 | * The version identifier for this Serializable class. |
| 35 | * Increment only if the <i>serialized</i> form of the |
| 36 | * class changes. |
| 37 | */ |
| 38 | private static final long serialVersionUID = 1L; |
| 39 | |
| 40 | /** |
| 41 | * An integer that describes the kind of this token. This numbering |
| 42 | * system is determined by JavaCCParser, and a table of these numbers is |
| 43 | * stored in the file ...Constants.java. |
| 44 | */ |
| 45 | public int kind; |
| 46 | |
| 47 | /** The line number of the first character of this Token. */ |
| 48 | public int beginLine; |
| 49 | /** The column number of the first character of this Token. */ |
| 50 | public int beginColumn; |
| 51 | /** The line number of the last character of this Token. */ |
| 52 | public int endLine; |
| 53 | /** The column number of the last character of this Token. */ |
| 54 | public int endColumn; |
| 55 | |
| 56 | /** |
| 57 | * The string image of the token. |
| 58 | */ |
| 59 | public String image; |
| 60 | |
| 61 | /** |
| 62 | * A reference to the next regular (non-special) token from the input |
| 63 | * stream. If this is the last token from the input stream, or if the |
| 64 | * token manager has not read tokens beyond this one, this field is |
| 65 | * set to null. This is true only if this token is also a regular |
| 66 | * token. Otherwise, see below for a description of the contents of |
| 67 | * this field. |
| 68 | */ |
| 69 | public Token next; |
| 70 | |
| 71 | /** |
| 72 | * This field is used to access special tokens that occur prior to this |
| 73 | * token, but after the immediately preceding regular (non-special) token. |
| 74 | * If there are no such special tokens, this field is set to null. |
| 75 | * When there are more than one such special token, this field refers |
| 76 | * to the last of these special tokens, which in turn refers to the next |
| 77 | * previous special token through its specialToken field, and so on |
| 78 | * until the first special token (whose specialToken field is null). |
| 79 | * The next fields of special tokens refer to other special tokens that |
| 80 | * immediately follow it (without an intervening regular token). If there |
| 81 | * is no such token, this field is null. |
| 82 | */ |
| 83 | public Token specialToken; |
| 84 | |
| 85 | /** |
| 86 | * An optional attribute value of the Token. |
| 87 | * Tokens which are not used as syntactic sugar will often contain |
| 88 | * meaningful values that will be used later on by the compiler or |
| 89 | * interpreter. This attribute value is often different from the image. |
| 90 | * Any subclass of Token that actually wants to return a non-null value can |
| 91 | * override this method as appropriate. |
| 92 | */ |
| 93 | public Object getValue() { |
| 94 | return null; |
| 95 | } |
| 96 | |
| 97 | /** |
| 98 | * No-argument constructor |
| 99 | */ |
| 100 | public Token() {} |
| 101 | |
| 102 | /** |
| 103 | * Constructs a new token for the specified Image. |
| 104 | */ |
| 105 | public Token(int kind) |
| 106 | { |
| 107 | this(kind, null); |
| 108 | } |
| 109 | |
| 110 | /** |
| 111 | * Constructs a new token for the specified Image and Kind. |
| 112 | */ |
| 113 | public Token(int kind, String image) |
| 114 | { |
| 115 | this.kind = kind; |
| 116 | this.image = image; |
| 117 | } |
| 118 | |
| 119 | /** |
| 120 | * Returns the image. |
| 121 | */ |
| 122 | public String toString() |
| 123 | { |
| 124 | return image; |
| 125 | } |
| 126 | |
| 127 | /** |
| 128 | * Returns a new Token object, by default. However, if you want, you |
| 129 | * can create and return subclass objects based on the value of ofKind. |
| 130 | * Simply add the cases to the switch for all those special cases. |
| 131 | * For example, if you have a subclass of Token called IDToken that |
| 132 | * you want to create if ofKind is ID, simply add something like : |
| 133 | * |
| 134 | * case MyParserConstants.ID : return new IDToken(ofKind, image); |
| 135 | * |
| 136 | * to the following switch statement. Then you can cast matchedToken |
| 137 | * variable to the appropriate type and use sit in your lexical actions. |
| 138 | */ |
| 139 | public static Token newToken(int ofKind, String image) |
| 140 | { |
| 141 | switch(ofKind) |
| 142 | { |
| 143 | default : return new Token(ofKind, image); |
| 144 | } |
| 145 | } |
| 146 | |
| 147 | public static Token newToken(int ofKind) |
| 148 | { |
| 149 | return newToken(ofKind, null); |
| 150 | } |
| 151 | |
| 152 | } |
| 153 | /* JavaCC - OriginalChecksum=4fdee02c0b192b7e662ed0d6b7982419 (do not edit this line) */ |