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

Parse C++0x type-parameters.

parent ae715143
......@@ -1727,6 +1727,9 @@ unsigned TemplateTypeParameterAST::lastToken() const
else if (name)
return name->lastToken();
else if (dot_dot_dot_token)
return dot_dot_dot_token + 1;
else if (class_token)
return class_token + 1;
......@@ -1895,6 +1898,8 @@ unsigned TypenameTypeParameterAST::lastToken() const
return equal_token + 1;
else if (name)
return name->lastToken();
else if (dot_dot_dot_token)
return dot_dot_dot_token + 1;
return classkey_token + 1;
}
......
......@@ -3215,6 +3215,7 @@ class CPLUSPLUS_EXPORT TypenameTypeParameterAST: public DeclarationAST
{
public:
unsigned classkey_token;
unsigned dot_dot_dot_token;
NameAST *name;
unsigned equal_token;
ExpressionAST *type_id;
......@@ -3225,6 +3226,7 @@ public: // annotations
public:
TypenameTypeParameterAST()
: classkey_token(0)
, dot_dot_dot_token(0)
, name(0)
, equal_token(0)
, type_id(0)
......@@ -3251,6 +3253,7 @@ public:
DeclarationListAST *template_parameter_list;
unsigned greater_token;
unsigned class_token;
unsigned dot_dot_dot_token;
NameAST *name;
unsigned equal_token;
ExpressionAST *type_id;
......@@ -3265,6 +3268,7 @@ public:
, template_parameter_list(0)
, greater_token(0)
, class_token(0)
, dot_dot_dot_token(0)
, name(0)
, equal_token(0)
, type_id(0)
......
......@@ -1210,6 +1210,7 @@ TypenameTypeParameterAST *TypenameTypeParameterAST::clone(MemoryPool *pool) cons
{
TypenameTypeParameterAST *ast = new (pool) TypenameTypeParameterAST;
ast->classkey_token = classkey_token;
ast->dot_dot_dot_token = dot_dot_dot_token;
if (name)
ast->name = name->clone(pool);
ast->equal_token = equal_token;
......@@ -1228,6 +1229,7 @@ TemplateTypeParameterAST *TemplateTypeParameterAST::clone(MemoryPool *pool) cons
*ast_iter = new (pool) DeclarationListAST((iter->value) ? iter->value->clone(pool) : 0);
ast->greater_token = greater_token;
ast->class_token = class_token;
ast->dot_dot_dot_token = dot_dot_dot_token;
if (name)
ast->name = name->clone(pool);
ast->equal_token = equal_token;
......
......@@ -2017,6 +2017,8 @@ bool ASTMatcher::match(TypenameTypeParameterAST *node, TypenameTypeParameterAST
pattern->classkey_token = node->classkey_token;
pattern->dot_dot_dot_token = node->dot_dot_dot_token;
if (! pattern->name)
pattern->name = node->name;
else if (! AST::match(node->name, pattern->name, this))
......@@ -2050,6 +2052,8 @@ bool ASTMatcher::match(TemplateTypeParameterAST *node, TemplateTypeParameterAST
pattern->class_token = node->class_token;
pattern->dot_dot_dot_token = node->dot_dot_dot_token;
if (! pattern->name)
pattern->name = node->name;
else if (! AST::match(node->name, pattern->name, this))
......
......@@ -1494,6 +1494,8 @@ bool Parser::parseTypenameTypeParameter(DeclarationAST *&node)
if (LA() == T_CLASS || LA() == T_TYPENAME) {
TypenameTypeParameterAST *ast = new (_pool) TypenameTypeParameterAST;
ast->classkey_token = consumeToken();
if (_cxx0xEnabled && LA() == T_DOT_DOT_DOT)
ast->dot_dot_dot_token = consumeToken();
parseName(ast->name);
if (LA() == T_EQUAL) {
ast->equal_token = consumeToken();
......@@ -1518,6 +1520,8 @@ bool Parser::parseTemplateTypeParameter(DeclarationAST *&node)
ast->greater_token = consumeToken();
if (LA() == T_CLASS)
ast->class_token = consumeToken();
if (_cxx0xEnabled && LA() == T_DOT_DOT_DOT)
ast->dot_dot_dot_token = consumeToken();
// parse optional name
parseName(ast->name);
......
Supports Markdown
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