digitalmars.D.bugs - [Issue 4367] New: std.regex: Captures is not a random access range
- d-bugmail puremagic.com (31/31) Jun 22 2010 http://d.puremagic.com/issues/show_bug.cgi?id=4367
- d-bugmail puremagic.com (10/10) Jun 22 2010 http://d.puremagic.com/issues/show_bug.cgi?id=4367
- d-bugmail puremagic.com (22/22) Jun 22 2010 http://d.puremagic.com/issues/show_bug.cgi?id=4367
- d-bugmail puremagic.com (10/10) Jan 09 2011 http://d.puremagic.com/issues/show_bug.cgi?id=4367
- d-bugmail puremagic.com (13/13) Jun 06 2011 http://d.puremagic.com/issues/show_bug.cgi?id=4367
http://d.puremagic.com/issues/show_bug.cgi?id=4367 Summary: std.regex: Captures is not a random access range Product: D Version: D2 Platform: All OS/Version: Linux Status: NEW Severity: normal Priority: P2 Component: Phobos AssignedTo: nobody puremagic.com ReportedBy: graham.fawcett gmail.com 06:12:47 PDT --- From the std.regex documentation: "Captures captures(). Retrieve the captured parenthesized matches, in the form of a random-access range." The Captures struct is not a random access range, because it is not a forward range. The following test program fails to compile: import std.regex; import std.range; void main() { auto c = match("hello", "[aeiou]").captures; alias typeof(c) C; static assert (isInputRange!C); // pass static assert (isForwardRange!C); // failure static assert (isBidirectionalRange!C); static assert (isRandomAccessRange!C); } -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Jun 22 2010
http://d.puremagic.com/issues/show_bug.cgi?id=4367 08:28:27 PDT --- Created an attachment (id=673) proposed patch This adds .save, .back and .popBack, making Captures a RandomAccessRange. Note: in my .save implementation, I think it's correct to use the same input, but to use a saved copy of matches. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Jun 22 2010
http://d.puremagic.com/issues/show_bug.cgi?id=4367 08:50:01 PDT --- Hm, did my patch implement 'back' correctly? It's not clear to me whether it should be this: return input[matches[$-1].startIdx .. matches[$-1].endIdx]; (as in my patch), or this: size_t end = length - 1; return input[matches[end].startIdx .. matches[end].endIdx]; The question arises from the definition of length(): property size_t length() { foreach (i; 0 .. matches.length) { if (matches[i].startIdx >= input.length) return i; } return matches.length; } So should back() use length() as a limit, or should it return the last element of matches? -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Jun 22 2010
http://d.puremagic.com/issues/show_bug.cgi?id=4367 Andrei Alexandrescu <andrei metalanguage.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|NEW |ASSIGNED CC| |andrei metalanguage.com AssignedTo|nobody puremagic.com |andrei metalanguage.com -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Jan 09 2011
http://d.puremagic.com/issues/show_bug.cgi?id=4367 Dmitry Olshansky <dmitry.olsh gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|ASSIGNED |RESOLVED CC| |dmitry.olsh gmail.com Resolution| |FIXED 08:10:36 PDT --- Apparently fixed in version 2.053 https://github.com/D-Programming-Language/phobos/commit/b68db973064ac7ad149cc42c3b4dc5416b576d21 -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Jun 06 2011