From f9a82848fe98a84f38a66df950514c3556e7fb2d Mon Sep 17 00:00:00 2001 From: Jan Jurzitza Date: Thu, 16 Jul 2020 11:33:22 +0200 Subject: [PATCH] Support extern(C++ ) with trailing comma Added with https://issues.dlang.org/show_bug.cgi?id=20791 in DMD 2.093.0 --- src/dparse/ast.d | 2 +- src/dparse/parser.d | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) 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); } /**