1 /* Generated By:JavaCC: Do not edit this line. Token.java Version 5.0 */
\r
2 /* JavaCCOptions:TOKEN_EXTENDS=,KEEP_LINE_COL=null,SUPPORT_CLASS_VISIBILITY_PUBLIC=true */
\r
3 package org.simantics.graphviz.internal.parser;
\r
6 * Describes the input token stream.
\r
9 public class Token implements java.io.Serializable {
\r
12 * The version identifier for this Serializable class.
\r
13 * Increment only if the <i>serialized</i> form of the
\r
16 private static final long serialVersionUID = 1L;
\r
19 * An integer that describes the kind of this token. This numbering
\r
20 * system is determined by JavaCCParser, and a table of these numbers is
\r
21 * stored in the file ...Constants.java.
\r
25 /** The line number of the first character of this Token. */
\r
26 public int beginLine;
\r
27 /** The column number of the first character of this Token. */
\r
28 public int beginColumn;
\r
29 /** The line number of the last character of this Token. */
\r
31 /** The column number of the last character of this Token. */
\r
32 public int endColumn;
\r
35 * The string image of the token.
\r
37 public String image;
\r
40 * A reference to the next regular (non-special) token from the input
\r
41 * stream. If this is the last token from the input stream, or if the
\r
42 * token manager has not read tokens beyond this one, this field is
\r
43 * set to null. This is true only if this token is also a regular
\r
44 * token. Otherwise, see below for a description of the contents of
\r
50 * This field is used to access special tokens that occur prior to this
\r
51 * token, but after the immediately preceding regular (non-special) token.
\r
52 * If there are no such special tokens, this field is set to null.
\r
53 * When there are more than one such special token, this field refers
\r
54 * to the last of these special tokens, which in turn refers to the next
\r
55 * previous special token through its specialToken field, and so on
\r
56 * until the first special token (whose specialToken field is null).
\r
57 * The next fields of special tokens refer to other special tokens that
\r
58 * immediately follow it (without an intervening regular token). If there
\r
59 * is no such token, this field is null.
\r
61 public Token specialToken;
\r
64 * An optional attribute value of the Token.
\r
65 * Tokens which are not used as syntactic sugar will often contain
\r
66 * meaningful values that will be used later on by the compiler or
\r
67 * interpreter. This attribute value is often different from the image.
\r
68 * Any subclass of Token that actually wants to return a non-null value can
\r
69 * override this method as appropriate.
\r
71 public Object getValue() {
\r
76 * No-argument constructor
\r
81 * Constructs a new token for the specified Image.
\r
83 public Token(int kind)
\r
89 * Constructs a new token for the specified Image and Kind.
\r
91 public Token(int kind, String image)
\r
98 * Returns the image.
\r
100 public String toString()
\r
106 * Returns a new Token object, by default. However, if you want, you
\r
107 * can create and return subclass objects based on the value of ofKind.
\r
108 * Simply add the cases to the switch for all those special cases.
\r
109 * For example, if you have a subclass of Token called IDToken that
\r
110 * you want to create if ofKind is ID, simply add something like :
\r
112 * case MyParserConstants.ID : return new IDToken(ofKind, image);
\r
114 * to the following switch statement. Then you can cast matchedToken
\r
115 * variable to the appropriate type and use sit in your lexical actions.
\r
117 public static Token newToken(int ofKind, String image)
\r
121 default : return new Token(ofKind, image);
\r
125 public static Token newToken(int ofKind)
\r
127 return newToken(ofKind, null);
\r
131 /* JavaCC - OriginalChecksum=a4c719020b86a64f0eddb1d65d4dbfd6 (do not edit this line) */
\r