Merge pull request #144 from callumenator/class-decl

Allow for just identifier in class and interface decl
This commit is contained in:
Hackerpilot 2014-03-08 20:31:00 -08:00
commit 6db7a268dc
1 changed files with 12 additions and 2 deletions

View File

@ -1309,7 +1309,7 @@ incorrect;
* Parses a 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()
@ -1322,6 +1322,11 @@ incorrect;
node.name = *ident;
node.comment = comment;
comment = null;
if (currentIs(tok!";"))
{
advance();
return node;
}
if (currentIs(tok!"("))
{
node.templateParameters = parseTemplateParameters();
@ -3186,7 +3191,7 @@ import core.stdc.stdio, std.string : KeepTerminator;
* Parses an 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()
@ -3198,6 +3203,11 @@ import core.stdc.stdio, std.string : KeepTerminator;
node.name = *ident;
node.comment = comment;
comment = null;
if (currentIs(tok!";"))
{
advance();
return node;
}
if (currentIs(tok!"("))
{
node.templateParameters = parseTemplateParameters();