From 2a59d2ae0c889fe6e4ac50a3f110b0103f880c15 Mon Sep 17 00:00:00 2001 From: Erik Verbruggen Date: Sun, 14 Feb 2010 14:41:51 +0100 Subject: 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". --- src/shared/cplusplus/Token.cpp | 26 ++++++++++++-------------- 1 file changed, 12 insertions(+), 14 deletions(-) (limited to 'src/shared/cplusplus/Token.cpp') diff --git a/src/shared/cplusplus/Token.cpp b/src/shared/cplusplus/Token.cpp index e86038271f..e4f2baba4d 100644 --- a/src/shared/cplusplus/Token.cpp +++ b/src/shared/cplusplus/Token.cpp @@ -59,14 +59,14 @@ static const char *token_names[] = { (""), (""), (""), (""), (""), (""), - ("<@string literal>"), (""), + (""), - ("&"), ("&&"), ("&="), ("->"), ("->*"), ("^"), ("^="), (":"), ("::"), - (","), ("/"), ("/="), ("."), ("..."), (".*"), ("="), ("=="), ("!"), - ("!="), (">"), (">="), (">>"), (">>="), ("{"), ("["), ("<"), ("<="), - ("<<"), ("<<="), ("("), ("-"), ("-="), ("--"), ("%"), ("%="), ("|"), - ("|="), ("||"), ("+"), ("+="), ("++"), ("#"), ("##"), ("?"), ("}"), - ("]"), (")"), (";"), ("*"), ("*="), ("~"), ("~="), + ("&"), ("&&"), ("&="), ("->"), ("->*"), ("@"), ("^"), ("^="), (":"), + ("::"), (","), ("/"), ("/="), ("."), ("..."), (".*"), ("="), ("=="), + ("!"), ("!="), (">"), (">="), (">>"), (">>="), ("{"), ("["), ("<"), + ("<="), ("<<"), ("<<="), ("("), ("-"), ("-="), ("--"), ("%"), ("%="), + ("|"), ("|="), ("||"), ("+"), ("+="), ("++"), ("#"), ("##"), ("?"), + ("}"), ("]"), (")"), (";"), ("*"), ("*="), ("~"), ("~="), ("asm"), ("auto"), ("bool"), ("break"), ("case"), ("catch"), ("char"), ("class"), ("const"), ("const_cast"), ("continue"), ("default"), @@ -84,12 +84,11 @@ static const char *token_names[] = { // gnu ("__attribute__"), ("__typeof__"), - // objc @keywords - ("@catch"), ("@class"), ("@compatibility_alias"), ("@defs"), ("@dynamic"), - ("@encode"), ("@end"), ("@finally"), ("@implementation"), ("@interface"), - ("@not_keyword"), ("@optional"), ("@package"), ("@private"), ("@property"), - ("@protected"), ("@protocol"), ("@public"), ("@required"), ("@selector"), - ("@synchronized"), ("@synthesize"), ("@throw"), ("@try"), + // objc keywords + ("@compatibility_alias"), ("@defs"), ("@dynamic"), ("@encode"), ("@end"), + ("@finally"), ("@implementation"), ("@interface"), ("@not_keyword"), + ("@optional"), ("@package"), ("@property"), ("@protocol"), ("@required"), + ("@selector"), ("@synchronized"), ("@synthesize"), ("SIGNAL"), ("SLOT"), ("Q_SIGNAL"), ("Q_SLOT"), ("signals"), ("slots"), ("Q_FOREACH"), ("Q_D"), ("Q_Q"), @@ -124,7 +123,6 @@ const char *Token::spell() const case T_NUMERIC_LITERAL: case T_CHAR_LITERAL: case T_STRING_LITERAL: - case T_AT_STRING_LITERAL: case T_ANGLE_STRING_LITERAL: case T_WIDE_CHAR_LITERAL: case T_WIDE_STRING_LITERAL: -- cgit v1.2.1