]> git.lizzy.rs Git - micro.git/blobdiff - runtime/syntax/rust.yaml
better top
[micro.git] / runtime / syntax / rust.yaml
index 53e97d1213e5f2c412c1a26f5d9430eb29cb4e65..9bc19017c7c5b1a355a0143594c30854342ac018 100644 (file)
@@ -1,35 +1,48 @@
 filetype: rust
 
-detect: 
-    filename: "\\.rs"
+detect:
+    filename: "\\.rs$"
 
 rules:
-    - identifier.class: "fn [a-z0-9_]+"
+    # function definition
+    - identifier: "fn [a-z0-9_]+"
+      # Reserved words
     - statement: "\\b(abstract|alignof|as|become|box|break|const|continue|crate|do|else|enum|extern|false|final|fn|for|if|impl|in|let|loop|macro|match|mod|move|mut|offsetof|override|priv|pub|pure|ref|return|sizeof|static|self|struct|super|true|trait|type|typeof|unsafe|unsized|use|virtual|where|while|yield)\\b"
-    - identifier.macro: "[a-z_]+!"
+      # macros
+    - special: "[a-z_]+!"
+      # Constants
     - constant: "[A-Z][A-Z_]+"
+      # Numbers
     - constant.number: "\\b[0-9]+\\b"
+      # Traits/Enums/Structs/Types/etc.
     - type: "[A-Z][a-z]+"
-    - constant.string: "\\\".*\\\""
+
     - constant.string:
-        start: "\\\".*\\\\$"
-        end: ".*\\\""
-        rules: []
+        start: "\""
+        end: "\""
+        skip: "\\\\."
+        rules:
+            - constant.specialChar: "\\\\."
 
-    - special:
-        start: "r#+\\\""
-        end: "\\\"#+"
+    - constant.string:
+        start: "r#+\""
+        end: "\"#+"
         rules: []
 
-    - comment: "//.*"
+    - comment:
+        start: "//"
+        end: "$"
+        rules:
+            - todo: "(TODO|XXX|FIXME):?"
+
     - comment:
         start: "/\\*"
         end: "\\*/"
-        rules: []
+        rules:
+            - todo: "(TODO|XXX|FIXME):?"
 
     - special:
         start: "#!\\["
         end: "\\]"
         rules: []
 
-    - todo: "(XXX|TODO|FIXME|\\?\\?\\?)"