token_ids.hpp 21 KB

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