View Javadoc
1   /*
2    * Licensed to the Apache Software Foundation (ASF) under one or more
3    * contributor license agreements.  See the NOTICE file distributed with
4    * this work for additional information regarding copyright ownership.
5    * The ASF licenses this file to You under the Apache License, Version 2.0
6    * (the "License"); you may not use this file except in compliance with
7    * the License.  You may obtain a copy of the License at
8    *
9    *     http://www.apache.org/licenses/LICENSE-2.0
10   *
11   * Unless required by applicable law or agreed to in writing, software
12   * distributed under the License is distributed on an "AS IS" BASIS,
13   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14   * See the License for the specific language governing permissions and
15   * limitations under the License.
16   */
17  /* Generated By:JavaCC: Do not edit this line. Token.java Version 3.0 */
18  
19  package org.apache.commons.jxpath.ri.parser;
20  
21  /**
22   * Describes the input token stream.
23   */
24  public class Token {
25  
26      /**
27       * Returns a new Token object, by default. However, if you want, you can create and return subclass objects based on the value of ofKind. Simply add the
28       * cases to the switch for all those special cases. For example, if you have a subclass of Token called IDToken that you want to create if ofKind is ID,
29       * simlpy add something like :
30       *
31       * <pre>
32       *    case MyParserConstants.ID : return new IDToken();
33       * </pre>
34       *
35       * to the following switch statement. Then you can cast matchedToken variable to the appropriate type and use it in your lexical actions.
36       *
37       * @param ofKind TODO
38       * @return TODO
39       */
40      public static final Token newToken(final int ofKind) {
41          switch (ofKind) {
42          default:
43              return new Token();
44          }
45      }
46  
47      /**
48       * An integer that describes the kind of this token. This numbering system is determined by JavaCCParser, and a table of these numbers is stored in the file
49       * ...Constants.java.
50       */
51      public int kind;
52      /**
53       * beginLine and beginColumn describe the position of the first character of this token; endLine and endColumn describe the position of the last character
54       * of this token.
55       */
56      public int beginLine, beginColumn, endLine, endColumn;
57      /**
58       * The string image of the token.
59       */
60      public String image;
61      /**
62       * A reference to the next regular (non-special) token from the input stream. If this is the last token from the input stream, or if the token manager has
63       * not read tokens beyond this one, this field is set to null. This is true only if this token is also a regular token. Otherwise, see below for a
64       * description of the contents of this field.
65       */
66      public Token next;
67      /**
68       * This field is used to access special tokens that occur prior to this token, but after the immediately preceding regular (non-special) token. If there are
69       * no such special tokens, this field is set to null. When there are more than one such special token, this field refers to the last of these special
70       * tokens, which in turn refers to the next previous special token through its specialToken field, and so on until the first special token (whose
71       * specialToken field is null). The next fields of special tokens refer to other special tokens that immediately follow it (without an intervening regular
72       * token). If there is no such token, this field is null.
73       */
74      public Token specialToken;
75  
76      /**
77       * Returns the image.
78       */
79      @Override
80      public String toString() {
81          return image;
82      }
83  }