diff --git a/src/dparse/ast.d b/src/dparse/ast.d index d05a9e5e..855dd822 100644 --- a/src/dparse/ast.d +++ b/src/dparse/ast.d @@ -3739,7 +3739,7 @@ unittest // issue #398: Support extern(C++, ) assert(ns.length == 1); checkText(ns[0], `"foo"`); - ns = getNamespaces(`extern(C++, "foo", "bar", "baz") int i;`); + ns = getNamespaces(`extern(C++, "foo", "bar", "baz",) int i;`); assert(ns.length == 3); checkText(ns[0], `"foo"`); checkText(ns[1], `"bar"`); diff --git a/src/dparse/parser.d b/src/dparse/parser.d index 2f70e983..890c50b5 100644 --- a/src/dparse/parser.d +++ b/src/dparse/parser.d @@ -4864,13 +4864,13 @@ class Parser * Parses a NamespaceList. * * $(GRAMMAR $(RULEDEF namespaceList): - * $(RULE ternaryExpression) ($(LITERAL ',') $(RULE ternaryExpression)?)* + * $(RULE ternaryExpression) ($(LITERAL ',') $(RULE ternaryExpression)?)* $(LITERAL ',')? * ;) */ NamespaceList parseNamespaceList() { mixin(traceEnterAndExit!(__FUNCTION__)); - return parseCommaSeparatedRule!(NamespaceList, TernaryExpression)(); + return parseCommaSeparatedRule!(NamespaceList, TernaryExpression)(true); } /**