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