Main Page
Related Pages
Modules
Namespaces
Classes
Files
Examples
File List
File Members
doxygen-1.8.11
vhdlparser
Token.cc
Go to the documentation of this file.
1
/* Generated By:JavaCC: Do not edit this line. Token.cc Version 6.2 */
2
/* JavaCCOptions:STATIC=false,SUPPORT_CLASS_VISIBILITY_PUBLIC=true,TOKEN_INCLUDES=,TOKEN_EXTENDS= */
3
#include "
Token.h
"
4
5
namespace
vhdl
{
6
namespace
parser
{
7
8
/**
9
* Describes the input token stream.
10
*/
11
12
/**
13
* An optional attribute value of the Token.
14
* Tokens which are not used as syntactic sugar will often contain
15
* meaningful values that will be used later on by the compiler or
16
* interpreter. This attribute value is often different from the image.
17
* Any subclass of Token that actually wants to return a non-NULL value can
18
* override this method as appropriate.
19
*/
20
void
*
Token::getValue
() {
21
return
NULL;
22
}
23
24
/**
25
* No-argument constructor
26
*/
27
Token::Token
() {
28
this->
next
= NULL;
29
this->
specialToken
= NULL;
30
}
31
32
/**
33
* Constructs a new token for the specified Image.
34
*/
35
Token::Token
(
int
kind
)
36
{
37
this->kind =
kind
;
38
this->
next
= NULL;
39
this->
specialToken
= NULL;
40
}
41
42
/**
43
* Constructs a new token for the specified Image and Kind.
44
*/
45
Token::Token
(
int
kind
,
JAVACC_STRING_TYPE
image
)
46
{
47
this->kind =
kind
;
48
this->image =
image
;
49
this->
next
= NULL;
50
this->
specialToken
= NULL;
51
}
52
53
/**
54
* Returns the image.
55
*/
56
JAVACC_STRING_TYPE
Token::toString
()
57
{
58
return
image
;
59
}
60
61
/**
62
* Returns a new Token object, by default. However, if you want, you
63
* can create and return subclass objects based on the value of ofKind.
64
* Simply add the cases to the switch for all those special cases.
65
* For example, if you have a subclass of Token called IDToken that
66
* you want to create if ofKind is ID, simply add something like :
67
*
68
* case MyParserConstants.ID : return new IDToken(ofKind, image);
69
*
70
* to the following switch statement. Then you can cast matchedToken
71
* variable to the appropriate type and use sit in your lexical actions.
72
*/
73
Token
*
Token::newToken
(
int
ofKind,
JAVACC_STRING_TYPE
image
)
74
{
75
switch
(ofKind)
76
{
77
default
:
return
new
Token
(ofKind, image);
78
}
79
}
80
81
Token
*
Token::newToken
(
int
ofKind)
82
{
83
return
newToken
(ofKind,
JAVACC_STRING_TYPE
((
JAVACC_CHAR_TYPE
*)
""
));
84
}
85
86
Token::~Token
() {
87
if
(
specialToken
)
delete
specialToken
;
88
}
89
90
}
91
}
92
/* JavaCC - OriginalChecksum=dcb0f64486aa6455ae5af05d6bb539ec (do not edit this line) */
vhdl::parser::Token::next
Token * next
Definition:
Token.h:48
JAVACC_STRING_TYPE
#define JAVACC_STRING_TYPE
Definition:
JavaCC.h:16
vhdl::parser::Token::image
JAVACC_STRING_TYPE image
Definition:
Token.h:38
vhdl::parser::Token::kind
int kind
Definition:
Token.h:24
vhdl
Definition:
CharStream.cc:34
JAVACC_CHAR_TYPE
#define JAVACC_CHAR_TYPE
Definition:
JavaCC.h:12
vhdl::parser::Token::newToken
static Token * newToken(int ofKind, JAVACC_STRING_TYPE image)
Definition:
Token.cc:73
vhdl::parser::Token::~Token
virtual ~Token()
Definition:
Token.cc:86
vhdl::parser::Token::toString
JAVACC_STRING_TYPE toString()
Definition:
Token.cc:56
ValidateOpDetReco.parser
parser
Definition:
ValidateOpDetReco.py:22
vhdl::parser::Token::getValue
void * getValue()
Definition:
Token.cc:20
vhdl::parser::Token::specialToken
Token * specialToken
Definition:
Token.h:62
vhdl::parser::Token::Token
Token()
Definition:
Token.cc:27
vhdl::parser::Token
Definition:
Token.h:15
Token.h
Generated by
1.8.11