From 42a9302636d1d78704cbaf174151aa3dc23c6c07 Mon Sep 17 00:00:00 2001 From: pyfisch Date: Wed, 21 Jul 2021 18:37:41 +0200 Subject: [PATCH] Update rust syntax: char literal (#2162) Highlight character literals started with a single quote ('). Importantly this ensures correct highlighting for the character literal '"'. Limitation: rust char literals contain exactly one character, however this isn't checked by the highlighter. Closes #2160 --- runtime/syntax/rust.yaml | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/runtime/syntax/rust.yaml b/runtime/syntax/rust.yaml index f24bcfb9..3e13f388 100644 --- a/runtime/syntax/rust.yaml +++ b/runtime/syntax/rust.yaml @@ -24,15 +24,23 @@ rules: - constant.string: start: "\"" end: "\"" - skip: "\\\\." + skip: '\\.' rules: - - constant.specialChar: "\\\\." + - constant.specialChar: '\\.' - constant.string: start: "r#+\"" end: "\"#+" rules: [] + # Character literals + - constant.string: + start: "'" + end: "'" + skip: '\\.' + rules: + - constant.specialChar: '\\.' + - comment: start: "//" end: "$" @@ -49,4 +57,3 @@ rules: start: "#!\\[" end: "\\]" rules: [] -