]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
Fix type group capture in the PEG highlight tool (GH-25464)
authorPablo Galindo <Pablogsal@gmail.com>
Sat, 17 Apr 2021 23:18:13 +0000 (00:18 +0100)
committerGitHub <noreply@github.com>
Sat, 17 Apr 2021 23:18:13 +0000 (00:18 +0100)
Doc/tools/extensions/peg_highlight.py

index 4ade1bfeaa047f46ead890e810ba2b014f841cd2..42101be10ea9b6c80580b6eeac1aa497f7349432 100644 (file)
@@ -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)),