ROSE
0.9.6a
Main Page
Related Pages
Modules
Namespaces
Classes
Files
Examples
File List
File Members
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Friends
Macros
Groups
Pages
general_token_defs.h
Go to the documentation of this file.
1
/* DQ (9/24/2007): This is part of Rama's Lexer */
2
#ifndef ROSE_LEX_TOKEN_DEFINITIONS
3
#define ROSE_LEX_TOKEN_DEFINITIONS 1
4
5
class
PreprocessingInfo
;
6
7
// These have been moved from the preproc.ll file so that they can
8
// be seen by other parst of ROSE (e.g. in the token processing).
9
namespace
ROSE_token_ids
10
{
11
// whitespace token IDs
12
enum
whitespace
13
{
14
T_NOTKNOWN
,
15
// The following are non UNIX whitespace
16
};
17
18
#if 0
19
//I brazenly copied from the interface of WAVE for these enums
20
enum
ROSE_C_CXX_keywords
21
{
22
ROSE_ASM
/* WAVE equivalent is T_ASM */
23
ROSE_AUTO
/* WAVE equivalent is T_AUTO */
24
ROSE_BOOL
/* WAVE equivalent is T_BOOL */
25
ROSE_BREAK
/* WAVE equivalent is T_BREAK */
26
ROSE_CASE
/* WAVE equivalent is T_CASE */
27
ROSE_CATCH
/* WAVE equivalent is T_CATCH */
28
ROSE_CHAR
/* WAVE equivalent is T_CHAR */
29
ROSE_CLASS
/* WAVE equivalent is T_CLASS */
30
ROSE_CONST
/* WAVE equivalent is T_CONST */
31
ROSE_CONSTCAST
/* WAVE equivalent is T_CONSTCAST */
32
ROSE_CONTINUE
/* WAVE equivalent is T_CONTINUE */
33
ROSE_DEFAULT
/* WAVE equivalent is T_DEFAULT */
34
ROSE_DEFINED
/* WAVE equivalent is T_DEFINED */
35
ROSE_DELETE
/* WAVE equivalent is T_DELETE */
36
ROSE_DO
/* WAVE equivalent is T_DO */
37
ROSE_DOUBLE
/* WAVE equivalent is T_DOUBLE */
38
ROSE_DYNAMICCAST
/* WAVE equivalent is T_DYNAMICCAST */
39
ROSE_ELSE
/* WAVE equivalent is T_ELSE */
40
ROSE_ENUM
/* WAVE equivalent is T_ENUM */
41
ROSE_EXPLICIT
/* WAVE equivalent is T_EXPLICIT */
42
ROSE_EXPORT
/* WAVE equivalent is T_EXPORT */
43
ROSE_EXTERN
/* WAVE equivalent is T_EXTERN */
44
ROSE_FLOAT
/* WAVE equivalent is T_FLOAT */
45
ROSE_FOR
/* WAVE equivalent is T_FOR */
46
ROSE_FRIEND
/* WAVE equivalent is T_FRIEND */
47
ROSE_GOTO
/* WAVE equivalent is T_GOTO */
48
ROSE_IF
/* WAVE equivalent is T_IF */
49
ROSE_INLINE
/* WAVE equivalent is T_INLINE */
50
ROSE_INT
/* WAVE equivalent is T_INT */
51
ROSE_LONG
/* WAVE equivalent is T_LONG */
52
ROSE_MUTABLE
/* WAVE equivalent is T_MUTABLE */
53
ROSE_NAMESPACE
/* WAVE equivalent is T_NAMESPACE */
54
ROSE_NEW
/* WAVE equivalent is T_NEW */
55
ROSE_OPERATOR
/* WAVE equivalent is T_OPERATOR */
56
ROSE_PRIVATE
/* WAVE equivalent is T_PRIVATE */
57
ROSE_PROTECTED
/* WAVE equivalent is T_PROTECTED */
58
ROSE_PUBLIC
/* WAVE equivalent is T_PUBLIC */
59
ROSE_REGISTER
/* WAVE equivalent is T_REGISTER */
60
ROSE_REINTERPRETCAST
/* WAVE equivalent is T_REINTERPRETCAST */
61
ROSE_RETURN
/* WAVE equivalent is T_RETURN */
62
ROSE_SHORT
/* WAVE equivalent is T_SHORT */
63
ROSE_SIGNED
/* WAVE equivalent is T_SIGNED */
64
ROSE_SIZEOF
/* WAVE equivalent is T_SIZEOF */
65
ROSE_STATIC
/* WAVE equivalent is T_STATIC */
66
ROSE_STATICCAST
/* WAVE equivalent is T_STATICCAST */
67
ROSE_STRUCT
/* WAVE equivalent is T_STRUCT */
68
ROSE_SWITCH
/* WAVE equivalent is T_SWITCH */
69
ROSE_TEMPLATE
/* WAVE equivalent is T_TEMPLATE */
70
ROSE_THIS
/* WAVE equivalent is T_THIS */
71
ROSE_THROW
/* WAVE equivalent is T_THROW */
72
ROSE_TRY
/* WAVE equivalent is T_TRY */
73
ROSE_TYPEDEF
/* WAVE equivalent is T_TYPEDEF */
74
ROSE_TYPEID
/* WAVE equivalent is T_TYPEID */
75
ROSE_TYPENAME
/* WAVE equivalent is T_TYPENAME */
76
ROSE_UNION
/* WAVE equivalent is T_UNION */
77
ROSE_UNSIGNED
/* WAVE equivalent is T_UNSIGNED */
78
ROSE_USING
/* WAVE equivalent is T_USING */
79
ROSE_VIRTUAL
/* WAVE equivalent is T_VIRTUAL */
80
ROSE_VOID
/* WAVE equivalent is T_VOID */
81
ROSE_VOLATILE
/* WAVE equivalent is T_VOLATILE */
82
ROSE_WCHART
/* WAVE equivalent is T_WCHART */
83
ROSE_WHILE
/* WAVE equivalent is T_WHILE */
84
};
85
#endif
86
87
enum
ROSE_C_CXX_keywords
88
{
89
C_CXX_ASM
= 0 + 500,
90
C_CXX_AUTO
= 1 + 500,
91
C_CXX_BOOL
= 2 + 500,
92
C_CXX_BREAK
= 3 + 500,
93
C_CXX_CASE
= 4 + 500,
94
C_CXX_CATCH
= 5 + 500,
95
C_CXX_CHAR
= 6 + 500,
96
C_CXX_CLASS
= 7 + 500,
97
C_CXX_CONST
= 8 + 500,
98
C_CXX_CONSTCAST
= 9 + 500,
99
C_CXX_CONTINUE
= 10 + 500,
100
C_CXX_DEFAULT
= 11 + 500,
101
C_CXX_DEFINED
= 12 + 500,
102
C_CXX_DELETE
= 13 + 500,
103
C_CXX_DO
= 14 + 500,
104
C_CXX_DOUBLE
= 15 + 500,
105
C_CXX_DYNAMICCAST
= 16 + 500,
106
C_CXX_ELSE
= 17 + 500,
107
C_CXX_ENUM
= 18 + 500,
108
C_CXX_EXPLICIT
= 19 + 500,
109
C_CXX_EXPORT
= 20 + 500,
110
C_CXX_EXTERN
= 21 + 500,
111
C_CXX_FALSE
= 22 + 500,
112
C_CXX_FLOAT
= 23 + 500,
113
C_CXX_FOR
= 24 + 500,
114
C_CXX_FRIEND
= 25 + 500,
115
C_CXX_GOTO
= 26 + 500,
116
C_CXX_IF
= 27 + 500,
117
C_CXX_INLINE
= 28 + 500,
118
C_CXX_INT
= 29 + 500,
119
C_CXX_LONG
= 30 + 500,
120
C_CXX_MUTABLE
= 31 + 500,
121
C_CXX_NAMESPACE
= 32 + 500,
122
C_CXX_NEW
= 33 + 500,
123
C_CXX_OPERATOR
= 34 + 500,
124
C_CXX_PRIVATE
= 35 + 500,
125
C_CXX_PROTECTED
= 36 + 500,
126
C_CXX_PUBLIC
= 37 + 500,
127
C_CXX_REGISTER
= 38 + 500,
128
C_CXX_REINTERPRETCAST
= 39 + 500,
129
C_CXX_RETURN
= 40 + 500,
130
C_CXX_SHORT
= 41 + 500,
131
C_CXX_SIGNED
= 42 + 500,
132
C_CXX_SIZEOF
= 43 + 500,
133
C_CXX_STATIC
= 44 + 500,
134
C_CXX_STATICCAST
= 45 + 500,
135
C_CXX_STRUCT
= 46 + 500,
136
C_CXX_SWITCH
= 47 + 500,
137
C_CXX_TEMPLATE
= 48 + 500,
138
C_CXX_THIS
= 49 + 500,
139
C_CXX_THROW
= 50 + 500,
140
C_CXX_TRY
= 51 + 500,
141
C_CXX_TRUE
= 52 + 500,
142
C_CXX_TYPEDEF
= 53 + 500,
143
C_CXX_TYPEID
= 54 + 500,
144
C_CXX_TYPENAME
= 55 + 500,
145
C_CXX_UNION
= 56 + 500,
146
C_CXX_UNSIGNED
= 57 + 500,
147
C_CXX_USING
= 58 + 500,
148
C_CXX_VIRTUAL
= 59 + 500,
149
C_CXX_VOID
= 60 + 500,
150
C_CXX_VOLATILE
= 61 + 500,
151
C_CXX_WCHART
= 62 + 500,
152
C_CXX_WHILE
= 63 + 500
153
};
154
155
//the following are alternate tokens.
156
//Refer to page 12 of C++ STD
157
158
enum
ROSE_C_CXX_alternate_tok
159
{
160
C_CXX_LEFT_CURLY_ALT
,
// The <% which is the same as {
161
C_CXX_RIGHT_CURLY_ALT
,
//The %> which is the same as }
162
C_CXX_LEFT_SQUARE_ALT
,
//The <: which is the same as [
163
C_CXX_RIGHT_SQUARE_ALT
,
//The :> which is the same as ]
164
C_CXX_HASH_ALT
,
// The #
165
C_CXX_HASH_HASH_ALT
,
// The
166
C_CXX_and_ALT
,
// The #
167
};
168
169
enum
ROSE_C_CXX_Additional_Info
170
{
171
C_CXX_COMMENTS
= 0 + 100000,
172
C_CXX_STRING_LITERALS
= 1 + 100000,
173
C_CXX_IDENTIFIER
= 2 + 100000,
174
C_CXX_PREPROCESSING_INFO
= 3 + 100000,
175
C_CXX_UNIDENTIFIED_TOKEN
= 4 + 100000,
176
// DQ (10/12/2013): Added C_CXX_SYNTAX, C_CXX_WHITESPACE, and C_CXX_PRAGMA
177
C_CXX_SYNTAX
= 5 + 100000,
178
C_CXX_WHITESPACE
= 6 + 100000,
179
C_CXX_PRAGMA
= 7 + 100000,
180
C_CXX_ERROR
= 8 + 100000
181
};
182
183
};
184
185
186
struct
token_element
187
{
188
// This is the simplist contect of a Token
189
190
// value of the token
191
std::string
token_lexeme
;
192
193
// A token can also be an already processed CPP directive or comment (PreprocessingInfo)
194
// PreprocessingInfo* token_preprocessingInfo;
195
196
// The classification for the token (language dependent)
197
int
token_id
;
198
};
199
200
struct
file_pos_info
201
{
202
// Source code position information for token
203
int
line_num
;
204
int
column_num
;
205
};
206
207
// At some point I want to replace this with a SgToken
208
// IR node until then this is an intermediate step.
209
struct
stream_element
210
{
211
// This is the element in the token stream.
212
213
// This is the pointer to the token
214
struct
token_element
*
p_tok_elem
;
215
216
// The token stream can also include references to already processed CPP directives or comments (PreprocessingInfo)
217
PreprocessingInfo
*
p_preprocessingInfo
;
218
219
// Positon of the start of the token
220
struct
file_pos_info
beginning_fpi
;
221
222
// Position of the end of the token
223
struct
file_pos_info
ending_fpi
;
224
};
225
226
// At present this is an STL list, but I would like it to be a vector at some point
227
typedef
std::list<stream_element*>
LexTokenStreamType
;
228
typedef
LexTokenStreamType
*
LexTokenStreamTypePointer
;
229
230
// endif for ROSE_LEX_TOKEN_DEFINITIONS
231
#endif
rose-edg4x
src
frontend
SageIII
general_token_defs.h
Generated on Mon May 5 2014 17:29:23 for ROSE by
1.8.4