]> git.lizzy.rs Git - micro.git/commitdiff
Update rust syntax: char literal (#2162)
authorpyfisch <pyfisch@posteo.org>
Wed, 21 Jul 2021 16:37:41 +0000 (18:37 +0200)
committerGitHub <noreply@github.com>
Wed, 21 Jul 2021 16:37:41 +0000 (12:37 -0400)
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

index f24bcfb95b40211cef7231f07394cb3787cc7dfd..3e13f388f8ceeb7d5f8909944f4106c7606e6ae8 100644 (file)
@@ -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: []
-