summaryrefslogtreecommitdiffstats
path: root/Doc/tools
diff options
context:
space:
mode:
authorPablo Galindo <Pablogsal@gmail.com>2021-04-17 23:18:13 (GMT)
committerGitHub <noreply@github.com>2021-04-17 23:18:13 (GMT)
commitf5c5c0c362f84b3af168563ac9dec1d03cf8565a (patch)
treed4e8b510db32a091177ce760ce3fd10b7365546e /Doc/tools
parent0b1c169c4a009e1094fe5df938d2367e63ebeea0 (diff)
downloadcpython-f5c5c0c362f84b3af168563ac9dec1d03cf8565a.zip
cpython-f5c5c0c362f84b3af168563ac9dec1d03cf8565a.tar.gz
cpython-f5c5c0c362f84b3af168563ac9dec1d03cf8565a.tar.bz2
Fix type group capture in the PEG highlight tool (GH-25464)
Diffstat (limited to 'Doc/tools')
-rw-r--r--Doc/tools/extensions/peg_highlight.py9
1 files changed, 7 insertions, 2 deletions
diff --git a/Doc/tools/extensions/peg_highlight.py b/Doc/tools/extensions/peg_highlight.py
index 4ade1bf..42101be 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)),