On Tue 05 Sep, Nathan Wiger wrote:
> "normal" "reversed"
> -------------- ---------------
> 103 301
> 99a a99
> (( ))
> <+ +>
> {{[!<_ _>!]}}
> {__A1( )A1__}
>
> That is, when a bracket is encountered, the "reverse" of that is
> automatically interpreted as its closing counterpart. This is the same
> reason why qq// and qq() and qq{} all work without special notation.
>
> So we can replace @^g and @^G with simple precendence rules, the same
> that are actually invoked automatically throughout Perl already.
>
> > (?[( => ),{ => }, 01 => 10)
> >
> > sort of hashish in style.
>
> I actually think this is redundant, for the reasons I mentioned above.
> I'm not striking it down outright, but it seems simple rules could make
> all this unnecessary.
I dont think you will ever come up with a set of rules that will satisfy
everybody all the time. what about html comments <!-- , --> are they
brackets? What about people doing 66/99 pairs? The best you could
achieve is a set of default rules as you have suggested AND a way
of overriding them with an explicit hash of what is the closing
bracket for each opening bracket.
The two methods depend on what follows the (?[ is it a hash or not.
For the "Default" method the list of brackets could be as has been
suggested a regex, or perhaps a simple comma separated list. For this
you should define what is the "reverse" of each character, at
least for latin-1, what do you do about the full utf-8...? An \X type
construct that covers all the common brackets might be a usefull addition
({<?
If there is a hash, the hash supplies both the brackets to be matched and
their corresponding close brackets
Richard
--
[EMAIL PROTECTED]