Commit a0a4cec8 authored by hjk's avatar hjk
Browse files

Merge branch 'master' of git@scm.dev.nokia.troll.no:creator/mainline

parents f31607b3 5fc4fbb1
......@@ -2556,24 +2556,12 @@ bool Parser::parsePrimaryExpression(ExpressionAST *&node)
return parseQtMethod(node);
default: {
unsigned startOfName = cursor();
NameAST *name = 0;
if (parseName(name)) {
if (LA() == T_IDENTIFIER || tok().isLiteral() || (tok().isOperator() && LA() != T_LPAREN &&
LA() != T_LBRACKET)) {
rewind(startOfName);
parseName(name, false);
}
// literal
// identifier <unop> ?
// identifier <binop>
// identifier <access>
// identifier rparen
// lparen type rparen identifier [[cast-expression]]
if (parseNameId(name)) {
node = name;
return true;
}
break;
} // default
} // switch
......@@ -2581,6 +2569,23 @@ bool Parser::parsePrimaryExpression(ExpressionAST *&node)
return false;
}
bool Parser::parseNameId(NameAST *&name)
{
unsigned start = cursor();
if (! parseName(name))
return false;
if (LA() == T_IDENTIFIER ||
tok().isLiteral() ||
(tok().isOperator() && LA() != T_LPAREN && LA() != T_LBRACKET))
{
rewind(start);
return parseName(name, false);
}
return false;
}
bool Parser::parseNestedExpression(ExpressionAST *&node)
{
if (LA() == T_LPAREN) {
......@@ -2763,7 +2768,7 @@ bool Parser::parsePostfixExpression(ExpressionAST *&node)
ast->access_token = consumeToken();
if (LA() == T_TEMPLATE)
ast->template_token = consumeToken();
if (! parseName(ast->member_name))
if (! parseNameId(ast->member_name))
_translationUnit->error(cursor(), "expected unqualified-id before token `%s'",
tok().spell());
*postfix_ptr = ast;
......
......@@ -141,6 +141,7 @@ public:
bool parseMultiplicativeExpression(ExpressionAST *&node);
bool parseTemplateId(NameAST *&node);
bool parseClassOrNamespaceName(NameAST *&node);
bool parseNameId(NameAST *&node);
bool parseName(NameAST *&node, bool acceptTemplateId = true);
bool parseNestedNameSpecifier(NestedNameSpecifierAST *&node, bool acceptTemplateId);
bool parseNestedNameSpecifierOpt(NestedNameSpecifierAST *&name, bool acceptTemplateId);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment