Re: XML/HTML-specific ?< and ?> operators? (was Re: RFC 145 (alternate approach))
[email protected] (Richard Proctor) Thu, 7 Sep 2000 20:20:42 +0100 (BST)
| Newsgroups | perl.perl6.language.regex |
|---|---|
| Message-ID | <[email protected]> |
On Wed 06 Sep, Mark-Jason Dominus wrote:
>
> I've been thinking the same thing. It seems to me that the attempts to
> shoehorn parsers into regex syntax have either been unsuccessful
> (yielding an underpowered extension) or illegible or both.
>
>SNOBOL:
> parenstring = '(' *parenstring ')'
> | *parenstring *parenstring
> | span('()')
>
>
> This is not exactly the same, but I tried a direct translation:
>
> $re = qr{ \( (??{$re}) \)
> | (??{$re}) (??{$re})
> | (?> [^()]+)
> }x;
>
I think what is needed is something along the line of :
$re = qz{ '(' \$re ')'
| \$re \$re
| [^()]+
};
Where qz is some hypothetical new quoting syntax
Richard
--
[email protected]