View Javadoc
1   /*
2    * Copyright (c) 1997, 2010, 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  /* Generated By:JavaCC: Do not edit this line. Token.java Version 3.0 */
27  package com.sun.xml.internal.xsom.impl.scd;
28  
29  /**
30   * Describes the input token stream.
31   */
32  
33  public class Token {
34  
35    /**
36     * An integer that describes the kind of this token.  This numbering
37     * system is determined by JavaCCParser, and a table of these numbers is
38     * stored in the file ...Constants.java.
39     */
40    public int kind;
41  
42    /**
43     * beginLine and beginColumn describe the position of the first character
44     * of this token; endLine and endColumn describe the position of the
45     * last character of this token.
46     */
47    public int beginLine, beginColumn, endLine, endColumn;
48  
49    /**
50     * The string image of the token.
51     */
52    public String image;
53  
54    /**
55     * A reference to the next regular (non-special) token from the input
56     * stream.  If this is the last token from the input stream, or if the
57     * token manager has not read tokens beyond this one, this field is
58     * set to null.  This is true only if this token is also a regular
59     * token.  Otherwise, see below for a description of the contents of
60     * this field.
61     */
62    public Token next;
63  
64    /**
65     * This field is used to access special tokens that occur prior to this
66     * token, but after the immediately preceding regular (non-special) token.
67     * If there are no such special tokens, this field is set to null.
68     * When there are more than one such special token, this field refers
69     * to the last of these special tokens, which in turn refers to the next
70     * previous special token through its specialToken field, and so on
71     * until the first special token (whose specialToken field is null).
72     * The next fields of special tokens refer to other special tokens that
73     * immediately follow it (without an intervening regular token).  If there
74     * is no such token, this field is null.
75     */
76    public Token specialToken;
77  
78    /**
79     * Returns the image.
80     */
81    public String toString()
82    {
83       return image;
84    }
85  
86    /**
87     * Returns a new Token object, by default. However, if you want, you
88     * can create and return subclass objects based on the value of ofKind.
89     * Simply add the cases to the switch for all those special cases.
90     * For example, if you have a subclass of Token called IDToken that
91     * you want to create if ofKind is ID, simlpy add something like :
92     *
93     *    case MyParserConstants.ID : return new IDToken();
94     *
95     * to the following switch statement. Then you can cast matchedToken
96     * variable to the appropriate type and use it in your lexical actions.
97     */
98    public static final Token newToken(int ofKind)
99    {
100      switch(ofKind)
101      {
102        default : return new Token();
103      }
104   }
105 
106 }