ddoc24871
+-
+
-
+ +++
main
++++ +++Declaration
++++
++ void
+main
(); + +++ ++ + +++ ++ Example + +
++ + +++++-
+
void main() { + foreach (i; 0..10) { + writeln("Hello, world!"); + } +} +
+
+
diff --git a/compiler/src/dmd/lexer.d b/compiler/src/dmd/lexer.d index a6cf4747bc9d..1779b8440a3e 100644 --- a/compiler/src/dmd/lexer.d +++ b/compiler/src/dmd/lexer.d @@ -3441,15 +3441,10 @@ class Lexer if (*q != ct) break; } - /* Remove leading spaces until start of the comment + /* Remove leading line feed */ int linestart = 0; - if (ct == '/') - { - while (q < qend && (*q == ' ' || *q == '\t')) - ++q; - } - else if (q < qend) + if (ct != '/' && q < qend) { if (*q == '\r') { diff --git a/compiler/test/compilable/ddoc24871.d b/compiler/test/compilable/ddoc24871.d new file mode 100644 index 000000000000..590a5629d6b0 --- /dev/null +++ b/compiler/test/compilable/ddoc24871.d @@ -0,0 +1,19 @@ +// 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!"); + +} + diff --git a/compiler/test/compilable/extra-files/ddoc14413.html b/compiler/test/compilable/extra-files/ddoc14413.html index f4587805f58c..98643df73bf9 100644 --- a/compiler/test/compilable/extra-files/ddoc14413.html +++ b/compiler/test/compilable/extra-files/ddoc14413.html @@ -542,8 +542,8 @@
This should -be one -paragraph. + be one + paragraph.
main
+
+
+ void
+ main
();
+
+
+ Example
+
+
+
+ void main() {
+ foreach (i; 0..10) {
+ writeln("Hello, world!");
+ }
+}
+