From b6a51ece09e31d3db2b732c8536a533b6de74768 Mon Sep 17 00:00:00 2001 From: Tristan Havelick Date: Sat, 5 Apr 2025 11:07:56 -0600 Subject: [PATCH] fix lua regex causing runaway backtracking. Use negative lookahead to avoid runway backtracking in whitespace. Fixes #2839 --- pygments/lexers/scripting.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pygments/lexers/scripting.py b/pygments/lexers/scripting.py index 3ab32c0948..6e494c33b8 100644 --- a/pygments/lexers/scripting.py +++ b/pygments/lexers/scripting.py @@ -57,7 +57,7 @@ class LuaLexer(RegexLexer): _comment_multiline = r'(?:--\[(?P=*)\[[\w\W]*?\](?P=level)\])' _comment_single = r'(?:--.*$)' - _space = r'(?:\s+)' + _space = r'(?:\s+(?!\s))' _s = rf'(?:{_comment_multiline}|{_comment_single}|{_space})' _name = r'(?:[^\W\d]\w*)'