View Javadoc
1   /*
2    * Copyright (c) 1997, 2003, Oracle and/or its affiliates. All rights reserved.
3    * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4    *
5    * This code is free software; you can redistribute it and/or modify it
6    * under the terms of the GNU General Public License version 2 only, as
7    * published by the Free Software Foundation.  Oracle designates this
8    * particular file as subject to the "Classpath" exception as provided
9    * by Oracle in the LICENSE file that accompanied this code.
10   *
11   * This code is distributed in the hope that it will be useful, but WITHOUT
12   * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13   * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
14   * version 2 for more details (a copy is included in the LICENSE file that
15   * accompanied this code).
16   *
17   * You should have received a copy of the GNU General Public License version
18   * 2 along with this work; if not, write to the Free Software Foundation,
19   * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
20   *
21   * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
22   * or visit www.oracle.com if you need additional information or have any
23   * questions.
24   */
25  
26  
27  /* Generated By:JavaCC: Do not edit this line. Token.java Version 0.7pre3 */
28  package com.sun.jmx.snmp.IPAcl;
29  
30  /**
31   * Describes the input token stream.
32   */
33  
34  class Token {
35  
36    /**
37     * An integer that describes the kind of this token.  This numbering
38     * system is determined by JavaCCParser, and a table of these numbers is
39     * stored in the file ...Constants.java.
40     */
41    public int kind;
42  
43    /**
44     * beginLine and beginColumn describe the position of the first character
45     * of this token; endLine and endColumn describe the position of the
46     * last character of this token.
47     */
48    public int beginLine, beginColumn, endLine, endColumn;
49  
50    /**
51     * The string image of the token.
52     */
53    public String image;
54  
55    /**
56     * A reference to the next regular (non-special) token from the input
57     * stream.  If this is the last token from the input stream, or if the
58     * token manager has not read tokens beyond this one, this field is
59     * set to null.  This is true only if this token is also a regular
60     * token.  Otherwise, see below for a description of the contents of
61     * this field.
62     */
63    public Token next;
64  
65    /**
66     * This field is used to access special tokens that occur prior to this
67     * token, but after the immediately preceding regular (non-special) token.
68     * If there are no such special tokens, this field is set to null.
69     * When there are more than one such special token, this field refers
70     * to the last of these special tokens, which in turn refers to the next
71     * previous special token through its specialToken field, and so on
72     * until the first special token (whose specialToken field is null).
73     * The next fields of special tokens refer to other special tokens that
74     * immediately follow it (without an intervening regular token).  If there
75     * is no such token, this field is null.
76     */
77    public Token specialToken;
78  
79    /**
80     * Returns the image.
81     */
82    public final String toString()
83    {
84       return image;
85    }
86  
87    /**
88     * Returns a new Token object, by default. However, if you want, you
89     * can create and return subclass objects based on the value of ofKind.
90     * Simply add the cases to the switch for all those special cases.
91     * For example, if you have a subclass of Token called IDToken that
92     * you want to create if ofKind is ID, simlpy add something like :
93     *
94     *    case MyParserConstants.ID : return new IDToken();
95     *
96     * to the following switch statement. Then you can cast matchedToken
97     * variable to the appropriate type and use it in your lexical actions.
98     */
99    public static final Token newToken(int ofKind)
100   {
101      switch(ofKind)
102      {
103        default : return new Token();
104      }
105   }
106 
107 }