001/** 002 * Copyright (C) 2007 - 2016, Jens Lehmann 003 * 004 * This file is part of DL-Learner. 005 * 006 * DL-Learner is free software; you can redistribute it and/or modify 007 * it under the terms of the GNU General Public License as published by 008 * the Free Software Foundation; either version 3 of the License, or 009 * (at your option) any later version. 010 * 011 * DL-Learner is distributed in the hope that it will be useful, 012 * but WITHOUT ANY WARRANTY; without even the implied warranty of 013 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 014 * GNU General Public License for more details. 015 * 016 * You should have received a copy of the GNU General Public License 017 * along with this program. If not, see <http://www.gnu.org/licenses/>. 018 */ 019/* Generated By:JavaCC: Do not edit this line. Token.java Version 4.1 */ 020/* JavaCCOptions:TOKEN_EXTENDS=,KEEP_LINE_COL=null */ 021package org.dllearner.parser; 022 023/** 024 * Describes the input token stream. 025 */ 026 027@SuppressWarnings("all") 028public class Token { 029 030 /** 031 * An integer that describes the kind of this token. This numbering 032 * system is determined by JavaCCParser, and a table of these numbers is 033 * stored in the file ...Constants.java. 034 */ 035 public int kind; 036 037 /** The line number of the first character of this Token. */ 038 public int beginLine; 039 /** The column number of the first character of this Token. */ 040 public int beginColumn; 041 /** The line number of the last character of this Token. */ 042 public int endLine; 043 /** The column number of the last character of this Token. */ 044 public int endColumn; 045 046 /** 047 * The string image of the token. 048 */ 049 public String image; 050 051 /** 052 * A reference to the next regular (non-special) token from the input 053 * stream. If this is the last token from the input stream, or if the 054 * token manager has not read tokens beyond this one, this field is 055 * set to null. This is true only if this token is also a regular 056 * token. Otherwise, see below for a OWLClassExpression of the contents of 057 * this field. 058 */ 059 public Token next; 060 061 /** 062 * This field is used to access special tokens that occur prior to this 063 * token, but after the immediately preceding regular (non-special) token. 064 * If there are no such special tokens, this field is set to null. 065 * When there are more than one such special token, this field refers 066 * to the last of these special tokens, which in turn refers to the next 067 * previous special token through its specialToken field, and so on 068 * until the first special token (whose specialToken field is null). 069 * The next fields of special tokens refer to other special tokens that 070 * immediately follow it (without an intervening regular token). If there 071 * is no such token, this field is null. 072 */ 073 public Token specialToken; 074 075 /** 076 * An optional attribute value of the Token. 077 * Tokens which are not used as syntactic sugar will often contain 078 * meaningful values that will be used later on by the compiler or 079 * interpreter. This attribute value is often different from the image. 080 * Any subclass of Token that actually wants to return a non-null value can 081 * override this method as appropriate. 082 */ 083 public Object getValue() { 084 return null; 085 } 086 087 /** 088 * No-argument constructor 089 */ 090 public Token() {} 091 092 /** 093 * Constructs a new token for the specified Image. 094 */ 095 public Token(int kind) 096 { 097 this(kind, null); 098 } 099 100 /** 101 * Constructs a new token for the specified Image and Kind. 102 */ 103 public Token(int kind, String image) 104 { 105 this.kind = kind; 106 this.image = image; 107 } 108 109 /** 110 * Returns the image. 111 */ 112 public String toString() 113 { 114 return image; 115 } 116 117 /** 118 * Returns a new Token object, by default. However, if you want, you 119 * can create and return subclass objects based on the value of ofKind. 120 * Simply add the cases to the switch for all those special cases. 121 * For example, if you have a subclass of Token called IDToken that 122 * you want to create if ofKind is ID, simply add something like : 123 * 124 * case MyParserConstants.ID : return new IDToken(ofKind, image); 125 * 126 * to the following switch statement. Then you can cast matchedToken 127 * variable to the appropriate type and use sit in your lexical actions. 128 */ 129 public static Token newToken(int ofKind, String image) 130 { 131 switch(ofKind) 132 { 133 default : return new Token(ofKind, image); 134 } 135 } 136 137 public static Token newToken(int ofKind) 138 { 139 return newToken(ofKind, null); 140 } 141 142} 143/* JavaCC - OriginalChecksum=8d8b4fbd81824dbdd6b91fb215e7f12d (do not edit this line) */