[Python-checkins] Fix type group capture in the PEG highlight tool (GH-25464)

pablogsal webhook-mailer at python.org
Sat Apr 17 19:18:17 EDT 2021


https://github.com/python/cpython/commit/f5c5c0c362f84b3af168563ac9dec1d03cf8565a
commit: f5c5c0c362f84b3af168563ac9dec1d03cf8565a
branch: master
author: Pablo Galindo <Pablogsal at gmail.com>
committer: pablogsal <Pablogsal at gmail.com>
date: 2021-04-18T00:18:13+01:00
summary:

Fix type group capture in the PEG highlight tool (GH-25464)

files:
M Doc/tools/extensions/peg_highlight.py

diff --git a/Doc/tools/extensions/peg_highlight.py b/Doc/tools/extensions/peg_highlight.py
index 4ade1bfeaa047..42101be10ea9b 100644
--- a/Doc/tools/extensions/peg_highlight.py
+++ b/Doc/tools/extensions/peg_highlight.py
@@ -42,14 +42,19 @@ class PEGLexer(RegexLexer):
             (r"(@\w+ '''(.|\n)+?''')", bygroups(None)),
             (r"^(@.*)$", bygroups(None)),
         ],
-        "actions": [(r"{(.|\n)+?}", bygroups(None)),],
+        "actions": [
+            (r"{(.|\n)+?}", bygroups(None)),
+        ],
         "strings": [
             (r"'\w+?'", Keyword),
             (r'"\w+?"', Keyword),
             (r"'\W+?'", Text),
             (r'"\W+?"', Text),
         ],
-        "variables": [(_name + _text_ws + r"(\[.*\])?" + _text_ws + "(=)", bygroups(None, None, None, None, None),),],
+        "variables": [
+            (_name + _text_ws + "(=)", bygroups(None, None, None),),
+            (_name + _text_ws + r"(\[[\w\d_\*]+?\])" + _text_ws + "(=)", bygroups(None, None, None, None, None),),
+        ],
         "invalids": [
             (r"^(\s+\|\s+invalid_\w+\s*\n)", bygroups(None)),
             (r"^(\s+\|\s+incorrect_\w+\s*\n)", bygroups(None)),



More information about the Python-checkins mailing list