A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://mail.python.org/pipermail/python-dev/2000-July/005331.html below:

[Python-Dev] A standard lexer?

[Python-Dev] A standard lexer? [Python-Dev] A standard lexer?Fredrik Lundh Fredrik Lundh" <effbot@telia.com
Mon, 3 Jul 2000 00:35:28 +0200
tim wrote:
> >         for phrase, action in lexicon:
> >             p.append("(?:%s)(?P#%d)" % (phrase, len(p)))
>=20
> How about instead enhancing existing (?P<name>pattern) notation, to =
set a
> new match object attribute to name if & when pattern matches?  Then
> arbitrary info associated with a named pattern can be gotten at via =
dicts
> via the pattern name, & the whole mess should be more readable.

I just added "lastindex" and "lastgroup" attributes to the match object.

"lastindex" is the integer index of the last matched capturing group,
"lastgroup" the corresponding name (or None, if the group didn't have
a name).  both attributes are None if no group were matched.

</F>




RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4