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/ASTClone.cpp | |
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/ASTClone.cpp')
-rw-r--r-- | src/shared/cplusplus/ASTClone.cpp | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/src/shared/cplusplus/ASTClone.cpp b/src/shared/cplusplus/ASTClone.cpp index 87ee91558b..d4247ad116 100644 --- a/src/shared/cplusplus/ASTClone.cpp +++ b/src/shared/cplusplus/ASTClone.cpp @@ -1064,6 +1064,7 @@ NestedExpressionAST *NestedExpressionAST::clone(MemoryPool *pool) const StringLiteralAST *StringLiteralAST::clone(MemoryPool *pool) const { StringLiteralAST *ast = new (pool) StringLiteralAST; + ast->at_token = at_token; ast->literal_token = literal_token; if (next) ast->next = next->clone(pool); @@ -1232,6 +1233,7 @@ ObjCClassForwardDeclarationAST *ObjCClassForwardDeclarationAST::clone(MemoryPool for (SpecifierListAST *iter = attribute_list, **ast_iter = &ast->attribute_list; iter; iter = iter->next, ast_iter = &(*ast_iter)->next) *ast_iter = new (pool) SpecifierListAST((iter->value) ? iter->value->clone(pool) : 0); + ast->at_token = at_token; ast->class_token = class_token; for (NameListAST *iter = identifier_list, **ast_iter = &ast->identifier_list; iter; iter = iter->next, ast_iter = &(*ast_iter)->next) @@ -1246,6 +1248,7 @@ ObjCClassDeclarationAST *ObjCClassDeclarationAST::clone(MemoryPool *pool) const for (SpecifierListAST *iter = attribute_list, **ast_iter = &ast->attribute_list; iter; iter = iter->next, ast_iter = &(*ast_iter)->next) *ast_iter = new (pool) SpecifierListAST((iter->value) ? iter->value->clone(pool) : 0); + ast->at_token = at_token; ast->interface_token = interface_token; ast->implementation_token = implementation_token; if (class_name) @@ -1264,6 +1267,7 @@ ObjCClassDeclarationAST *ObjCClassDeclarationAST::clone(MemoryPool *pool) const for (DeclarationListAST *iter = member_declaration_list, **ast_iter = &ast->member_declaration_list; iter; iter = iter->next, ast_iter = &(*ast_iter)->next) *ast_iter = new (pool) DeclarationListAST((iter->value) ? iter->value->clone(pool) : 0); + ast->ending_at_token = ending_at_token; ast->end_token = end_token; return ast; } @@ -1274,6 +1278,7 @@ ObjCProtocolForwardDeclarationAST *ObjCProtocolForwardDeclarationAST::clone(Memo for (SpecifierListAST *iter = attribute_list, **ast_iter = &ast->attribute_list; iter; iter = iter->next, ast_iter = &(*ast_iter)->next) *ast_iter = new (pool) SpecifierListAST((iter->value) ? iter->value->clone(pool) : 0); + ast->at_token = at_token; ast->protocol_token = protocol_token; for (NameListAST *iter = identifier_list, **ast_iter = &ast->identifier_list; iter; iter = iter->next, ast_iter = &(*ast_iter)->next) @@ -1288,6 +1293,7 @@ ObjCProtocolDeclarationAST *ObjCProtocolDeclarationAST::clone(MemoryPool *pool) for (SpecifierListAST *iter = attribute_list, **ast_iter = &ast->attribute_list; iter; iter = iter->next, ast_iter = &(*ast_iter)->next) *ast_iter = new (pool) SpecifierListAST((iter->value) ? iter->value->clone(pool) : 0); + ast->at_token = at_token; ast->protocol_token = protocol_token; if (name) ast->name = name->clone(pool); @@ -1296,6 +1302,7 @@ ObjCProtocolDeclarationAST *ObjCProtocolDeclarationAST::clone(MemoryPool *pool) for (DeclarationListAST *iter = member_declaration_list, **ast_iter = &ast->member_declaration_list; iter; iter = iter->next, ast_iter = &(*ast_iter)->next) *ast_iter = new (pool) DeclarationListAST((iter->value) ? iter->value->clone(pool) : 0); + ast->ending_at_token = ending_at_token; ast->end_token = end_token; return ast; } @@ -1337,6 +1344,7 @@ ObjCMessageExpressionAST *ObjCMessageExpressionAST::clone(MemoryPool *pool) cons ObjCProtocolExpressionAST *ObjCProtocolExpressionAST::clone(MemoryPool *pool) const { ObjCProtocolExpressionAST *ast = new (pool) ObjCProtocolExpressionAST; + ast->at_token = at_token; ast->protocol_token = protocol_token; ast->lparen_token = lparen_token; ast->identifier_token = identifier_token; @@ -1358,6 +1366,7 @@ ObjCTypeNameAST *ObjCTypeNameAST::clone(MemoryPool *pool) const ObjCEncodeExpressionAST *ObjCEncodeExpressionAST::clone(MemoryPool *pool) const { ObjCEncodeExpressionAST *ast = new (pool) ObjCEncodeExpressionAST; + ast->at_token = at_token; ast->encode_token = encode_token; if (type_name) ast->type_name = type_name->clone(pool); @@ -1391,6 +1400,7 @@ ObjCSelectorWithArgumentsAST *ObjCSelectorWithArgumentsAST::clone(MemoryPool *po ObjCSelectorExpressionAST *ObjCSelectorExpressionAST::clone(MemoryPool *pool) const { ObjCSelectorExpressionAST *ast = new (pool) ObjCSelectorExpressionAST; + ast->at_token = at_token; ast->selector_token = selector_token; ast->lparen_token = lparen_token; if (selector) @@ -1413,6 +1423,7 @@ ObjCInstanceVariablesDeclarationAST *ObjCInstanceVariablesDeclarationAST::clone( ObjCVisibilityDeclarationAST *ObjCVisibilityDeclarationAST::clone(MemoryPool *pool) const { ObjCVisibilityDeclarationAST *ast = new (pool) ObjCVisibilityDeclarationAST; + ast->at_token = at_token; ast->visibility_token = visibility_token; return ast; } @@ -1433,6 +1444,7 @@ ObjCPropertyDeclarationAST *ObjCPropertyDeclarationAST::clone(MemoryPool *pool) for (SpecifierListAST *iter = attribute_list, **ast_iter = &ast->attribute_list; iter; iter = iter->next, ast_iter = &(*ast_iter)->next) *ast_iter = new (pool) SpecifierListAST((iter->value) ? iter->value->clone(pool) : 0); + ast->at_token = at_token; ast->property_token = property_token; ast->lparen_token = lparen_token; for (ObjCPropertyAttributeListAST *iter = property_attribute_list, **ast_iter = &ast->property_attribute_list; @@ -1541,6 +1553,7 @@ ObjCFastEnumerationAST *ObjCFastEnumerationAST::clone(MemoryPool *pool) const ObjCSynchronizedStatementAST *ObjCSynchronizedStatementAST::clone(MemoryPool *pool) const { ObjCSynchronizedStatementAST *ast = new (pool) ObjCSynchronizedStatementAST; + ast->at_token = at_token; ast->synchronized_token = synchronized_token; ast->lparen_token = lparen_token; if (synchronized_object) |