On Thu, 13 Jun 2002, David Whipp wrote:
: Second, we should eliminate as much of the syntactic noise as possible:
: 
:   <max b.*a b.*s>
: 
: would be nice -- with parenthesis, or the like, needed only when things
: become ambiguous. I think, though am not sure, that having whitespace act as
: an arglist separator in assertions makes it cleaner. There are definitely
: strong counter-arguments. But I would like to minimize the clutter: and the
: baseline is that alternation requires only one character.

That would be problematic as a default rule.  You wouldn't be able
to write assertions like:

    <before a | b>

To get more syntactic control would take something like a macro
facility.  But that has its own problems.  Regexes will be tough
to debug even without that.

I think the biggest drawback is that it goes against the shiny new
policy about (in)significant whitespace.

On the other hand, it might be possible with regex introspection
to dissect the alternatives of

    <max b.*a | b.*s >

and evaluate them separately.

But the most straightforward way to match longest is probably to use
:any to get a superposition of matches, and then pull out the longest
match.  Perhaps there could be a :longest that does that internally,
and could optimize away cases that couldn't possibly be longest.
(And possibly even invoke a DFA optimizer to make it one pass, in
the absence of internal captures.)

Larry

Reply via email to