Bug 7567 – Lazy quantifiers fail with ctRegex

Status
RESOLVED
Resolution
DUPLICATE
Severity
normal
Priority
P2
Component
phobos
Product
D
Version
D2
Platform
All
OS
All
Creation time
2012-02-23T09:30:00Z
Last change time
2012-04-19T09:36:11Z
Assigned to
nobody
Creator
beatgammit

Comments

Comment #0 by beatgammit — 2012-02-23T09:30:07Z
Overview: ctRegex fails to compile some regular expressions that regex does. Steps to reproduce: The following regular expressions fail with ctRegex, put work with regex compiled at runtime: (a+?)?b (a*?)?b (a{0,}?)?b (a{1,}?)?b Actual Results: I get the following error: /usr/include/d/dmd/phobos/std/regex.d(6486): found 'else' instead of statement Expected results: I expected ctRegex to behave the same as regex, and compile the same set of regular expressions. Build: DMD v2.058 Additional information: The following regular expressions work with both: (a{1,5}?)?b a*?b (a*?)b It seems to be a problem with having a lazy quantifier followed by the ?. I am building a regex to parse URIs: ^(?:(?P<scheme>[^:/?#]+):)?(?:(?P<slashes>//)?(?P<authority>[^/?#]*?)(?::(?P<port>\\d{1,5}))?)?(?P<path>/[^?#]*)(?:\\?(?P<query>[^#]*))?(?:#(?P <fragment>.*))?$ This works fine with the regex function, but breaks when I use ctRegex.
Comment #1 by dmitry.olsh — 2012-04-19T09:36:11Z
And right after this message I get the well known thingie: Error: assert(this.ir[orStart].code() == cast(IR)129u) failed C:\dmd2\src\phobos\std\regex.d 1150 So it's a duplicate of bug 7810 but the end result is more obscure. *** This issue has been marked as a duplicate of issue 7810 ***