diff options
author | Erik Verbruggen <erik.verbruggen@nokia.com> | 2010-02-02 12:03:37 +0100 |
---|---|---|
committer | Erik Verbruggen <erik.verbruggen@nokia.com> | 2010-02-02 12:03:37 +0100 |
commit | 0cf0becb2e07789dc2a6900468d0c597168ca36e (patch) | |
tree | a4dc57e2882310337994fdaf4e0ed22908dae4d7 /src/shared/cplusplus/Parser.cpp | |
parent | a004dace097301a0cf1723cbc7db8a56adb8a8d4 (diff) | |
download | qt-creator-0cf0becb2e07789dc2a6900468d0c597168ca36e.tar.gz |
Added AST building for __attribute__ constructs.
Diffstat (limited to 'src/shared/cplusplus/Parser.cpp')
-rw-r--r-- | src/shared/cplusplus/Parser.cpp | 27 |
1 files changed, 21 insertions, 6 deletions
diff --git a/src/shared/cplusplus/Parser.cpp b/src/shared/cplusplus/Parser.cpp index e97b8e134c..319d1f65f2 100644 --- a/src/shared/cplusplus/Parser.cpp +++ b/src/shared/cplusplus/Parser.cpp @@ -2970,16 +2970,31 @@ bool Parser::parseAttributeSpecifier(SpecifierListAST *&node) return true; } -bool Parser::parseAttributeList(AttributeListAST *&) // ### create the AST +bool Parser::parseAttributeList(AttributeListAST *&node) { DEBUG_THIS_RULE(); + AttributeListAST **iter = &node; while (LA() == T_CONST || LA() == T_IDENTIFIER) { - if (LA() == T_CONST) - consumeToken(); - else if (LA() == T_IDENTIFIER) { - ExpressionAST *expression = 0; - parseExpression(expression); + *iter = new (_pool) AttributeListAST; + + if (LA() == T_CONST) { + AttributeAST *attr = new (_pool) AttributeAST; + attr->identifier_token = consumeToken(); + + (*iter)->value = attr; + iter = &(*iter)->next; + } else if (LA() == T_IDENTIFIER) { + AttributeAST *attr = new (_pool) AttributeAST; + attr->identifier_token = consumeToken(); + if (LA() == T_LPAREN) { + attr->lparen_token = consumeToken(); + parseExpressionList(attr->expression_list); + match(T_RPAREN, &attr->rparen_token); + } + + (*iter)->value = attr; + iter = &(*iter)->next; } if (LA() != T_COMMA) |