digitalmars.D - [Bug] I see ghosts: std.string.inPattern
- Andrew Edwards (27/27) Jun 05 2016 I encountered the following bug in std.string.inPattern:
- Andrew Edwards (4/7) Jun 05 2016 Never mind. Please forgive the noise:
I encountered the following bug in std.string.inPattern:
import std.stdio;
void main()
{
foreach (c; ' ' .. '~')
writeln(inPattern(c, " -~"));
}
Which is caused by this:
else if (range)
{
range = 0;
if (lastc <= c && c <= p || c == p)
return !result;
}
else if (p == '-' && i > result && i + 1 < pattern.length)
{
range = 1;
continue;
}
Before submitting the bug report and what I believe to be the fix
(simply deleting these lines from the implementation), I would
like to seek clarification on what exactly is being attempted
here. Why is would we conclude that arbitrary range of characters
were located after encountering an embedded '-' in any pattern
that's at least 3 characters long and pattern[0] <
pattern[indexOf['-'] + 1]?
Andrew
Jun 05 2016
On Monday, 6 June 2016 at 00:05:38 UTC, Andrew Edwards wrote:
I encountered the following bug in std.string.inPattern:
import std.stdio;
[...]
Never mind. Please forgive the noise:
https://dlang.org/phobos/std_string.html#.inPattern
Andrew
Jun 05 2016








Andrew Edwards <edwards.ac gmail.com>