www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 10798] New: std.regex: ctRegex unicode set ops unimplemented

http://d.puremagic.com/issues/show_bug.cgi?id=10798

           Summary: std.regex: ctRegex unicode set ops unimplemented
           Product: D
           Version: D2
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: normal
          Priority: P2
         Component: Phobos
        AssignedTo: nobody puremagic.com
        ReportedBy: dmitry.olsh gmail.com


--- Comment #0 from Dmitry Olshansky <dmitry.olsh gmail.com> 2013-08-11
13:17:28 PDT ---
Another limitation of ctRegex vs regex that should be lifted. Full Unicode set
algebra is implemented using structural casts of POD structs that don't work in
CTFE.

import std.algorithm, std.regex;

void main()
{
    auto cr = regex("[abcd--c]*");
    auto m  = "abc".match(cr);
    assert(m);
    assert(m.hit == "ab");
}

Produces this messy equivalent of "sorry not there yet":

std\internal\uni.d(175): Error: array cast from uint[] to Interval[] is not
supported at compile time
std\regex.d(1707):        called from here: stack.top().sub(s)
std\regex.d(1730):        called from here: apply(opstack.pop(), vstack)
std\regex.d(1755):        called from here: unrollWhile(vstack, opstack)
std\regex.d(1755):        called from here: enforce(unrollWhile(vstack,
opstack), delegate const(char)[](
{
return "CodepointSet syntax error";
}
, "std\\regex.d", 1755u)
std\regex.d(1348):        called from here: this.parseCharset()
std\regex.d(1172):        called from here: this.parseAtom()
std\regex.d(910):        called from here: this.parseRegex()
std\regex.d(6473):        called from here: parser.this(pattern, flags)
std\regex.d(6466):        called from here: regexImpl(pattern, flags)
std\regex.d(6481):        called from here: regex("[abc--b]*", [])
std\regex.d(6507): Error: template instance std.regex.ctRegexImpl!("[abc--b]*",
[]) error instantiating
test_reg.d(26):        instantiated from here: ctRegex!"[abc--b]*"
test_reg.d(26): Error: template instance std.regex.ctRegex!"[abc--b]*" error
instantiating

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Aug 11 2013