Commit ae715143 authored by Roberto Raggi's avatar Roberto Raggi
Browse files

Parse C++0x base-specifier-list.

parent 8b625a86
......@@ -559,6 +559,9 @@ unsigned ClassSpecifierAST::lastToken() const
else if (lbrace_token)
return lbrace_token + 1;
else if (dot_dot_dot_token)
return dot_dot_dot_token + 1;
else if (base_clause_list)
return base_clause_list->lastToken();
......
......@@ -1131,6 +1131,7 @@ public:
NameAST *name;
unsigned colon_token;
BaseSpecifierListAST *base_clause_list;
unsigned dot_dot_dot_token;
unsigned lbrace_token;
DeclarationListAST *member_specifier_list;
unsigned rbrace_token;
......@@ -1145,6 +1146,7 @@ public:
, name(0)
, colon_token(0)
, base_clause_list(0)
, dot_dot_dot_token(0)
, lbrace_token(0)
, member_specifier_list(0)
, rbrace_token(0)
......
......@@ -353,6 +353,7 @@ ClassSpecifierAST *ClassSpecifierAST::clone(MemoryPool *pool) const
for (BaseSpecifierListAST *iter = base_clause_list, **ast_iter = &ast->base_clause_list;
iter; iter = iter->next, ast_iter = &(*ast_iter)->next)
*ast_iter = new (pool) BaseSpecifierListAST((iter->value) ? iter->value->clone(pool) : 0);
ast->dot_dot_dot_token = dot_dot_dot_token;
ast->lbrace_token = lbrace_token;
for (DeclarationListAST *iter = member_specifier_list, **ast_iter = &ast->member_specifier_list;
iter; iter = iter->next, ast_iter = &(*ast_iter)->next)
......@@ -431,6 +432,7 @@ CtorInitializerAST *CtorInitializerAST::clone(MemoryPool *pool) const
for (MemInitializerListAST *iter = member_initializer_list, **ast_iter = &ast->member_initializer_list;
iter; iter = iter->next, ast_iter = &(*ast_iter)->next)
*ast_iter = new (pool) MemInitializerListAST((iter->value) ? iter->value->clone(pool) : 0);
ast->dot_dot_dot_token = dot_dot_dot_token;
return ast;
}
......
......@@ -570,6 +570,8 @@ bool ASTMatcher::match(ClassSpecifierAST *node, ClassSpecifierAST *pattern)
else if (! AST::match(node->base_clause_list, pattern->base_clause_list, this))
return false;
pattern->dot_dot_dot_token = node->dot_dot_dot_token;
pattern->lbrace_token = node->lbrace_token;
if (! pattern->member_specifier_list)
......@@ -706,6 +708,8 @@ bool ASTMatcher::match(CtorInitializerAST *node, CtorInitializerAST *pattern)
else if (! AST::match(node->member_initializer_list, pattern->member_initializer_list, this))
return false;
pattern->dot_dot_dot_token = node->dot_dot_dot_token;
return true;
}
......
......@@ -1667,6 +1667,7 @@ bool Parser::parseClassSpecifier(SpecifierListAST *&node)
_inFunctionBody = false;
unsigned colon_token = 0;
unsigned dot_dot_dot_token = 0;
if (LA() == T_COLON || LA() == T_LBRACE) {
BaseSpecifierListAST *base_clause_list = 0;
......@@ -1676,6 +1677,9 @@ bool Parser::parseClassSpecifier(SpecifierListAST *&node)
parseBaseClause(base_clause_list);
if (_cxx0xEnabled && LA() == T_DOT_DOT_DOT)
dot_dot_dot_token = consumeToken();
if (LA() != T_LBRACE) {
_translationUnit->error(cursor(), "expected `{' before `%s'", tok().spell());
......@@ -1697,6 +1701,7 @@ bool Parser::parseClassSpecifier(SpecifierListAST *&node)
ast->name = name;
ast->colon_token = colon_token;
ast->base_clause_list = base_clause_list;
ast->dot_dot_dot_token = dot_dot_dot_token;
if (LA() == T_LBRACE)
ast->lbrace_token = consumeToken();
......
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