1 /*=============================================================================
2 Boost.Wave: A Standard compliant C++ preprocessor library
3 The definition of a default set of token identifiers and related
4 functions.
5
6 http://www.boost.org/
7
8 Copyright (c) 2001-2012 Hartmut Kaiser. Distributed under the Boost
9 Software License, Version 1.0. (See accompanying file
10 LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
11 =============================================================================*/
12
13 #if !defined(BOOST_TOKEN_IDS_HPP_414E9A58_F079_4789_8AFF_513815CE475B_INCLUDED)
14 #define BOOST_TOKEN_IDS_HPP_414E9A58_F079_4789_8AFF_513815CE475B_INCLUDED
15
16 #include <string>
17
18 #include <boost/wave/wave_config.hpp>
19
20 // this must occur after all of the includes and before any code appears
21 #ifdef BOOST_HAS_ABI_HEADERS
22 #include BOOST_ABI_PREFIX
23 #endif
24
25 ///////////////////////////////////////////////////////////////////////////////
26 // Allow external redefinition of the token identifiers to use
27 #if !defined(BOOST_WAVE_TOKEN_IDS_DEFINED)
28 #define BOOST_WAVE_TOKEN_IDS_DEFINED
29
30 #if (defined (__FreeBSD__) || defined (__DragonFly__) || defined (__OpenBSD__)) && defined (T_DIVIDE)
31 #undef T_DIVIDE
32 #endif
33
34 ///////////////////////////////////////////////////////////////////////////////
35 namespace boost {
36 namespace wave {
37
38 ///////////////////////////////////////////////////////////////////////////////
39 // assemble tokenids
40 #define TOKEN_FROM_ID(id, cat) ((id) | (cat))
41 #define ID_FROM_TOKEN(tok) ((tok) & ~TokenTypeMask)
42 #define BASEID_FROM_TOKEN(tok) ((tok) & ~ExtTokenTypeMask)
43
44 ///////////////////////////////////////////////////////////////////////////////
45 // the token_category helps to classify the different token types
46 enum token_category {
47 IdentifierTokenType = 0x08040000,
48 ParameterTokenType = 0x08840000,
49 ExtParameterTokenType = 0x088C0000,
50 OptParameterTokenType = 0x08940000,
51 KeywordTokenType = 0x10040000,
52 OperatorTokenType = 0x18040000,
53 LiteralTokenType = 0x20040000,
54 IntegerLiteralTokenType = 0x20840000,
55 FloatingLiteralTokenType = 0x21040000,
56 StringLiteralTokenType = 0x21840000,
57 CharacterLiteralTokenType = 0x22040000,
58 BoolLiteralTokenType = 0x22840000,
59 PPTokenType = 0x28040000,
60 PPConditionalTokenType = 0x28440000,
61
62 UnknownTokenType = 0x50000000,
63 EOLTokenType = 0x58000000,
64 EOFTokenType = 0x60000000,
65 WhiteSpaceTokenType = 0x68000000,
66 InternalTokenType = 0x70040000,
67
68 TokenTypeMask = 0x7F800000,
69 AltTokenType = 0x00080000,
70 TriGraphTokenType = 0x00100000,
71 AltExtTokenType = 0x00280000, // and, bit_and etc.
72 PPTokenFlag = 0x00040000, // these are 'real' pp-tokens
73 ExtTokenTypeMask = 0x7FF80000,
74 ExtTokenOnlyMask = 0x00780000,
75 TokenValueMask = 0x0007FFFF,
76 MainTokenMask = 0x7F87FFFF // TokenTypeMask|TokenValueMask
77 };
78
79 ///////////////////////////////////////////////////////////////////////////////
80 // the token_id assigns unique numbers to the different C++ lexemes
81 enum token_id {
82 T_UNKNOWN = 0,
83 T_FIRST_TOKEN = 256,
84 T_AND = TOKEN_FROM_ID(T_FIRST_TOKEN, OperatorTokenType),
85 T_AND_ALT = TOKEN_FROM_ID(T_FIRST_TOKEN, OperatorTokenType|AltExtTokenType),
86 T_ANDAND = TOKEN_FROM_ID(257, OperatorTokenType),
87 T_ANDAND_ALT = TOKEN_FROM_ID(257, OperatorTokenType|AltExtTokenType),
88 T_ASSIGN = TOKEN_FROM_ID(258, OperatorTokenType),
89 T_ANDASSIGN = TOKEN_FROM_ID(259, OperatorTokenType),
90 T_ANDASSIGN_ALT = TOKEN_FROM_ID(259, OperatorTokenType|AltExtTokenType),
91 T_OR = TOKEN_FROM_ID(260, OperatorTokenType),
92 T_OR_ALT = TOKEN_FROM_ID(260, OperatorTokenType|AltExtTokenType),
93 T_OR_TRIGRAPH = TOKEN_FROM_ID(260, OperatorTokenType|TriGraphTokenType),
94 T_ORASSIGN = TOKEN_FROM_ID(261, OperatorTokenType),
95 T_ORASSIGN_ALT = TOKEN_FROM_ID(261, OperatorTokenType|AltExtTokenType),
96 T_ORASSIGN_TRIGRAPH = TOKEN_FROM_ID(261, OperatorTokenType|TriGraphTokenType),
97 T_XOR = TOKEN_FROM_ID(262, OperatorTokenType),
98 T_XOR_ALT = TOKEN_FROM_ID(262, OperatorTokenType|AltExtTokenType),
99 T_XOR_TRIGRAPH = TOKEN_FROM_ID(262, OperatorTokenType|TriGraphTokenType),
100 T_XORASSIGN = TOKEN_FROM_ID(263, OperatorTokenType),
101 T_XORASSIGN_ALT = TOKEN_FROM_ID(263, OperatorTokenType|AltExtTokenType),
102 T_XORASSIGN_TRIGRAPH = TOKEN_FROM_ID(263, OperatorTokenType|TriGraphTokenType),
103 T_COMMA = TOKEN_FROM_ID(264, OperatorTokenType),
104 T_COLON = TOKEN_FROM_ID(265, OperatorTokenType),
105 T_DIVIDE = TOKEN_FROM_ID(266, OperatorTokenType),
106 T_DIVIDEASSIGN = TOKEN_FROM_ID(267, OperatorTokenType),
107 T_DOT = TOKEN_FROM_ID(268, OperatorTokenType),
108 T_DOTSTAR = TOKEN_FROM_ID(269, OperatorTokenType),
109 T_ELLIPSIS = TOKEN_FROM_ID(270, OperatorTokenType),
110 T_EQUAL = TOKEN_FROM_ID(271, OperatorTokenType),
111 T_GREATER = TOKEN_FROM_ID(272, OperatorTokenType),
112 T_GREATEREQUAL = TOKEN_FROM_ID(273, OperatorTokenType),
113 T_LEFTBRACE = TOKEN_FROM_ID(274, OperatorTokenType),
114 T_LEFTBRACE_ALT = TOKEN_FROM_ID(274, OperatorTokenType|AltTokenType),
115 T_LEFTBRACE_TRIGRAPH = TOKEN_FROM_ID(274, OperatorTokenType|TriGraphTokenType),
116 T_LESS = TOKEN_FROM_ID(275, OperatorTokenType),
117 T_LESSEQUAL = TOKEN_FROM_ID(276, OperatorTokenType),
118 T_LEFTPAREN = TOKEN_FROM_ID(277, OperatorTokenType),
119 T_LEFTBRACKET = TOKEN_FROM_ID(278, OperatorTokenType),
120 T_LEFTBRACKET_ALT = TOKEN_FROM_ID(278, OperatorTokenType|AltTokenType),
121 T_LEFTBRACKET_TRIGRAPH = TOKEN_FROM_ID(278, OperatorTokenType|TriGraphTokenType),
122 T_MINUS = TOKEN_FROM_ID(279, OperatorTokenType),
123 T_MINUSASSIGN = TOKEN_FROM_ID(280, OperatorTokenType),
124 T_MINUSMINUS = TOKEN_FROM_ID(281, OperatorTokenType),
125 T_PERCENT = TOKEN_FROM_ID(282, OperatorTokenType),
126 T_PERCENTASSIGN = TOKEN_FROM_ID(283, OperatorTokenType),
127 T_NOT = TOKEN_FROM_ID(284, OperatorTokenType),
128 T_NOT_ALT = TOKEN_FROM_ID(284, OperatorTokenType|AltExtTokenType),
129 T_NOTEQUAL = TOKEN_FROM_ID(285, OperatorTokenType),
130 T_NOTEQUAL_ALT = TOKEN_FROM_ID(285, OperatorTokenType|AltExtTokenType),
131 T_OROR = TOKEN_FROM_ID(286, OperatorTokenType),
132 T_OROR_ALT = TOKEN_FROM_ID(286, OperatorTokenType|AltExtTokenType),
133 T_OROR_TRIGRAPH = TOKEN_FROM_ID(286, OperatorTokenType|TriGraphTokenType),
134 T_PLUS = TOKEN_FROM_ID(287, OperatorTokenType),
135 T_PLUSASSIGN = TOKEN_FROM_ID(288, OperatorTokenType),
136 T_PLUSPLUS = TOKEN_FROM_ID(289, OperatorTokenType),
137 T_ARROW = TOKEN_FROM_ID(290, OperatorTokenType),
138 T_ARROWSTAR = TOKEN_FROM_ID(291, OperatorTokenType),
139 T_QUESTION_MARK = TOKEN_FROM_ID(292, OperatorTokenType),
140 T_RIGHTBRACE = TOKEN_FROM_ID(293, OperatorTokenType),
141 T_RIGHTBRACE_ALT = TOKEN_FROM_ID(293, OperatorTokenType|AltTokenType),
142 T_RIGHTBRACE_TRIGRAPH = TOKEN_FROM_ID(293, OperatorTokenType|TriGraphTokenType),
143 T_RIGHTPAREN = TOKEN_FROM_ID(294, OperatorTokenType),
144 T_RIGHTBRACKET = TOKEN_FROM_ID(295, OperatorTokenType),
145 T_RIGHTBRACKET_ALT = TOKEN_FROM_ID(295, OperatorTokenType|AltTokenType),
146 T_RIGHTBRACKET_TRIGRAPH = TOKEN_FROM_ID(295, OperatorTokenType|TriGraphTokenType),
147 T_COLON_COLON = TOKEN_FROM_ID(296, OperatorTokenType),
148 T_SEMICOLON = TOKEN_FROM_ID(297, OperatorTokenType),
149 T_SHIFTLEFT = TOKEN_FROM_ID(298, OperatorTokenType),
150 T_SHIFTLEFTASSIGN = TOKEN_FROM_ID(299, OperatorTokenType),
151 T_SHIFTRIGHT = TOKEN_FROM_ID(300, OperatorTokenType),
152 T_SHIFTRIGHTASSIGN = TOKEN_FROM_ID(301, OperatorTokenType),
153 T_STAR = TOKEN_FROM_ID(302, OperatorTokenType),
154 T_COMPL = TOKEN_FROM_ID(303, OperatorTokenType),
155 T_COMPL_ALT = TOKEN_FROM_ID(303, OperatorTokenType|AltExtTokenType),
156 T_COMPL_TRIGRAPH = TOKEN_FROM_ID(303, OperatorTokenType|TriGraphTokenType),
157 T_STARASSIGN = TOKEN_FROM_ID(304, OperatorTokenType),
158 T_ASM = TOKEN_FROM_ID(305, KeywordTokenType),
159 T_AUTO = TOKEN_FROM_ID(306, KeywordTokenType),
160 T_BOOL = TOKEN_FROM_ID(307, KeywordTokenType),
161 T_FALSE = TOKEN_FROM_ID(308, BoolLiteralTokenType),
162 T_TRUE = TOKEN_FROM_ID(309, BoolLiteralTokenType),
163 T_BREAK = TOKEN_FROM_ID(310, KeywordTokenType),
164 T_CASE = TOKEN_FROM_ID(311, KeywordTokenType),
165 T_CATCH = TOKEN_FROM_ID(312, KeywordTokenType),
166 T_CHAR = TOKEN_FROM_ID(313, KeywordTokenType),
167 T_CLASS = TOKEN_FROM_ID(314, KeywordTokenType),
168 T_CONST = TOKEN_FROM_ID(315, KeywordTokenType),
169 T_CONSTCAST = TOKEN_FROM_ID(316, KeywordTokenType),
170 T_CONTINUE = TOKEN_FROM_ID(317, KeywordTokenType),
171 T_DEFAULT = TOKEN_FROM_ID(318, KeywordTokenType),
172 T_DELETE = TOKEN_FROM_ID(319, KeywordTokenType),
173 T_DO = TOKEN_FROM_ID(320, KeywordTokenType),
174 T_DOUBLE = TOKEN_FROM_ID(321, KeywordTokenType),
175 T_DYNAMICCAST = TOKEN_FROM_ID(322, KeywordTokenType),
176 T_ELSE = TOKEN_FROM_ID(323, KeywordTokenType),
177 T_ENUM = TOKEN_FROM_ID(324, KeywordTokenType),
178 T_EXPLICIT = TOKEN_FROM_ID(325, KeywordTokenType),
179 T_EXPORT = TOKEN_FROM_ID(326, KeywordTokenType),
180 T_EXTERN = TOKEN_FROM_ID(327, KeywordTokenType),
181 T_FLOAT = TOKEN_FROM_ID(328, KeywordTokenType),
182 T_FOR = TOKEN_FROM_ID(329, KeywordTokenType),
183 T_FRIEND = TOKEN_FROM_ID(330, KeywordTokenType),
184 T_GOTO = TOKEN_FROM_ID(331, KeywordTokenType),
185 T_IF = TOKEN_FROM_ID(332, KeywordTokenType),
186 T_INLINE = TOKEN_FROM_ID(333, KeywordTokenType),
187 T_INT = TOKEN_FROM_ID(334, KeywordTokenType),
188 T_LONG = TOKEN_FROM_ID(335, KeywordTokenType),
189 T_MUTABLE = TOKEN_FROM_ID(336, KeywordTokenType),
190 T_NAMESPACE = TOKEN_FROM_ID(337, KeywordTokenType),
191 T_NEW = TOKEN_FROM_ID(338, KeywordTokenType),
192 T_OPERATOR = TOKEN_FROM_ID(339, KeywordTokenType),
193 T_PRIVATE = TOKEN_FROM_ID(340, KeywordTokenType),
194 T_PROTECTED = TOKEN_FROM_ID(341, KeywordTokenType),
195 T_PUBLIC = TOKEN_FROM_ID(342, KeywordTokenType),
196 T_REGISTER = TOKEN_FROM_ID(343, KeywordTokenType),
197 T_REINTERPRETCAST = TOKEN_FROM_ID(344, KeywordTokenType),
198 T_RETURN = TOKEN_FROM_ID(345, KeywordTokenType),
199 T_SHORT = TOKEN_FROM_ID(346, KeywordTokenType),
200 T_SIGNED = TOKEN_FROM_ID(347, KeywordTokenType),
201 T_SIZEOF = TOKEN_FROM_ID(348, KeywordTokenType),
202 T_STATIC = TOKEN_FROM_ID(349, KeywordTokenType),
203 T_STATICCAST = TOKEN_FROM_ID(350, KeywordTokenType),
204 T_STRUCT = TOKEN_FROM_ID(351, KeywordTokenType),
205 T_SWITCH = TOKEN_FROM_ID(352, KeywordTokenType),
206 T_TEMPLATE = TOKEN_FROM_ID(353, KeywordTokenType),
207 T_THIS = TOKEN_FROM_ID(354, KeywordTokenType),
208 T_THROW = TOKEN_FROM_ID(355, KeywordTokenType),
209 T_TRY = TOKEN_FROM_ID(356, KeywordTokenType),
210 T_TYPEDEF = TOKEN_FROM_ID(357, KeywordTokenType),
211 T_TYPEID = TOKEN_FROM_ID(358, KeywordTokenType),
212 T_TYPENAME = TOKEN_FROM_ID(359, KeywordTokenType),
213 T_UNION = TOKEN_FROM_ID(360, KeywordTokenType),
214 T_UNSIGNED = TOKEN_FROM_ID(361, KeywordTokenType),
215 T_USING = TOKEN_FROM_ID(362, KeywordTokenType),
216 T_VIRTUAL = TOKEN_FROM_ID(363, KeywordTokenType),
217 T_VOID = TOKEN_FROM_ID(364, KeywordTokenType),
218 T_VOLATILE = TOKEN_FROM_ID(365, KeywordTokenType),
219 T_WCHART = TOKEN_FROM_ID(366, KeywordTokenType),
220 T_WHILE = TOKEN_FROM_ID(367, KeywordTokenType),
221 T_PP_DEFINE = TOKEN_FROM_ID(368, PPTokenType),
222 T_PP_IF = TOKEN_FROM_ID(369, PPConditionalTokenType),
223 T_PP_IFDEF = TOKEN_FROM_ID(370, PPConditionalTokenType),
224 T_PP_IFNDEF = TOKEN_FROM_ID(371, PPConditionalTokenType),
225 T_PP_ELSE = TOKEN_FROM_ID(372, PPConditionalTokenType),
226 T_PP_ELIF = TOKEN_FROM_ID(373, PPConditionalTokenType),
227 T_PP_ENDIF = TOKEN_FROM_ID(374, PPConditionalTokenType),
228 T_PP_ERROR = TOKEN_FROM_ID(375, PPTokenType),
229 T_PP_LINE = TOKEN_FROM_ID(376, PPTokenType),
230 T_PP_PRAGMA = TOKEN_FROM_ID(377, PPTokenType),
231 T_PP_UNDEF = TOKEN_FROM_ID(378, PPTokenType),
232 T_PP_WARNING = TOKEN_FROM_ID(379, PPTokenType),
233 T_IDENTIFIER = TOKEN_FROM_ID(380, IdentifierTokenType),
234 T_OCTALINT = TOKEN_FROM_ID(381, IntegerLiteralTokenType),
235 T_DECIMALINT = TOKEN_FROM_ID(382, IntegerLiteralTokenType),
236 T_HEXAINT = TOKEN_FROM_ID(383, IntegerLiteralTokenType),
237 T_INTLIT = TOKEN_FROM_ID(384, IntegerLiteralTokenType),
238 T_LONGINTLIT = TOKEN_FROM_ID(385, IntegerLiteralTokenType),
239 T_FLOATLIT = TOKEN_FROM_ID(386, FloatingLiteralTokenType),
240 T_FIXEDPOINTLIT = TOKEN_FROM_ID(386, FloatingLiteralTokenType|AltTokenType), // IDL specific
241 T_CCOMMENT = TOKEN_FROM_ID(387, WhiteSpaceTokenType|AltTokenType),
242 T_CPPCOMMENT = TOKEN_FROM_ID(388, WhiteSpaceTokenType|AltTokenType),
243 T_CHARLIT = TOKEN_FROM_ID(389, CharacterLiteralTokenType),
244 T_STRINGLIT = TOKEN_FROM_ID(390, StringLiteralTokenType),
245 T_CONTLINE = TOKEN_FROM_ID(391, EOLTokenType),
246 T_SPACE = TOKEN_FROM_ID(392, WhiteSpaceTokenType),
247 T_SPACE2 = TOKEN_FROM_ID(393, WhiteSpaceTokenType),
248 T_NEWLINE = TOKEN_FROM_ID(394, EOLTokenType),
249 T_GENERATEDNEWLINE = TOKEN_FROM_ID(394, EOLTokenType|AltTokenType),
250 T_POUND_POUND = TOKEN_FROM_ID(395, OperatorTokenType),
251 T_POUND_POUND_ALT = TOKEN_FROM_ID(395, OperatorTokenType|AltTokenType),
252 T_POUND_POUND_TRIGRAPH = TOKEN_FROM_ID(395, OperatorTokenType|TriGraphTokenType),
253 T_POUND = TOKEN_FROM_ID(396, OperatorTokenType),
254 T_POUND_ALT = TOKEN_FROM_ID(396, OperatorTokenType|AltTokenType),
255 T_POUND_TRIGRAPH = TOKEN_FROM_ID(396, OperatorTokenType|TriGraphTokenType),
256 T_ANY = TOKEN_FROM_ID(397, UnknownTokenType),
257 T_ANY_TRIGRAPH = TOKEN_FROM_ID(397, UnknownTokenType|TriGraphTokenType),
258 T_PP_INCLUDE = TOKEN_FROM_ID(398, PPTokenType),
259 T_PP_QHEADER = TOKEN_FROM_ID(399, PPTokenType),
260 T_PP_HHEADER = TOKEN_FROM_ID(400, PPTokenType),
261 T_PP_INCLUDE_NEXT = TOKEN_FROM_ID(398, PPTokenType|AltTokenType),
262 T_PP_QHEADER_NEXT = TOKEN_FROM_ID(399, PPTokenType|AltTokenType),
263 T_PP_HHEADER_NEXT = TOKEN_FROM_ID(400, PPTokenType|AltTokenType),
264 T_EOF = TOKEN_FROM_ID(401, EOFTokenType), // end of file reached
265 T_EOI = TOKEN_FROM_ID(402, EOFTokenType), // end of input reached
266 T_PP_NUMBER = TOKEN_FROM_ID(403, InternalTokenType),
267
268 // MS extensions
269 T_MSEXT_INT8 = TOKEN_FROM_ID(404, KeywordTokenType),
270 T_MSEXT_INT16 = TOKEN_FROM_ID(405, KeywordTokenType),
271 T_MSEXT_INT32 = TOKEN_FROM_ID(406, KeywordTokenType),
272 T_MSEXT_INT64 = TOKEN_FROM_ID(407, KeywordTokenType),
273 T_MSEXT_BASED = TOKEN_FROM_ID(408, KeywordTokenType),
274 T_MSEXT_DECLSPEC = TOKEN_FROM_ID(409, KeywordTokenType),
275 T_MSEXT_CDECL = TOKEN_FROM_ID(410, KeywordTokenType),
276 T_MSEXT_FASTCALL = TOKEN_FROM_ID(411, KeywordTokenType),
277 T_MSEXT_STDCALL = TOKEN_FROM_ID(412, KeywordTokenType),
278 T_MSEXT_TRY = TOKEN_FROM_ID(413, KeywordTokenType),
279 T_MSEXT_EXCEPT = TOKEN_FROM_ID(414, KeywordTokenType),
280 T_MSEXT_FINALLY = TOKEN_FROM_ID(415, KeywordTokenType),
281 T_MSEXT_LEAVE = TOKEN_FROM_ID(416, KeywordTokenType),
282 T_MSEXT_INLINE = TOKEN_FROM_ID(417, KeywordTokenType),
283 T_MSEXT_ASM = TOKEN_FROM_ID(418, KeywordTokenType),
284
285 T_MSEXT_PP_REGION = TOKEN_FROM_ID(419, PPTokenType),
286 T_MSEXT_PP_ENDREGION = TOKEN_FROM_ID(420, PPTokenType),
287
288 // import is needed to be a keyword for the C++ module Standards proposal
289 T_IMPORT = TOKEN_FROM_ID(421, KeywordTokenType),
290
291 // C++11 keywords
292 T_ALIGNAS = TOKEN_FROM_ID(422, KeywordTokenType),
293 T_ALIGNOF = TOKEN_FROM_ID(423, KeywordTokenType),
294 T_CHAR16_T = TOKEN_FROM_ID(424, KeywordTokenType),
295 T_CHAR32_T = TOKEN_FROM_ID(425, KeywordTokenType),
296 T_CONSTEXPR = TOKEN_FROM_ID(426, KeywordTokenType),
297 T_DECLTYPE = TOKEN_FROM_ID(427, KeywordTokenType),
298 T_NOEXCEPT = TOKEN_FROM_ID(428, KeywordTokenType),
299 T_NULLPTR = TOKEN_FROM_ID(429, KeywordTokenType),
300 T_STATICASSERT = TOKEN_FROM_ID(430, KeywordTokenType),
301 T_THREADLOCAL = TOKEN_FROM_ID(431, KeywordTokenType),
302 T_RAWSTRINGLIT = TOKEN_FROM_ID(432, StringLiteralTokenType),
303
304 T_LAST_TOKEN_ID,
305 T_LAST_TOKEN = ID_FROM_TOKEN(T_LAST_TOKEN_ID & ~PPTokenFlag),
306
307 T_UNKNOWN_UNIVERSALCHAR = TOKEN_FROM_ID('\\', UnknownTokenType),
308
309 // pseudo tokens to help streamlining macro replacement, these should not
310 // returned from the lexer nor should these be returned from the pp-iterator
311 T_NONREPLACABLE_IDENTIFIER = TOKEN_FROM_ID(T_LAST_TOKEN+1, IdentifierTokenType),
312 T_PLACEHOLDER = TOKEN_FROM_ID(T_LAST_TOKEN+2, WhiteSpaceTokenType),
313 T_PLACEMARKER = TOKEN_FROM_ID(T_LAST_TOKEN+3, InternalTokenType),
314 T_PARAMETERBASE = TOKEN_FROM_ID(T_LAST_TOKEN+4, ParameterTokenType),
315 T_EXTPARAMETERBASE = TOKEN_FROM_ID(T_LAST_TOKEN+4, ExtParameterTokenType),
316 T_OPTPARAMETERBASE = TOKEN_FROM_ID(T_LAST_TOKEN+4, OptParameterTokenType)
317 };
318
319 ///////////////////////////////////////////////////////////////////////////////
320 // redefine the TOKEN_FROM_ID macro to be more type safe
321 #undef TOKEN_FROM_ID
322 #define TOKEN_FROM_ID(id, cat) boost::wave::token_id((id) | (cat))
323
324 #undef ID_FROM_TOKEN
325 #define ID_FROM_TOKEN(tok) \
326 boost::wave::token_id((tok) & \
327 ~(boost::wave::TokenTypeMask|boost::wave::PPTokenFlag)) \
328 /**/
329
330 #undef BASEID_FROM_TOKEN
331 #define BASEID_FROM_TOKEN(tok) \
332 boost::wave::token_id((tok) & \
333 ~(boost::wave::ExtTokenTypeMask|boost::wave::PPTokenFlag)) \
334 /**/
335 #define BASE_TOKEN(tok) \
336 boost::wave::token_id((tok) & boost::wave::MainTokenMask) \
337 /**/
338 #define CATEGORY_FROM_TOKEN(tok) ((tok) & boost::wave::TokenTypeMask)
339 #define EXTCATEGORY_FROM_TOKEN(tok) ((tok) & boost::wave::ExtTokenTypeMask)
340 #define IS_CATEGORY(tok, cat) \
341 ((CATEGORY_FROM_TOKEN(tok) == CATEGORY_FROM_TOKEN(cat)) ? true : false) \
342 /**/
343 #define IS_EXTCATEGORY(tok, cat) \
344 ((EXTCATEGORY_FROM_TOKEN(tok) == EXTCATEGORY_FROM_TOKEN(cat)) ? true : false) \
345 /**/
346
347 ///////////////////////////////////////////////////////////////////////////////
348 // verify whether the given token(-id) represents a valid pp_token
is_pp_token(boost::wave::token_id id)349 inline bool is_pp_token(boost::wave::token_id id)
350 {
351 return (id & boost::wave::PPTokenFlag) ? true : false;
352 }
353
354 template <typename TokenT>
is_pp_token(TokenT const & tok)355 inline bool is_pp_token(TokenT const& tok)
356 {
357 return is_pp_token(boost::wave::token_id(tok));
358 }
359
360 ///////////////////////////////////////////////////////////////////////////////
361 // return a token name
362 BOOST_WAVE_DECL
363 BOOST_WAVE_STRINGTYPE get_token_name(token_id tokid);
364
365 ///////////////////////////////////////////////////////////////////////////////
366 // return a token name
367 BOOST_WAVE_DECL
368 char const *get_token_value(token_id tokid);
369
370 ///////////////////////////////////////////////////////////////////////////////
371 } // namespace wave
372 } // namespace boost
373
374 #endif // #if !defined(BOOST_WAVE_TOKEN_IDS_DEFINED)
375
376 // the suffix header occurs after all of the code
377 #ifdef BOOST_HAS_ABI_HEADERS
378 #include BOOST_ABI_SUFFIX
379 #endif
380
381 #endif // !defined(BOOST_TOKEN_IDS_HPP_414E9A58_F079_4789_8AFF_513815CE475B_INCLUDED)
382
383