On Sun, Oct 12, 2008 at 11:44:05AM +0200, Moritz Lenz wrote:
> When we write regexes, we generally capture stuff in a way that makes
> the following semantic analysis easier. For example we could have a
> regex m/ <this>+ <that>? <this>*/ if we're only interested in the match
> trees of what <this> and <that> matches, not their respective order.
> [...]
> But if you want to re-used the match tree for something different (say,
> instead of doing a semantic analysis we want to do syntax hilighting)
> it's rather hard to reconstruct the original text, and what part of it
> was matched by which subrule. 

Perhaps aliases...?

    m/ <this>+ <that>? <andthen=this>* /

This is probably not exactly what you're looking for, but
that would be what I would look at for this specific example.

Pm

Reply via email to