From 84a490f14c06529da1683ea782897528e05660e0 Mon Sep 17 00:00:00 2001 From: pyfisch Date: Wed, 21 Jul 2021 21:02:28 +0200 Subject: [PATCH] Update rust syntax: don't highlight lifetimes (#2164) Work-around rust lifetimes and character literals both using single quotes. --- runtime/syntax/rust.yaml | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/runtime/syntax/rust.yaml b/runtime/syntax/rust.yaml index 3e13f388..733227aa 100644 --- a/runtime/syntax/rust.yaml +++ b/runtime/syntax/rust.yaml @@ -34,12 +34,16 @@ rules: rules: [] # Character literals + # NOTE: This is an ugly hack to work around the fact that rust uses + # single quotes both for character literals and lifetimes. + # Match all character literals. + - constant.string: "'(\\\\.|.)'" + # Match the '"' literal which would otherwise match + # as a double quoted string and destroy the highlighting. - constant.string: - start: "'" + start: "'\"" end: "'" - skip: '\\.' - rules: - - constant.specialChar: '\\.' + rules: [] - comment: start: "//"