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 * Copyright (C) 2004-2011 27 * 28 * Permission is hereby granted, free of charge, to any person obtaining a copy 29 * of this software and associated documentation files (the "Software"), to deal 30 * in the Software without restriction, including without limitation the rights 31 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 32 * copies of the Software, and to permit persons to whom the Software is 33 * furnished to do so, subject to the following conditions: 34 * 35 * The above copyright notice and this permission notice shall be included in 36 * all copies or substantial portions of the Software. 37 * 38 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 39 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 40 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 41 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 42 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 43 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 44 * THE SOFTWARE. 45 */ 46 /* Generated By:JavaCC: Do not edit this line. Token.java Version 5.0 */ 47 /* JavaCCOptions:TOKEN_EXTENDS=,KEEP_LINE_COL=null,SUPPORT_CLASS_VISIBILITY_PUBLIC=true */ 48 package com.sun.xml.internal.rngom.parse.compact; 49 50 /** 51 * Describes the input token stream. 52 */ 53 54 public class Token implements java.io.Serializable { 55 56 /** 57 * The version identifier for this Serializable class. 58 * Increment only if the <i>serialized</i> form of the 59 * class changes. 60 */ 61 private static final long serialVersionUID = 1L; 62 63 /** 64 * An integer that describes the kind of this token. This numbering 65 * system is determined by JavaCCParser, and a table of these numbers is 66 * stored in the file ...Constants.java. 67 */ 68 public int kind; 69 70 /** The line number of the first character of this Token. */ 71 public int beginLine; 72 /** The column number of the first character of this Token. */ 73 public int beginColumn; 74 /** The line number of the last character of this Token. */ 75 public int endLine; 76 /** The column number of the last character of this Token. */ 77 public int endColumn; 78 79 /** 80 * The string image of the token. 81 */ 82 public String image; 83 84 /** 85 * A reference to the next regular (non-special) token from the input 86 * stream. If this is the last token from the input stream, or if the 87 * token manager has not read tokens beyond this one, this field is 88 * set to null. This is true only if this token is also a regular 89 * token. Otherwise, see below for a description of the contents of 90 * this field. 91 */ 92 public Token next; 93 94 /** 95 * This field is used to access special tokens that occur prior to this 96 * token, but after the immediately preceding regular (non-special) token. 97 * If there are no such special tokens, this field is set to null. 98 * When there are more than one such special token, this field refers 99 * to the last of these special tokens, which in turn refers to the next 100 * previous special token through its specialToken field, and so on 101 * until the first special token (whose specialToken field is null). 102 * The next fields of special tokens refer to other special tokens that 103 * immediately follow it (without an intervening regular token). If there 104 * is no such token, this field is null. 105 */ 106 public Token specialToken; 107 108 /** 109 * An optional attribute value of the Token. 110 * Tokens which are not used as syntactic sugar will often contain 111 * meaningful values that will be used later on by the compiler or 112 * interpreter. This attribute value is often different from the image. 113 * Any subclass of Token that actually wants to return a non-null value can 114 * override this method as appropriate. 115 */ 116 public Object getValue() { 117 return null; 118 } 119 120 /** 121 * No-argument constructor 122 */ 123 public Token() {} 124 125 /** 126 * Constructs a new token for the specified Image. 127 */ 128 public Token(int kind) 129 { 130 this(kind, null); 131 } 132 133 /** 134 * Constructs a new token for the specified Image and Kind. 135 */ 136 public Token(int kind, String image) 137 { 138 this.kind = kind; 139 this.image = image; 140 } 141 142 /** 143 * Returns the image. 144 */ 145 public String toString() 146 { 147 return image; 148 } 149 150 /** 151 * Returns a new Token object, by default. However, if you want, you 152 * can create and return subclass objects based on the value of ofKind. 153 * Simply add the cases to the switch for all those special cases. 154 * For example, if you have a subclass of Token called IDToken that 155 * you want to create if ofKind is ID, simply add something like : 156 * 157 * case MyParserConstants.ID : return new IDToken(ofKind, image); 158 * 159 * to the following switch statement. Then you can cast matchedToken 160 * variable to the appropriate type and use sit in your lexical actions. 161 */ 162 public static Token newToken(int ofKind, String image) 163 { 164 switch(ofKind) 165 { 166 default : return new Token(ofKind, image); 167 } 168 } 169 170 public static Token newToken(int ofKind) 171 { 172 return newToken(ofKind, null); 173 } 174 175 } 176 /* JavaCC - OriginalChecksum=07395369f4a62ea6ce44cc3487e30e69 (do not edit this line) */ | 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 } |