Token.h
Go to the documentation of this file.
1 /* Generated By:JavaCC: Do not edit this line. Token.h Version 6.2 */
2 /* JavaCCOptions:STATIC=false,SUPPORT_CLASS_VISIBILITY_PUBLIC=true,TOKEN_INCLUDES=,TOKEN_EXTENDS= */
3 #ifndef TOKEN_H
4 #define TOKEN_H
5 #include "JavaCC.h"
6 
7 
8 namespace vhdl {
9 namespace parser {
10 
11 /**
12  * Describes the input token stream.
13  */
14 
15 class Token
16 {
17  public:
18 
19  /**
20  * An integer that describes the kind of this token. This numbering
21  * system is determined by JavaCCParser, and a table of these numbers is
22  * stored in the file ...Constants.java.
23  */
24  int kind;
25 
26  /** The line number of the first character of this Token. */
27  int beginLine;
28  /** The column number of the first character of this Token. */
30  /** The line number of the last character of this Token. */
31  int endLine;
32  /** The column number of the last character of this Token. */
33  int endColumn;
34 
35  /**
36  * The string image of the token.
37  */
39 
40  /**
41  * A reference to the next regular (non-special) token from the input
42  * stream. If this is the last token from the input stream, or if the
43  * token manager has not read tokens beyond this one, this field is
44  * set to NULL. This is true only if this token is also a regular
45  * token. Otherwise, see below for a description of the contents of
46  * this field.
47  */
49 
50  /**
51  * This field is used to access special tokens that occur prior to this
52  * token, but after the immediately preceding regular (non-special) token.
53  * If there are no such special tokens, this field is set to NULL.
54  * When there are more than one such special token, this field refers
55  * to the last of these special tokens, which in turn refers to the next
56  * previous special token through its specialToken field, and so on
57  * until the first special token (whose specialToke_ field is NULL).
58  * The next fields of special tokens refer to other special tokens that
59  * immediately follow it (without an intervening regular token). If there
60  * is no such token, this field is NULL.
61  */
63 
64  /**
65  * An optional attribute value of the Token.
66  * Tokens which are not used as syntactic sugar will often contain
67  * meaningful values that will be used later on by the compiler or
68  * interpreter. This attribute value is often different from the image.
69  * Any subclass of Token that actually wants to return a non-NULL value can
70  * override this method as appropriate.
71  */
72  void * getValue();
73 
74  /**
75  * No-argument constructor
76  */
77  Token();
78 
79  /**
80  * Constructs a new token for the specified Image.
81  */
82  Token(int kind);
83 
84  /**
85  * Constructs a new token for the specified Image and Kind.
86  */
87  Token(int kind, JAVACC_STRING_TYPE image);
88 
89  virtual ~Token();
90 
91  /**
92  * Returns the image.
93  */
95 
96 
97  /**
98  * Returns a new Token void *, by default. However, if you want, you
99  * can create and return subclass objects based on the value of ofKind.
100  * Simply add the cases to the switch for all those special cases.
101  * For example, if you have a subclass of Token called IDToken that
102  * you want to create if ofKind is ID, simply add something like :
103  *
104  * case MyParserConstants.ID : return new IDToken(ofKind, image);
105  *
106  * to the following switch statement. Then you can cast matchedToken
107  * variable to the appropriate type and use sit in your lexical actions.
108  */
109  static Token *newToken(int ofKind, JAVACC_STRING_TYPE image);
110 
111  static Token *newToken(int ofKind);
112 };
113 
114 }
115 }
116 #endif
117 /* JavaCC - OriginalChecksum=4748c3d6443aa3445d3c95ab54f14c2a (do not edit this line) */
Token * next
Definition: Token.h:48
#define JAVACC_STRING_TYPE
Definition: JavaCC.h:16
JAVACC_STRING_TYPE image
Definition: Token.h:38
static Token * newToken(int ofKind, JAVACC_STRING_TYPE image)
Definition: Token.cc:73
virtual ~Token()
Definition: Token.cc:86
JAVACC_STRING_TYPE toString()
Definition: Token.cc:56
void * getValue()
Definition: Token.cc:20
Token * specialToken
Definition: Token.h:62