forked from qt-creator/qt-creator
C++: Whitespace fixes in parser
Change-Id: I409699225b5f42db7ecb6c2dc8d150c1a66ee23c Reviewed-by: Erik Verbruggen <erik.verbruggen@digia.com>
This commit is contained in:
committed by
Orgad Shaneh
parent
399967d08b
commit
d0f00cc29d
39
src/libs/3rdparty/cplusplus/Parser.cpp
vendored
39
src/libs/3rdparty/cplusplus/Parser.cpp
vendored
@@ -1367,8 +1367,7 @@ bool Parser::parseDeclSpecifierSeq(SpecifierListAST *&decl_specifier_seq,
|
|||||||
// typename-specifier, elaborated-type-specifier
|
// typename-specifier, elaborated-type-specifier
|
||||||
unsigned startOfElaboratedTypeSpecifier = cursor();
|
unsigned startOfElaboratedTypeSpecifier = cursor();
|
||||||
if (! parseElaboratedTypeSpecifier(*decl_specifier_seq_ptr)) {
|
if (! parseElaboratedTypeSpecifier(*decl_specifier_seq_ptr)) {
|
||||||
error(startOfElaboratedTypeSpecifier,
|
error(startOfElaboratedTypeSpecifier, "expected an elaborated type specifier");
|
||||||
"expected an elaborated type specifier");
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
decl_specifier_seq_ptr = &(*decl_specifier_seq_ptr)->next;
|
decl_specifier_seq_ptr = &(*decl_specifier_seq_ptr)->next;
|
||||||
@@ -2154,9 +2153,7 @@ bool Parser::parseQtPropertyDeclaration(DeclarationAST *&node)
|
|||||||
if (parsePostfixExpression(ast->expression)) {
|
if (parsePostfixExpression(ast->expression)) {
|
||||||
match(T_COMMA, &ast->comma_token);
|
match(T_COMMA, &ast->comma_token);
|
||||||
} else {
|
} else {
|
||||||
error(cursor(),
|
error(cursor(), "expected expression before `%s'", tok().spell());
|
||||||
"expected expression before `%s'",
|
|
||||||
tok().spell());
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -2199,9 +2196,7 @@ bool Parser::parseQtPropertyDeclaration(DeclarationAST *&node)
|
|||||||
bItem->expression = expr;
|
bItem->expression = expr;
|
||||||
item = bItem;
|
item = bItem;
|
||||||
} else {
|
} else {
|
||||||
error(cursor(),
|
error(cursor(), "expected expression before `%s'", tok().spell());
|
||||||
"expected expression before `%s'",
|
|
||||||
tok().spell());
|
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@@ -3929,8 +3924,7 @@ bool Parser::parseSimpleDeclaration(DeclarationAST *&node, ClassSpecifierAST *de
|
|||||||
|| (_languageFeatures.cxx11Enabled && LA() == T_COLON)) {
|
|| (_languageFeatures.cxx11Enabled && LA() == T_COLON)) {
|
||||||
rewind(startOfTypeSpecifier);
|
rewind(startOfTypeSpecifier);
|
||||||
if (! parseEnumSpecifier(*decl_specifier_seq_ptr)) {
|
if (! parseEnumSpecifier(*decl_specifier_seq_ptr)) {
|
||||||
error(startOfTypeSpecifier,
|
error(startOfTypeSpecifier, "expected an enum specifier");
|
||||||
"expected an enum specifier");
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
has_complex_type_specifier = true;
|
has_complex_type_specifier = true;
|
||||||
@@ -3940,8 +3934,7 @@ bool Parser::parseSimpleDeclaration(DeclarationAST *&node, ClassSpecifierAST *de
|
|||||||
} else if (! has_type_specifier && LA() == T_TYPENAME) {
|
} else if (! has_type_specifier && LA() == T_TYPENAME) {
|
||||||
unsigned startOfElaboratedTypeSpecifier = cursor();
|
unsigned startOfElaboratedTypeSpecifier = cursor();
|
||||||
if (! parseElaboratedTypeSpecifier(*decl_specifier_seq_ptr)) {
|
if (! parseElaboratedTypeSpecifier(*decl_specifier_seq_ptr)) {
|
||||||
error(startOfElaboratedTypeSpecifier,
|
error(startOfElaboratedTypeSpecifier, "expected an elaborated type specifier");
|
||||||
"expected an elaborated type specifier");
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
decl_specifier_seq_ptr = &(*decl_specifier_seq_ptr)->next;
|
decl_specifier_seq_ptr = &(*decl_specifier_seq_ptr)->next;
|
||||||
@@ -3956,8 +3949,7 @@ bool Parser::parseSimpleDeclaration(DeclarationAST *&node, ClassSpecifierAST *de
|
|||||||
(LA(3) == T_COLON || LA(3) == T_LBRACE)))) {
|
(LA(3) == T_COLON || LA(3) == T_LBRACE)))) {
|
||||||
rewind(startOfTypeSpecifier);
|
rewind(startOfTypeSpecifier);
|
||||||
if (! parseClassSpecifier(*decl_specifier_seq_ptr)) {
|
if (! parseClassSpecifier(*decl_specifier_seq_ptr)) {
|
||||||
error(startOfTypeSpecifier,
|
error(startOfTypeSpecifier, "wrong type specifier");
|
||||||
"wrong type specifier");
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
has_complex_type_specifier = true;
|
has_complex_type_specifier = true;
|
||||||
@@ -4952,8 +4944,7 @@ bool Parser::parsePostfixExpression(ExpressionAST *&node)
|
|||||||
if (LA() == T_TEMPLATE)
|
if (LA() == T_TEMPLATE)
|
||||||
ast->template_token = consumeToken();
|
ast->template_token = consumeToken();
|
||||||
if (! parseNameId(ast->member_name))
|
if (! parseNameId(ast->member_name))
|
||||||
error(cursor(), "expected unqualified-id before token `%s'",
|
error(cursor(), "expected unqualified-id before token `%s'", tok().spell());
|
||||||
tok().spell());
|
|
||||||
ast->base_expression = node;
|
ast->base_expression = node;
|
||||||
node = ast;
|
node = ast;
|
||||||
} else break;
|
} else break;
|
||||||
@@ -4978,10 +4969,8 @@ bool Parser::parseUnaryExpression(ExpressionAST *&node)
|
|||||||
unsigned op = cursor();
|
unsigned op = cursor();
|
||||||
UnaryExpressionAST *ast = new (_pool) UnaryExpressionAST;
|
UnaryExpressionAST *ast = new (_pool) UnaryExpressionAST;
|
||||||
ast->unary_op_token = consumeToken();
|
ast->unary_op_token = consumeToken();
|
||||||
if (! parseCastExpression(ast->expression)) {
|
if (! parseCastExpression(ast->expression))
|
||||||
error(op, "expected expression after token `%s'",
|
error(op, "expected expression after token `%s'", _translationUnit->spell(op));
|
||||||
_translationUnit->spell(op));
|
|
||||||
}
|
|
||||||
node = ast;
|
node = ast;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@@ -5363,8 +5352,7 @@ bool Parser::parseQtMethod(ExpressionAST *&node)
|
|||||||
ast->method_token = consumeToken();
|
ast->method_token = consumeToken();
|
||||||
match(T_LPAREN, &ast->lparen_token);
|
match(T_LPAREN, &ast->lparen_token);
|
||||||
if (! parseDeclarator(ast->declarator, /*decl_specifier_seq =*/ 0))
|
if (! parseDeclarator(ast->declarator, /*decl_specifier_seq =*/ 0))
|
||||||
error(cursor(), "expected a function declarator before token `%s'",
|
error(cursor(), "expected a function declarator before token `%s'", tok().spell());
|
||||||
tok().spell());
|
|
||||||
match(T_RPAREN, &ast->rparen_token);
|
match(T_RPAREN, &ast->rparen_token);
|
||||||
node = ast;
|
node = ast;
|
||||||
return true;
|
return true;
|
||||||
@@ -5567,8 +5555,7 @@ bool Parser::parseObjCInterface(DeclarationAST *&node,
|
|||||||
// a category interface
|
// a category interface
|
||||||
|
|
||||||
if (attributes)
|
if (attributes)
|
||||||
error(attributes->firstToken(),
|
error(attributes->firstToken(), "invalid attributes for category interface declaration");
|
||||||
"invalid attributes for category interface declaration");
|
|
||||||
|
|
||||||
ObjCClassDeclarationAST *ast = new (_pool) ObjCClassDeclarationAST;
|
ObjCClassDeclarationAST *ast = new (_pool) ObjCClassDeclarationAST;
|
||||||
ast->attribute_list = attributes;
|
ast->attribute_list = attributes;
|
||||||
@@ -5851,9 +5838,7 @@ bool Parser::parseObjCMethodDefinitionList(DeclarationListAST *&node)
|
|||||||
} else {
|
} else {
|
||||||
if (! parseBlockDeclaration(declaration)) {
|
if (! parseBlockDeclaration(declaration)) {
|
||||||
rewind(start);
|
rewind(start);
|
||||||
error(cursor(),
|
error(cursor(), "skip token `%s'", tok().spell());
|
||||||
"skip token `%s'", tok().spell());
|
|
||||||
|
|
||||||
consumeToken();
|
consumeToken();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user