]> git.lizzy.rs Git - micro.git/commitdiff
Update rust syntax: don't highlight lifetimes (#2164)
authorpyfisch <pyfisch@posteo.org>
Wed, 21 Jul 2021 19:02:28 +0000 (21:02 +0200)
committerGitHub <noreply@github.com>
Wed, 21 Jul 2021 19:02:28 +0000 (15:02 -0400)
Work-around rust lifetimes and character literals both using single quotes.

runtime/syntax/rust.yaml

index 3e13f388f8ceeb7d5f8909944f4106c7606e6ae8..733227aa72ecf832e1a19bf0cc686af0d8b6de33 100644 (file)
@@ -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: "//"