From 0ea9854161c1fb1506812f2ee5f9332fb0678139 Mon Sep 17 00:00:00 2001 From: MoonlightSentinel Date: Sat, 2 May 2020 17:38:04 +0200 Subject: [PATCH] Fix 394 - ///////////// comment lines wrongly interpreted as ddoc --- src/dparse/trivia.d | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/dparse/trivia.d b/src/dparse/trivia.d index 0194b905..f1090cc9 100644 --- a/src/dparse/trivia.d +++ b/src/dparse/trivia.d @@ -34,6 +34,8 @@ CommentType determineCommentType(string comment) pure nothrow @safe switch (index) { case 1: + // Don't treat "////////...." comments as doc comments + isDoc = isDoc && (bytes.length == 3 || bytes[3..$].any!(c => c != '/')); return isDoc ? CommentType.docLine : CommentType.normalLine; case 2: case 3: @@ -54,6 +56,10 @@ unittest assert (determineCommentType("/* hello") == CommentType.normalBlock); assert (determineCommentType("/ hello") == CommentType.none); assert (determineCommentType("/") == CommentType.none); + + assert (determineCommentType("////////////////////") == CommentType.normalLine); + assert (determineCommentType("///") == CommentType.docLine); + assert (determineCommentType("/// ") == CommentType.docLine); } bool isDocComment(CommentType type) @safe nothrow pure