| 1 | /**************************************************************************** | 
|---|
| 2 | ** | 
|---|
| 3 | ** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). | 
|---|
| 4 | ** Contact: Qt Software Information (qt-info@nokia.com) | 
|---|
| 5 | ** | 
|---|
| 6 | ** This file is part of the tools applications of the Qt Toolkit. | 
|---|
| 7 | ** | 
|---|
| 8 | ** $QT_BEGIN_LICENSE:LGPL$ | 
|---|
| 9 | ** Commercial Usage | 
|---|
| 10 | ** Licensees holding valid Qt Commercial licenses may use this file in | 
|---|
| 11 | ** accordance with the Qt Commercial License Agreement provided with the | 
|---|
| 12 | ** Software or, alternatively, in accordance with the terms contained in | 
|---|
| 13 | ** a written agreement between you and Nokia. | 
|---|
| 14 | ** | 
|---|
| 15 | ** GNU Lesser General Public License Usage | 
|---|
| 16 | ** Alternatively, this file may be used under the terms of the GNU Lesser | 
|---|
| 17 | ** General Public License version 2.1 as published by the Free Software | 
|---|
| 18 | ** Foundation and appearing in the file LICENSE.LGPL included in the | 
|---|
| 19 | ** packaging of this file.  Please review the following information to | 
|---|
| 20 | ** ensure the GNU Lesser General Public License version 2.1 requirements | 
|---|
| 21 | ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. | 
|---|
| 22 | ** | 
|---|
| 23 | ** In addition, as a special exception, Nokia gives you certain | 
|---|
| 24 | ** additional rights. These rights are described in the Nokia Qt LGPL | 
|---|
| 25 | ** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this | 
|---|
| 26 | ** package. | 
|---|
| 27 | ** | 
|---|
| 28 | ** GNU General Public License Usage | 
|---|
| 29 | ** Alternatively, this file may be used under the terms of the GNU | 
|---|
| 30 | ** General Public License version 3.0 as published by the Free Software | 
|---|
| 31 | ** Foundation and appearing in the file LICENSE.GPL included in the | 
|---|
| 32 | ** packaging of this file.  Please review the following information to | 
|---|
| 33 | ** ensure the GNU General Public License version 3.0 requirements will be | 
|---|
| 34 | ** met: http://www.gnu.org/copyleft/gpl.html. | 
|---|
| 35 | ** | 
|---|
| 36 | ** If you are unsure which license is appropriate for your use, please | 
|---|
| 37 | ** contact the sales department at qt-sales@nokia.com. | 
|---|
| 38 | ** $QT_END_LICENSE$ | 
|---|
| 39 | ** | 
|---|
| 40 | ****************************************************************************/ | 
|---|
| 41 |  | 
|---|
| 42 | #ifndef TOKEN_H | 
|---|
| 43 | #define TOKEN_H | 
|---|
| 44 |  | 
|---|
| 45 | #include <QtCore/qglobal.h> | 
|---|
| 46 |  | 
|---|
| 47 | QT_BEGIN_NAMESPACE | 
|---|
| 48 |  | 
|---|
| 49 | enum Token { | 
|---|
| 50 | NOTOKEN, | 
|---|
| 51 | IDENTIFIER, | 
|---|
| 52 | INTEGER_LITERAL, | 
|---|
| 53 | CHARACTER_LITERAL, | 
|---|
| 54 | STRING_LITERAL, | 
|---|
| 55 | BOOLEAN_LITERAL, | 
|---|
| 56 | HEADER_NAME, | 
|---|
| 57 | LANGLE, | 
|---|
| 58 | RANGLE, | 
|---|
| 59 | LPAREN, | 
|---|
| 60 | RPAREN, | 
|---|
| 61 | ELIPSIS, | 
|---|
| 62 | LBRACK, | 
|---|
| 63 | RBRACK, | 
|---|
| 64 | LBRACE, | 
|---|
| 65 | RBRACE, | 
|---|
| 66 | EQ, | 
|---|
| 67 | SCOPE, | 
|---|
| 68 | SEMIC, | 
|---|
| 69 | COLON, | 
|---|
| 70 | DOTSTAR, | 
|---|
| 71 | QUESTION, | 
|---|
| 72 | DOT, | 
|---|
| 73 | DYNAMIC_CAST, | 
|---|
| 74 | STATIC_CAST, | 
|---|
| 75 | REINTERPRET_CAST, | 
|---|
| 76 | CONST_CAST, | 
|---|
| 77 | TYPEID, | 
|---|
| 78 | THIS, | 
|---|
| 79 | TEMPLATE, | 
|---|
| 80 | THROW, | 
|---|
| 81 | TRY, | 
|---|
| 82 | CATCH, | 
|---|
| 83 | TYPEDEF, | 
|---|
| 84 | FRIEND, | 
|---|
| 85 | CLASS, | 
|---|
| 86 | NAMESPACE, | 
|---|
| 87 | ENUM, | 
|---|
| 88 | STRUCT, | 
|---|
| 89 | UNION, | 
|---|
| 90 | VIRTUAL, | 
|---|
| 91 | PRIVATE, | 
|---|
| 92 | PROTECTED, | 
|---|
| 93 | PUBLIC, | 
|---|
| 94 | EXPORT, | 
|---|
| 95 | AUTO, | 
|---|
| 96 | REGISTER, | 
|---|
| 97 | EXTERN, | 
|---|
| 98 | MUTABLE, | 
|---|
| 99 | ASM, | 
|---|
| 100 | USING, | 
|---|
| 101 | INLINE, | 
|---|
| 102 | EXPLICIT, | 
|---|
| 103 | STATIC, | 
|---|
| 104 | CONST, | 
|---|
| 105 | VOLATILE, | 
|---|
| 106 | OPERATOR, | 
|---|
| 107 | SIZEOF, | 
|---|
| 108 | NEW, | 
|---|
| 109 | DELETE, | 
|---|
| 110 | PLUS, | 
|---|
| 111 | MINUS, | 
|---|
| 112 | STAR, | 
|---|
| 113 | SLASH, | 
|---|
| 114 | PERCENT, | 
|---|
| 115 | HAT, | 
|---|
| 116 | AND, | 
|---|
| 117 | OR, | 
|---|
| 118 | TILDE, | 
|---|
| 119 | NOT, | 
|---|
| 120 | PLUS_EQ, | 
|---|
| 121 | MINUS_EQ, | 
|---|
| 122 | STAR_EQ, | 
|---|
| 123 | SLASH_EQ, | 
|---|
| 124 | PERCENT_EQ, | 
|---|
| 125 | HAT_EQ, | 
|---|
| 126 | AND_EQ, | 
|---|
| 127 | OR_EQ, | 
|---|
| 128 | LTLT, | 
|---|
| 129 | GTGT, | 
|---|
| 130 | GTGT_EQ, | 
|---|
| 131 | LTLT_EQ, | 
|---|
| 132 | EQEQ, | 
|---|
| 133 | NE, | 
|---|
| 134 | LE, | 
|---|
| 135 | GE, | 
|---|
| 136 | ANDAND, | 
|---|
| 137 | OROR, | 
|---|
| 138 | INCR, | 
|---|
| 139 | DECR, | 
|---|
| 140 | COMMA, | 
|---|
| 141 | ARROW_STAR, | 
|---|
| 142 | ARROW, | 
|---|
| 143 | CHAR, | 
|---|
| 144 | WCHAR, | 
|---|
| 145 | BOOL, | 
|---|
| 146 | SHORT, | 
|---|
| 147 | INT, | 
|---|
| 148 | LONG, | 
|---|
| 149 | SIGNED, | 
|---|
| 150 | UNSIGNED, | 
|---|
| 151 | FLOAT, | 
|---|
| 152 | DOUBLE, | 
|---|
| 153 | VOID, | 
|---|
| 154 | CASE, | 
|---|
| 155 | DEFAULT, | 
|---|
| 156 | IF, | 
|---|
| 157 | ELSE, | 
|---|
| 158 | SWITCH, | 
|---|
| 159 | WHILE, | 
|---|
| 160 | DO, | 
|---|
| 161 | FOR, | 
|---|
| 162 | BREAK, | 
|---|
| 163 | CONTINUE, | 
|---|
| 164 | GOTO, | 
|---|
| 165 | SIGNALS, | 
|---|
| 166 | SLOTS, | 
|---|
| 167 | RETURN, | 
|---|
| 168 | Q_META_TOKEN_BEGIN, | 
|---|
| 169 | Q_OBJECT_TOKEN = Q_META_TOKEN_BEGIN, | 
|---|
| 170 | Q_GADGET_TOKEN, | 
|---|
| 171 | Q_PROPERTY_TOKEN, | 
|---|
| 172 | Q_ENUMS_TOKEN, | 
|---|
| 173 | Q_FLAGS_TOKEN, | 
|---|
| 174 | Q_DECLARE_FLAGS_TOKEN, | 
|---|
| 175 | Q_DECLARE_INTERFACE_TOKEN, | 
|---|
| 176 | Q_DECLARE_METATYPE_TOKEN, | 
|---|
| 177 | Q_CLASSINFO_TOKEN, | 
|---|
| 178 | Q_INTERFACES_TOKEN, | 
|---|
| 179 | Q_SIGNALS_TOKEN, | 
|---|
| 180 | Q_SLOTS_TOKEN, | 
|---|
| 181 | Q_SIGNAL_TOKEN, | 
|---|
| 182 | Q_SLOT_TOKEN, | 
|---|
| 183 | Q_PRIVATE_SLOT_TOKEN, | 
|---|
| 184 | Q_MOC_COMPAT_TOKEN, | 
|---|
| 185 | Q_QT3_SUPPORT_TOKEN, | 
|---|
| 186 | Q_INVOKABLE_TOKEN, | 
|---|
| 187 | Q_SCRIPTABLE_TOKEN, | 
|---|
| 188 | Q_META_TOKEN_END, | 
|---|
| 189 | SPECIAL_TREATMENT_MARK = Q_META_TOKEN_END, | 
|---|
| 190 | MOC_INCLUDE_BEGIN, | 
|---|
| 191 | MOC_INCLUDE_END, | 
|---|
| 192 | CPP_COMMENT, | 
|---|
| 193 | C_COMMENT, | 
|---|
| 194 | FLOATING_LITERAL, | 
|---|
| 195 | HASH, | 
|---|
| 196 | QUOTE, | 
|---|
| 197 | SINGLEQUOTE, | 
|---|
| 198 | LANGLE_SCOPE, | 
|---|
| 199 | DIGIT, | 
|---|
| 200 | CHARACTER, | 
|---|
| 201 | NEWLINE, | 
|---|
| 202 | WHITESPACE, | 
|---|
| 203 | BACKSLASH, | 
|---|
| 204 | INCOMPLETE, | 
|---|
| 205 |  | 
|---|
| 206 | PP_DEFINE, | 
|---|
| 207 | PP_UNDEF, | 
|---|
| 208 | PP_IF, | 
|---|
| 209 | PP_IFDEF, | 
|---|
| 210 | PP_IFNDEF, | 
|---|
| 211 | PP_ELIF, | 
|---|
| 212 | PP_ELSE, | 
|---|
| 213 | PP_ENDIF, | 
|---|
| 214 | PP_INCLUDE, | 
|---|
| 215 | PP_HASHHASH, | 
|---|
| 216 | PP_HASH, | 
|---|
| 217 | PP_DEFINED, | 
|---|
| 218 | PP_INCOMPLETE, | 
|---|
| 219 |  | 
|---|
| 220 | PP_MOC_TRUE, | 
|---|
| 221 | PP_MOC_FALSE, | 
|---|
| 222 |  | 
|---|
| 223 | PP_NOTOKEN = NOTOKEN, | 
|---|
| 224 | PP_IDENTIFIER = IDENTIFIER, | 
|---|
| 225 | PP_INTEGER_LITERAL = INTEGER_LITERAL, | 
|---|
| 226 | PP_CHARACTER_LITERAL = CHARACTER_LITERAL, | 
|---|
| 227 | PP_STRING_LITERAL = STRING_LITERAL, | 
|---|
| 228 | PP_LANGLE = LANGLE, | 
|---|
| 229 | PP_RANGLE = RANGLE, | 
|---|
| 230 | PP_LPAREN = LPAREN, | 
|---|
| 231 | PP_RPAREN = RPAREN, | 
|---|
| 232 | PP_COMMA = COMMA, | 
|---|
| 233 | PP_PLUS = PLUS, | 
|---|
| 234 | PP_MINUS = MINUS, | 
|---|
| 235 | PP_STAR = STAR, | 
|---|
| 236 | PP_SLASH = SLASH, | 
|---|
| 237 | PP_PERCENT = PERCENT, | 
|---|
| 238 | PP_HAT = HAT, | 
|---|
| 239 | PP_AND = AND, | 
|---|
| 240 | PP_OR = OR, | 
|---|
| 241 | PP_TILDE = TILDE, | 
|---|
| 242 | PP_NOT = NOT, | 
|---|
| 243 | PP_LTLT = LTLT, | 
|---|
| 244 | PP_GTGT = GTGT, | 
|---|
| 245 | PP_EQEQ = EQEQ, | 
|---|
| 246 | PP_NE = NE, | 
|---|
| 247 | PP_LE = LE, | 
|---|
| 248 | PP_GE = GE, | 
|---|
| 249 | PP_ANDAND = ANDAND, | 
|---|
| 250 | PP_OROR = OROR, | 
|---|
| 251 | PP_QUESTION = QUESTION, | 
|---|
| 252 | PP_COLON = COLON, | 
|---|
| 253 | PP_FLOATING_LITERAL = FLOATING_LITERAL, | 
|---|
| 254 | PP_QUOTE = QUOTE, | 
|---|
| 255 | PP_SINGLEQUOTE = SINGLEQUOTE, | 
|---|
| 256 | PP_DIGIT = DIGIT, | 
|---|
| 257 | PP_CHARACTER = CHARACTER, | 
|---|
| 258 | PP_WHITESPACE = WHITESPACE, | 
|---|
| 259 | PP_NEWLINE = NEWLINE, | 
|---|
| 260 | PP_CPP_COMMENT = CPP_COMMENT, | 
|---|
| 261 | PP_C_COMMENT = C_COMMENT, | 
|---|
| 262 | PP_BACKSLASH = BACKSLASH | 
|---|
| 263 | }; | 
|---|
| 264 |  | 
|---|
| 265 | // for debugging only | 
|---|
| 266 | #if defined(DEBUG_MOC) | 
|---|
| 267 | const char *tokenTypeName(Token t); | 
|---|
| 268 | #endif | 
|---|
| 269 |  | 
|---|
| 270 | typedef Token PP_Token; | 
|---|
| 271 |  | 
|---|
| 272 | QT_END_NAMESPACE | 
|---|
| 273 |  | 
|---|
| 274 | #endif // TOKEN_H | 
|---|