From b3685f98497e557403ddfe6db7b84682ee0a5f72 Mon Sep 17 00:00:00 2001 From: Callum Anderson Date: Fri, 7 Mar 2014 12:07:21 +1100 Subject: [PATCH] Allow for just identifier in class and interface decl --- stdx/d/parser.d | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/stdx/d/parser.d b/stdx/d/parser.d index 392d9e0..d247a7b 100644 --- a/stdx/d/parser.d +++ b/stdx/d/parser.d @@ -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(); @@ -3185,7 +3190,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() @@ -3197,6 +3202,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();