www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 8529] New: ctRegex - named submatch - hash-table exception

reply d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=8529

           Summary: ctRegex - named submatch - hash-table exception
           Product: D
           Version: D2
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: normal
          Priority: P2
         Component: Phobos
        AssignedTo: nobody puremagic.com
        ReportedBy: wyrlon gmx.net


--- Comment #0 from Daniel <wyrlon gmx.net> 2012-08-09 09:40:46 PDT ---
Reported on v2.060 (but no version seems to work).

The code is based on the opIndex example from:
http://dlang.org/phobos/std_regex.html#regex

The normal regex version is functional, but when converting to ctRegex, the
hashtable lookup throws.(

auto m = match("a = 42;", 
ctRegex!(`(?P<var>\S+)\s*=\s*(?P<value>\d+);`));
auto c = m.captures;

// c["var"]; =>
core.exception.RangeError std.regex(2145): Range violation

// c["value"]; =>
Object.Exception C:\D\dmd2\windows\bin\..\..\src\phobos\std\regex.d(2145): 
no submatch named value

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Aug 09 2012
next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=8529


monarchdodra gmail.com changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |monarchdodra gmail.com


--- Comment #1 from monarchdodra gmail.com 2013-02-25 07:22:34 PST ---
(In reply to comment #0)
 Reported on v2.060 (but no version seems to work).
 
 The code is based on the opIndex example from:
 http://dlang.org/phobos/std_regex.html#regex
 
 The normal regex version is functional, but when converting to ctRegex, the
 hashtable lookup throws.(
 
 auto m = match("a = 42;", 
 ctRegex!(`(?P<var>\S+)\s*=\s*(?P<value>\d+);`));
 auto c = m.captures;
 
 // c["var"]; =>
 core.exception.RangeError std.regex(2145): Range violation
 
 // c["value"]; =>
 Object.Exception C:\D\dmd2\windows\bin\..\..\src\phobos\std\regex.d(2145): 
 no submatch named value

Just spent an hour duplicating this one. Bump. Since ctRegex is an "Experimental feature.", it may be worth documenting the existence of this bug in http://dlang.org/phobos/std_regex.html#.StaticRegex. If we don't know how to fix this, it may also be worth temporarily and statically turning down named captures in static regexes, with a "sorry" message. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Feb 25 2013
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=8529


monarchdodra gmail.com changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Severity|normal                      |major


-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Feb 25 2013
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=8529



--- Comment #2 from monarchdodra gmail.com 2013-02-25 07:31:42 PST ---
Bump for Dmitry.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Feb 25 2013
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=8529


Dmitry Olshansky <dmitry.olsh gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|                            |DUPLICATE


--- Comment #3 from Dmitry Olshansky <dmitry.olsh gmail.com> 2013-03-10
00:56:11 PST ---
Issue 9280 shows it's a general problem in CTFE version of regex parser

*** This issue has been marked as a duplicate of issue 9280 ***

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Mar 10 2013
prev sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=8529



--- Comment #4 from Dmitry Olshansky <dmitry.olsh gmail.com> 2013-03-10
01:08:30 PST ---
(In reply to comment #1)
 (In reply to comment #0)
 Reported on v2.060 (but no version seems to work).
 
 The code is based on the opIndex example from:
 http://dlang.org/phobos/std_regex.html#regex
 
 The normal regex version is functional, but when converting to ctRegex, the
 hashtable lookup throws.(
 


Turns out it's not hashtable but rather binary search on a broken array :( The good news is that the fix turns out to be trivial. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Mar 10 2013