From 44ee991585d2628849955cdb62c78982dd152b8e Mon Sep 17 00:00:00 2001 From: Aaron Bentley Date: Sat, 24 Sep 2022 17:54:08 -0400 Subject: Use words() with suffix inline. --- pygments/lexers/jsonnet.py | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/pygments/lexers/jsonnet.py b/pygments/lexers/jsonnet.py index bcb2056b..decb28cd 100644 --- a/pygments/lexers/jsonnet.py +++ b/pygments/lexers/jsonnet.py @@ -36,12 +36,6 @@ comments = [ ] -keywords = words([ - 'assert', 'else', 'error', 'false', 'for', 'if', 'import', 'importstr', - 'in', 'null', 'tailstrict', 'then', 'self', 'super', 'true', -]).get() - - rvalues = comments + [ (r"@'.*'", String), (r'@".*"', String), @@ -55,7 +49,10 @@ rvalues = comments + [ (r'\[', Punctuation, 'array'), (r'local\b', Keyword, ('local_name')), (r'assert', Keyword, 'assert'), - (fr'({keywords})(?!{jsonnet_token_chars})', Keyword), + (words([ + 'assert', 'else', 'error', 'false', 'for', 'if', 'import', 'importstr', + 'in', 'null', 'tailstrict', 'then', 'self', 'super', 'true', + ], suffix=r'\b'), Keyword), (r'\s+', Whitespace), (r'function(?=\()', Keyword, 'function_params'), (r'std\.' + jsonnet_function_token, Name.Builtin, 'function_args'), -- cgit v1.2.1