Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix bugzilla issue 24871 - DDoc strips indent in triple slash comments #17082

Merged
merged 3 commits into from
Nov 25, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading