001 /**
002 * GRANITE DATA SERVICES
003 * Copyright (C) 2006-2013 GRANITE DATA SERVICES S.A.S.
004 *
005 * This file is part of the Granite Data Services Platform.
006 *
007 * Granite Data Services is free software; you can redistribute it and/or
008 * modify it under the terms of the GNU Lesser General Public
009 * License as published by the Free Software Foundation; either
010 * version 2.1 of the License, or (at your option) any later version.
011 *
012 * Granite Data Services is distributed in the hope that it will be useful,
013 * but WITHOUT ANY WARRANTY; without even the implied warranty of
014 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser
015 * General Public License for more details.
016 *
017 * You should have received a copy of the GNU Lesser General Public
018 * License along with this library; if not, write to the Free Software
019 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
020 * USA, or see <http://www.gnu.org/licenses/>.
021 */
022 /* Generated By:JavaCC: Do not edit this line. Token.java Version 3.0 */
023 /**
024 *
025 * Licensed to the Apache Software Foundation (ASF) under one or more
026 * contributor license agreements. See the NOTICE file distributed with
027 * this work for additional information regarding copyright ownership.
028 * The ASF licenses this file to You under the Apache License, Version 2.0
029 * (the "License"); you may not use this file except in compliance with
030 * the License. You may obtain a copy of the License at
031 *
032 * http://www.apache.org/licenses/LICENSE-2.0
033 *
034 * Unless required by applicable law or agreed to in writing, software
035 * distributed under the License is distributed on an "AS IS" BASIS,
036 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
037 * See the License for the specific language governing permissions and
038 * limitations under the License.
039 */
040
041 package org.granite.gravity.selector;
042
043 /**
044 * Describes the input token stream.
045 */
046 public class Token {
047
048 /**
049 * An integer that describes the kind of this token. This numbering
050 * system is determined by JavaCCParser, and a table of these numbers is
051 * stored in the file ...Constants.java.
052 */
053 public int kind;
054
055 /**
056 * beginLine and beginColumn describe the position of the first character
057 * of this token; endLine and endColumn describe the position of the
058 * last character of this token.
059 */
060 public int beginLine, beginColumn, endLine, endColumn;
061
062 /**
063 * The string image of the token.
064 */
065 public String image;
066
067 /**
068 * A reference to the next regular (non-special) token from the input
069 * stream. If this is the last token from the input stream, or if the
070 * token manager has not read tokens beyond this one, this field is
071 * set to null. This is true only if this token is also a regular
072 * token. Otherwise, see below for a description of the contents of
073 * this field.
074 */
075 public Token next;
076
077 /**
078 * This field is used to access special tokens that occur prior to this
079 * token, but after the immediately preceding regular (non-special) token.
080 * If there are no such special tokens, this field is set to null.
081 * When there are more than one such special token, this field refers
082 * to the last of these special tokens, which in turn refers to the next
083 * previous special token through its specialToken field, and so on
084 * until the first special token (whose specialToken field is null).
085 * The next fields of special tokens refer to other special tokens that
086 * immediately follow it (without an intervening regular token). If there
087 * is no such token, this field is null.
088 */
089 public Token specialToken;
090
091 /**
092 * Returns the image.
093 */
094 @Override
095 public String toString()
096 {
097 return image;
098 }
099
100 /**
101 * Returns a new Token object, by default. However, if you want, you
102 * can create and return subclass objects based on the value of ofKind.
103 * Simply add the cases to the switch for all those special cases.
104 * For example, if you have a subclass of Token called IDToken that
105 * you want to create if ofKind is ID, simlpy add something like :
106 *
107 * case MyParserConstants.ID : return new IDToken();
108 *
109 * to the following switch statement. Then you can cast matchedToken
110 * variable to the appropriate type and use it in your lexical actions.
111 */
112 public static final Token newToken(int ofKind)
113 {
114 switch(ofKind)
115 {
116 default : return new Token();
117 }
118 }
119
120 }