Allow for just identifier in class and interface decl

This commit is contained in:
Callum Anderson 2014-03-07 12:07:21 +11:00
parent f146cc8d89
commit b3685f9849
1 changed files with 12 additions and 2 deletions

View File

@ -1309,7 +1309,7 @@ incorrect;
* Parses a ClassDeclaration * Parses a ClassDeclaration
* *
* $(GRAMMAR $(RULEDEF classDeclaration): * $(GRAMMAR $(RULEDEF classDeclaration):
* $(LITERAL 'class') $(LITERAL Identifier) ($(RULE templateParameters) $(RULE constraint)?)? ($(LITERAL ':') $(RULE baseClassList))? $(RULE structBody) * $(LITERAL 'class') $(LITERAL Identifier) ($(LITERAL ';') | ($(RULE templateParameters) $(RULE constraint)?)? ($(LITERAL ':') $(RULE baseClassList))? $(RULE structBody))
* ;) * ;)
*/ */
ClassDeclaration parseClassDeclaration() ClassDeclaration parseClassDeclaration()
@ -1322,6 +1322,11 @@ incorrect;
node.name = *ident; node.name = *ident;
node.comment = comment; node.comment = comment;
comment = null; comment = null;
if (currentIs(tok!";"))
{
advance();
return node;
}
if (currentIs(tok!"(")) if (currentIs(tok!"("))
{ {
node.templateParameters = parseTemplateParameters(); node.templateParameters = parseTemplateParameters();
@ -3185,7 +3190,7 @@ import core.stdc.stdio, std.string : KeepTerminator;
* Parses an InterfaceDeclaration * Parses an InterfaceDeclaration
* *
* $(GRAMMAR $(RULEDEF interfaceDeclaration): * $(GRAMMAR $(RULEDEF interfaceDeclaration):
* $(LITERAL 'interface') $(LITERAL Identifier) ($(RULE templateParameters) $(RULE constraint)?)? ($(LITERAL ':') $(RULE baseClassList))? $(RULE structBody) * $(LITERAL 'interface') $(LITERAL Identifier) ($(LITERAL ';') | ($(RULE templateParameters) $(RULE constraint)?)? ($(LITERAL ':') $(RULE baseClassList))? $(RULE structBody))
* ;) * ;)
*/ */
InterfaceDeclaration parseInterfaceDeclaration() InterfaceDeclaration parseInterfaceDeclaration()
@ -3197,6 +3202,11 @@ import core.stdc.stdio, std.string : KeepTerminator;
node.name = *ident; node.name = *ident;
node.comment = comment; node.comment = comment;
comment = null; comment = null;
if (currentIs(tok!";"))
{
advance();
return node;
}
if (currentIs(tok!"(")) if (currentIs(tok!"("))
{ {
node.templateParameters = parseTemplateParameters(); node.templateParameters = parseTemplateParameters();