001: /*
002: * Copyright 1997-2003 Sun Microsystems, Inc. All Rights Reserved.
003: * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
004: *
005: * This code is free software; you can redistribute it and/or modify it
006: * under the terms of the GNU General Public License version 2 only, as
007: * published by the Free Software Foundation. Sun designates this
008: * particular file as subject to the "Classpath" exception as provided
009: * by Sun in the LICENSE file that accompanied this code.
010: *
011: * This code is distributed in the hope that it will be useful, but WITHOUT
012: * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
013: * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
014: * version 2 for more details (a copy is included in the LICENSE file that
015: * accompanied this code).
016: *
017: * You should have received a copy of the GNU General Public License version
018: * 2 along with this work; if not, write to the Free Software Foundation,
019: * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
020: *
021: * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
022: * CA 95054 USA or visit www.sun.com if you need additional information or
023: * have any questions.
024: */
025:
026: /* Generated By:JavaCC: Do not edit this line. Token.java Version 0.7pre3 */
027: package com.sun.jmx.snmp.IPAcl;
028:
029: /**
030: * Describes the input token stream.
031: */
032:
033: class Token {
034:
035: /**
036: * An integer that describes the kind of this token. This numbering
037: * system is determined by JavaCCParser, and a table of these numbers is
038: * stored in the file ...Constants.java.
039: */
040: public int kind;
041:
042: /**
043: * beginLine and beginColumn describe the position of the first character
044: * of this token; endLine and endColumn describe the position of the
045: * last character of this token.
046: */
047: public int beginLine, beginColumn, endLine, endColumn;
048:
049: /**
050: * The string image of the token.
051: */
052: public String image;
053:
054: /**
055: * A reference to the next regular (non-special) token from the input
056: * stream. If this is the last token from the input stream, or if the
057: * token manager has not read tokens beyond this one, this field is
058: * set to null. This is true only if this token is also a regular
059: * token. Otherwise, see below for a description of the contents of
060: * this field.
061: */
062: public Token next;
063:
064: /**
065: * This field is used to access special tokens that occur prior to this
066: * token, but after the immediately preceding regular (non-special) token.
067: * If there are no such special tokens, this field is set to null.
068: * When there are more than one such special token, this field refers
069: * to the last of these special tokens, which in turn refers to the next
070: * previous special token through its specialToken field, and so on
071: * until the first special token (whose specialToken field is null).
072: * The next fields of special tokens refer to other special tokens that
073: * immediately follow it (without an intervening regular token). If there
074: * is no such token, this field is null.
075: */
076: public Token specialToken;
077:
078: /**
079: * Returns the image.
080: */
081: public final String toString() {
082: return image;
083: }
084:
085: /**
086: * Returns a new Token object, by default. However, if you want, you
087: * can create and return subclass objects based on the value of ofKind.
088: * Simply add the cases to the switch for all those special cases.
089: * For example, if you have a subclass of Token called IDToken that
090: * you want to create if ofKind is ID, simlpy add something like :
091: *
092: * case MyParserConstants.ID : return new IDToken();
093: *
094: * to the following switch statement. Then you can cast matchedToken
095: * variable to the appropriate type and use it in your lexical actions.
096: */
097: public static final Token newToken(int ofKind) {
098: switch (ofKind) {
099: default:
100: return new Token();
101: }
102: }
103:
104: }
|