Skip to content

Commit f5c5c0c

Browse files
authored
Fix type group capture in the PEG highlight tool (GH-25464)
1 parent 0b1c169 commit f5c5c0c

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

Doc/tools/extensions/peg_highlight.py

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,14 +42,19 @@ class PEGLexer(RegexLexer):
4242
(r"(@\w+ '''(.|\n)+?''')", bygroups(None)),
4343
(r"^(@.*)$", bygroups(None)),
4444
],
45-
"actions": [(r"{(.|\n)+?}", bygroups(None)),],
45+
"actions": [
46+
(r"{(.|\n)+?}", bygroups(None)),
47+
],
4648
"strings": [
4749
(r"'\w+?'", Keyword),
4850
(r'"\w+?"', Keyword),
4951
(r"'\W+?'", Text),
5052
(r'"\W+?"', Text),
5153
],
52-
"variables": [(_name + _text_ws + r"(\[.*\])?" + _text_ws + "(=)", bygroups(None, None, None, None, None),),],
54+
"variables": [
55+
(_name + _text_ws + "(=)", bygroups(None, None, None),),
56+
(_name + _text_ws + r"(\[[\w\d_\*]+?\])" + _text_ws + "(=)", bygroups(None, None, None, None, None),),
57+
],
5358
"invalids": [
5459
(r"^(\s+\|\s+invalid_\w+\s*\n)", bygroups(None)),
5560
(r"^(\s+\|\s+incorrect_\w+\s*\n)", bygroups(None)),

0 commit comments

Comments
 (0)