| 1 |
2 |
peteralieb |
/* Generated By:JavaCC: Do not edit this line. Token.java Version 5.0 */
|
| 2 |
|
|
/* JavaCCOptions:TOKEN_EXTENDS=,KEEP_LINE_COL=null,SUPPORT_CLASS_VISIBILITY_PUBLIC=true */
|
| 3 |
|
|
/*
|
| 4 |
|
|
@LICENSE@
|
| 5 |
|
|
*/
|
| 6 |
|
|
package edu.byu.cc.plieber.fpgaenet.debug.llparse;
|
| 7 |
|
|
|
| 8 |
|
|
/**
|
| 9 |
|
|
* Describes the input token stream.
|
| 10 |
|
|
*/
|
| 11 |
|
|
|
| 12 |
|
|
public class Token implements java.io.Serializable {
|
| 13 |
|
|
|
| 14 |
|
|
/**
|
| 15 |
|
|
* The version identifier for this Serializable class.
|
| 16 |
|
|
* Increment only if the <i>serialized</i> form of the
|
| 17 |
|
|
* class changes.
|
| 18 |
|
|
*/
|
| 19 |
|
|
private static final long serialVersionUID = 1L;
|
| 20 |
|
|
|
| 21 |
|
|
/**
|
| 22 |
|
|
* An integer that describes the kind of this token. This numbering
|
| 23 |
|
|
* system is determined by JavaCCParser, and a table of these numbers is
|
| 24 |
|
|
* stored in the file ...Constants.java.
|
| 25 |
|
|
*/
|
| 26 |
|
|
public int kind;
|
| 27 |
|
|
|
| 28 |
|
|
/** The line number of the first character of this Token. */
|
| 29 |
|
|
public int beginLine;
|
| 30 |
|
|
/** The column number of the first character of this Token. */
|
| 31 |
|
|
public int beginColumn;
|
| 32 |
|
|
/** The line number of the last character of this Token. */
|
| 33 |
|
|
public int endLine;
|
| 34 |
|
|
/** The column number of the last character of this Token. */
|
| 35 |
|
|
public int endColumn;
|
| 36 |
|
|
|
| 37 |
|
|
/**
|
| 38 |
|
|
* The string image of the token.
|
| 39 |
|
|
*/
|
| 40 |
|
|
public String image;
|
| 41 |
|
|
|
| 42 |
|
|
/**
|
| 43 |
|
|
* A reference to the next regular (non-special) token from the input
|
| 44 |
|
|
* stream. If this is the last token from the input stream, or if the
|
| 45 |
|
|
* token manager has not read tokens beyond this one, this field is
|
| 46 |
|
|
* set to null. This is true only if this token is also a regular
|
| 47 |
|
|
* token. Otherwise, see below for a description of the contents of
|
| 48 |
|
|
* this field.
|
| 49 |
|
|
*/
|
| 50 |
|
|
public Token next;
|
| 51 |
|
|
|
| 52 |
|
|
/**
|
| 53 |
|
|
* This field is used to access special tokens that occur prior to this
|
| 54 |
|
|
* token, but after the immediately preceding regular (non-special) token.
|
| 55 |
|
|
* If there are no such special tokens, this field is set to null.
|
| 56 |
|
|
* When there are more than one such special token, this field refers
|
| 57 |
|
|
* to the last of these special tokens, which in turn refers to the next
|
| 58 |
|
|
* previous special token through its specialToken field, and so on
|
| 59 |
|
|
* until the first special token (whose specialToken field is null).
|
| 60 |
|
|
* The next fields of special tokens refer to other special tokens that
|
| 61 |
|
|
* immediately follow it (without an intervening regular token). If there
|
| 62 |
|
|
* is no such token, this field is null.
|
| 63 |
|
|
*/
|
| 64 |
|
|
public Token specialToken;
|
| 65 |
|
|
|
| 66 |
|
|
/**
|
| 67 |
|
|
* An optional attribute value of the Token.
|
| 68 |
|
|
* Tokens which are not used as syntactic sugar will often contain
|
| 69 |
|
|
* meaningful values that will be used later on by the compiler or
|
| 70 |
|
|
* interpreter. This attribute value is often different from the image.
|
| 71 |
|
|
* Any subclass of Token that actually wants to return a non-null value can
|
| 72 |
|
|
* override this method as appropriate.
|
| 73 |
|
|
*/
|
| 74 |
|
|
public Object getValue() {
|
| 75 |
|
|
return null;
|
| 76 |
|
|
}
|
| 77 |
|
|
|
| 78 |
|
|
/**
|
| 79 |
|
|
* No-argument constructor
|
| 80 |
|
|
*/
|
| 81 |
|
|
public Token() {}
|
| 82 |
|
|
|
| 83 |
|
|
/**
|
| 84 |
|
|
* Constructs a new token for the specified Image.
|
| 85 |
|
|
*/
|
| 86 |
|
|
public Token(int kind)
|
| 87 |
|
|
{
|
| 88 |
|
|
this(kind, null);
|
| 89 |
|
|
}
|
| 90 |
|
|
|
| 91 |
|
|
/**
|
| 92 |
|
|
* Constructs a new token for the specified Image and Kind.
|
| 93 |
|
|
*/
|
| 94 |
|
|
public Token(int kind, String image)
|
| 95 |
|
|
{
|
| 96 |
|
|
this.kind = kind;
|
| 97 |
|
|
this.image = image;
|
| 98 |
|
|
}
|
| 99 |
|
|
|
| 100 |
|
|
/**
|
| 101 |
|
|
* Returns the image.
|
| 102 |
|
|
*/
|
| 103 |
|
|
public String toString()
|
| 104 |
|
|
{
|
| 105 |
|
|
return image;
|
| 106 |
|
|
}
|
| 107 |
|
|
|
| 108 |
|
|
/**
|
| 109 |
|
|
* Returns a new Token object, by default. However, if you want, you
|
| 110 |
|
|
* can create and return subclass objects based on the value of ofKind.
|
| 111 |
|
|
* Simply add the cases to the switch for all those special cases.
|
| 112 |
|
|
* For example, if you have a subclass of Token called IDToken that
|
| 113 |
|
|
* you want to create if ofKind is ID, simply add something like :
|
| 114 |
|
|
*
|
| 115 |
|
|
* case MyParserConstants.ID : return new IDToken(ofKind, image);
|
| 116 |
|
|
*
|
| 117 |
|
|
* to the following switch statement. Then you can cast matchedToken
|
| 118 |
|
|
* variable to the appropriate type and use sit in your lexical actions.
|
| 119 |
|
|
*/
|
| 120 |
|
|
public static Token newToken(int ofKind, String image)
|
| 121 |
|
|
{
|
| 122 |
|
|
switch(ofKind)
|
| 123 |
|
|
{
|
| 124 |
|
|
default : return new Token(ofKind, image);
|
| 125 |
|
|
}
|
| 126 |
|
|
}
|
| 127 |
|
|
|
| 128 |
|
|
public static Token newToken(int ofKind)
|
| 129 |
|
|
{
|
| 130 |
|
|
return newToken(ofKind, null);
|
| 131 |
|
|
}
|
| 132 |
|
|
|
| 133 |
|
|
}
|
| 134 |
|
|
/* JavaCC - OriginalChecksum=f5d43f7e236b5daf28ccee325bc233f9 (do not edit this line) */
|