regular expression engine and ranges

MrSmith via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Tue Dec 2 14:47:05 PST 2014


On Tuesday, 2 December 2014 at 19:17:43 UTC, ketmar via 
Digitalmars-d-learn wrote:
> Hello.
>
> is there any decent regular expression engine which works with 
> input
> ranges? under "decent" i mean "good D code", "[t]nfa" and "no
> backtracking". support for captures and greedy/non-greedy modes 
> are
> must.
>
> i found that some popular regex libraries and std.regex are 
> sure that
> the only data layout regex engine is supposed to work with is 
> plain
> text array. now, i'm writing a small text editor (yes, another 
> one;
> please, i know that there are alot of them already! ;-) and 
> internal
> text layout is anything but plain array. yet i want to use 
> regular
> expressions for alot of things -- not only for "search that 
> piece of
> text", but for syntax highlighting (i know, i know; don't think 
> about
> it, everything is much more complicated there), navigation and 
> so on.
>
> i was thinking that it will not be that hard, but found that if 
> you
> want to use existing regexp engine, you *have* to either use 
> plain
> array and alot of shitcode around it for bookkeeping to please 
> RE, or
> build that plain array each time you want to use RE. this sux.
>
> for now it seems that i have no choice except to write yet 
> another one
> regular expression engine. and this is the thing i don't want 
> to do.
> but maybe someone already did that and just don't think that it 
> worth
> publishing as we have std.regex and so?

IIRC, there was a request for ranged regex in phobos somewhere.
Is there anything simple that can be easily ported?

Btw, do you use ropes for text? What do you use for storing 
lines, wrapped lines and text style?


More information about the Digitalmars-d-learn mailing list