Skip to content

Commit fc76c62

Browse files
committed
doc: Provide a slice overload of skipWhitespace
1 parent c7be5e9 commit fc76c62

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
@@ -1833,20 +1833,25 @@ extern (C++) bool isDitto(const(char)* comment)
18331833
*/
18341834
extern (C++) const(char)* skipwhitespace(const(char)* p)
18351835
{
1836-
for (; 1; p++)
1836+
return skipwhitespace(p.toDString).ptr;
1837+
}
1838+
1839+
/// Ditto
1840+
extern (D) const(char)[] skipwhitespace(const(char)[] p)
1841+
{
1842+
foreach (idx, char c; p)
18371843
{
1838-
switch (*p)
1844+
switch (c)
18391845
{
18401846
case ' ':
18411847
case '\t':
18421848
case '\n':
1843-
continue;
1844-
default:
18451849
break;
1850+
default:
1851+
return p[idx .. $];
18461852
}
1847-
break;
18481853
}
1849-
return p;
1854+
return p[$ .. $];
18501855
}
18511856

18521857
/************************************************

0 commit comments

Comments
 (0)