summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAaron Bentley <aaron@aaronbentley.com>2022-09-24 17:54:08 -0400
committerJean Abou-Samra <jean@abou-samra.fr>2022-09-25 15:21:11 +0200
commit44ee991585d2628849955cdb62c78982dd152b8e (patch)
treea3b46461ea6c75776b339b2ee18198b47bc891c0
parent865d77a511934b989ddb4ca21b26823cf930f17b (diff)
downloadpygments-git-44ee991585d2628849955cdb62c78982dd152b8e.tar.gz
Use words() with suffix inline.
-rw-r--r--pygments/lexers/jsonnet.py11
1 files 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'),