[Python-Dev] Re: A standard lexer?

Paul Prescod paul@prescod.net
Sun, 02 Jul 2000 11:38:54 -0500


Fredrik Lundh wrote:
> 
>...
>
> - add a new primitive to SRE: (?P#n), where n is a small integer.
>   this primitive sets the match object's "index" variable to n when
>   the engine stumbles upon it.

How about an interned string instead?
 
> - given a list of "phrases", combine them into a single regular
>   expression like this:
> 
>         (?:phrase1(?P#1))|(?:phrase2(?P#2))|...

Will sre do anything about optimizing common prefixes and so forth?

Overall, I like your proposal.

-- 
 Paul Prescod - Not encumbered by corporate consensus
The calculus and the rich body of mathematical analysis to which it 
gave rise made modern science possible, but it was the algorithm that 
made the modern world possible.
	- The Advent of the Algorithm (pending), by David Berlinski