diff options
author | Erik Verbruggen <erik.verbruggen@nokia.com> | 2010-02-14 14:41:51 +0100 |
---|---|---|
committer | Erik Verbruggen <erik.verbruggen@nokia.com> | 2010-02-15 09:27:00 +0100 |
commit | 2a59d2ae0c889fe6e4ac50a3f110b0103f880c15 (patch) | |
tree | ff989d0d79fcee735d24bf88ef7552aa43aa1c7f /src/shared/cplusplus/Token.h | |
parent | abdd404ff5ec8539f0d3fd38139eb08ad8a03d66 (diff) | |
download | qt-creator-2a59d2ae0c889fe6e4ac50a3f110b0103f880c15.tar.gz |
Split Objective-C keyword parsing to handle the '@' separately.
Because apparently, while designing the Objective-C language, somebody
thought it was a world-class idea to allow any white-space between the
'@' character and the subsequent keyword. With this fix, we now
correctly parse:
@ dynamic
and:
@
selector
and:
@"foo"
"bar"
@"mooze"
(This last one is 1 single string split over multiple lines.)
Wonderful, isn't it?
What we (and Clang) do not support, but what GCC supports is something
like:
@"foo"@@ "bar" @"mooze" @@
which is equivalent to @"foobarmooze".
Diffstat (limited to 'src/shared/cplusplus/Token.h')
-rw-r--r-- | src/shared/cplusplus/Token.h | 56 |
1 files changed, 23 insertions, 33 deletions
diff --git a/src/shared/cplusplus/Token.h b/src/shared/cplusplus/Token.h index d139584bdd..05505b94e4 100644 --- a/src/shared/cplusplus/Token.h +++ b/src/shared/cplusplus/Token.h @@ -69,7 +69,6 @@ enum Kind { T_WIDE_CHAR_LITERAL, T_STRING_LITERAL, T_WIDE_STRING_LITERAL, - T_AT_STRING_LITERAL, T_ANGLE_STRING_LITERAL, T_LAST_LITERAL = T_ANGLE_STRING_LITERAL, @@ -79,6 +78,7 @@ enum Kind { T_AMPER_EQUAL, T_ARROW, T_ARROW_STAR, + T_AT, T_CARET, T_CARET_EQUAL, T_COLON, @@ -196,35 +196,28 @@ enum Kind { T___ATTRIBUTE__, T___TYPEOF__, - // obj c++ @ keywords - T_FIRST_OBJC_AT_KEYWORD, - - T_AT_CATCH = T_FIRST_OBJC_AT_KEYWORD, - T_AT_CLASS, - T_AT_COMPATIBILITY_ALIAS, - T_AT_DEFS, - T_AT_DYNAMIC, - T_AT_ENCODE, - T_AT_END, - T_AT_FINALLY, - T_AT_IMPLEMENTATION, - T_AT_INTERFACE, - T_AT_NOT_KEYWORD, - T_AT_OPTIONAL, - T_AT_PACKAGE, - T_AT_PRIVATE, - T_AT_PROPERTY, - T_AT_PROTECTED, - T_AT_PROTOCOL, - T_AT_PUBLIC, - T_AT_REQUIRED, - T_AT_SELECTOR, - T_AT_SYNCHRONIZED, - T_AT_SYNTHESIZE, - T_AT_THROW, - T_AT_TRY, - - T_LAST_OBJC_AT_KEYWORD = T_AT_TRY, + // obj c keywords + T_FIRST_OBJC_KEYWORD, + + T_COMPATIBILITY_ALIAS = T_FIRST_OBJC_KEYWORD, + T_DEFS, + T_DYNAMIC, + T_ENCODE, + T_END, + T_FINALLY, + T_IMPLEMENTATION, + T_INTERFACE, + T_NOT_KEYWORD, + T_OPTIONAL, + T_PACKAGE, + T_PROPERTY, + T_PROTOCOL, + T_REQUIRED, + T_SELECTOR, + T_SYNCHRONIZED, + T_SYNTHESIZE, + + T_LAST_OBJC_KEYWORD = T_SYNTHESIZE, T_FIRST_QT_KEYWORD, @@ -313,9 +306,6 @@ public: { return f.kind == T_COMMENT || f.kind == T_DOXY_COMMENT || f.kind == T_CPP_COMMENT || f.kind == T_CPP_DOXY_COMMENT; } - inline bool isObjCAtKeyword() const - { return f.kind >= T_FIRST_OBJC_AT_KEYWORD && f.kind <= T_LAST_OBJC_AT_KEYWORD; } - static const char *name(int kind); public: |