Skip to content

Commit

Permalink
Merge pull request #17082 from ArthaTi/fix-24871
Browse files Browse the repository at this point in the history
Fix bugzilla issue 24871 - DDoc strips indent in triple slash comments

Signed-off-by: Dennis <[email protected]>
Signed-off-by: Nicholas Wilson <[email protected]>
Merged-on-behalf-of: Nicholas Wilson <[email protected]>
  • Loading branch information
dlang-bot authored Nov 25, 2024
2 parents a36acce + 0c09587 commit 949cb11
Show file tree
Hide file tree
Showing 3 changed files with 597 additions and 2 deletions.
5 changes: 3 additions & 2 deletions compiler/src/dmd/lexer.d
Original file line number Diff line number Diff line change
Expand Up @@ -3441,13 +3441,14 @@ class Lexer
if (*q != ct)
break;
}
/* Remove leading spaces until start of the comment
/* Remove leading line feed or space
*/
int linestart = 0;
if (ct == '/')
{
while (q < qend && (*q == ' ' || *q == '\t'))
if (q < qend && *q == ' ') {
++q;
}
}
else if (q < qend)
{
Expand Down
18 changes: 18 additions & 0 deletions compiler/test/compilable/ddoc24871.d
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
// PERMUTE_ARGS:
// REQUIRED_ARGS: -D -Dd${RESULTS_DIR}/compilable -o-
// POST_SCRIPT: compilable/extra-files/ddocAny-postscript.sh
import std.stdio;

/// Example
/// ---
/// void main() {
/// foreach (i; 0..10) {
/// writeln("Hello, world!");
/// }
/// }
/// ---
void main() {

writeln("Hello, World!");

}
Loading

0 comments on commit 949cb11

Please sign in to comment.