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".
This commit is contained in:
Erik Verbruggen
2010-02-14 14:41:51 +01:00
parent abdd404ff5
commit 2a59d2ae0c
14 changed files with 410 additions and 367 deletions

View File

@@ -2275,6 +2275,7 @@ protected:
class CPLUSPLUS_EXPORT StringLiteralAST: public ExpressionAST
{
public:
unsigned at_token;
unsigned literal_token;
StringLiteralAST *next;
@@ -2588,6 +2589,7 @@ class CPLUSPLUS_EXPORT ObjCClassForwardDeclarationAST: public DeclarationAST
{
public:
SpecifierListAST *attribute_list;
unsigned at_token;
unsigned class_token;
NameListAST *identifier_list;
unsigned semicolon_token;
@@ -2612,6 +2614,7 @@ class CPLUSPLUS_EXPORT ObjCClassDeclarationAST: public DeclarationAST
{
public:
SpecifierListAST *attribute_list;
unsigned at_token;
unsigned interface_token;
unsigned implementation_token;
NameAST *class_name;
@@ -2623,6 +2626,7 @@ public:
ObjCProtocolRefsAST *protocol_refs;
ObjCInstanceVariablesDeclarationAST *inst_vars_decl;
DeclarationListAST *member_declaration_list;
unsigned ending_at_token;
unsigned end_token;
public: // annotations
@@ -2645,6 +2649,7 @@ class CPLUSPLUS_EXPORT ObjCProtocolForwardDeclarationAST: public DeclarationAST
{
public:
SpecifierListAST *attribute_list;
unsigned at_token;
unsigned protocol_token;
NameListAST *identifier_list;
unsigned semicolon_token;
@@ -2669,10 +2674,12 @@ class CPLUSPLUS_EXPORT ObjCProtocolDeclarationAST: public DeclarationAST
{
public:
SpecifierListAST *attribute_list;
unsigned at_token;
unsigned protocol_token;
NameAST *name;
ObjCProtocolRefsAST *protocol_refs;
DeclarationListAST *member_declaration_list;
unsigned ending_at_token;
unsigned end_token;
public: // annotations
@@ -2754,6 +2761,7 @@ protected:
class CPLUSPLUS_EXPORT ObjCProtocolExpressionAST: public ExpressionAST
{
public:
unsigned at_token;
unsigned protocol_token;
unsigned lparen_token;
unsigned identifier_token;
@@ -2796,6 +2804,7 @@ protected:
class CPLUSPLUS_EXPORT ObjCEncodeExpressionAST: public ExpressionAST
{
public:
unsigned at_token;
unsigned encode_token;
ObjCTypeNameAST *type_name;
@@ -2870,6 +2879,7 @@ protected:
class CPLUSPLUS_EXPORT ObjCSelectorExpressionAST: public ExpressionAST
{
public:
unsigned at_token;
unsigned selector_token;
unsigned lparen_token;
ObjCSelectorAST *selector;
@@ -2911,6 +2921,7 @@ protected:
class CPLUSPLUS_EXPORT ObjCVisibilityDeclarationAST: public DeclarationAST
{
public:
unsigned at_token;
unsigned visibility_token;
public:
@@ -2950,6 +2961,7 @@ class CPLUSPLUS_EXPORT ObjCPropertyDeclarationAST: public DeclarationAST
{
public:
SpecifierListAST *attribute_list;
unsigned at_token;
unsigned property_token;
unsigned lparen_token;
ObjCPropertyAttributeListAST *property_attribute_list;
@@ -3137,6 +3149,7 @@ protected:
class CPLUSPLUS_EXPORT ObjCSynchronizedStatementAST: public StatementAST
{
public:
unsigned at_token;
unsigned synchronized_token;
unsigned lparen_token;
ExpressionAST *synchronized_object;