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