Richard Proctor wrote:
> 
> No ?] should match the closest ?[ it should nest the ?[s bound by any
> brackets in the regex and act accordingly.

Good point.
 
> Also this does not work as a definition of simple bracket matching as you
> need ( to match ) not ( to match (.  A ?[ list should specify for each
> element what the matching element is perhaps

Actually, it should with some simple precedence rules. If ?] reverses
the ordering of ?[, *and* we define "reversing" for bracketed pairs
consistent with the current Perl definition in other contexts, then this
is all automatic:

   "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. 

-Nate

Reply via email to