Skip to content

Commit 58ecfc5

Browse files
committed
doc: Provide a slice overload of skipWhitespace
1 parent 365a6a5 commit 58ecfc5

1 file changed

Lines changed: 11 additions & 6 deletions

File tree

src/dmd/doc.d

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1841,20 +1841,25 @@ extern (C++) bool isDitto(const(char)* comment)
18411841
*/
18421842
extern (C++) const(char)* skipwhitespace(const(char)* p)
18431843
{
1844-
for (; 1; p++)
1844+
return skipwhitespace(p.toDString).ptr;
1845+
}
1846+
1847+
/// Ditto
1848+
extern (D) const(char)[] skipwhitespace(const(char)[] p)
1849+
{
1850+
foreach (idx, char c; p)
18451851
{
1846-
switch (*p)
1852+
switch (c)
18471853
{
18481854
case ' ':
18491855
case '\t':
18501856
case '\n':
1851-
continue;
1852-
default:
18531857
break;
1858+
default:
1859+
return p[idx .. $];
18541860
}
1855-
break;
18561861
}
1857-
return p;
1862+
return p[$ .. $];
18581863
}
18591864

18601865
/************************************************

0 commit comments

Comments
 (0)