From d395701a43fba9504c9373cee7ca829cbf766065 Mon Sep 17 00:00:00 2001 From: Miikka Salminen Date: Fri, 23 Oct 2015 02:55:14 +0300 Subject: Added support and documentation for magic method and variable tokens. Reflected this change in an updated version of my older style, Lovelace. Added Python lexing for Python's magic methods and variables. --- pygments/lexers/python.py | 69 ++++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 68 insertions(+), 1 deletion(-) (limited to 'pygments/lexers/python.py') diff --git a/pygments/lexers/python.py b/pygments/lexers/python.py index ccbd4c15..84f61242 100644 --- a/pygments/lexers/python.py +++ b/pygments/lexers/python.py @@ -69,6 +69,8 @@ class PythonLexer(RegexLexer): (r'(import)((?:\s|\\\s)+)', bygroups(Keyword.Namespace, Text), 'import'), include('builtins'), + include('magicfuncs'), + include('magicvars'), include('backtick'), ('(?:[rR]|[uU][rR]|[rR][uU])"""', String.Double, 'tdqs'), ("(?:[rR]|[uU][rR]|[rR][uU])'''", String.Single, 'tsqs'), @@ -123,6 +125,37 @@ class PythonLexer(RegexLexer): 'ZeroDivisionError'), prefix=r'(?