]> git.lizzy.rs Git - micro.git/blobdiff - runtime/syntax/swift.yaml
Add skip statements to all strings
[micro.git] / runtime / syntax / swift.yaml
index 2e63c4fdeb771b84fc0a4e842eedfa2824634933..348480a15273ed8ba22bdbe8895587930a6789c3 100644 (file)
@@ -1,25 +1,51 @@
 filetype: swift
 
-detect: 
+detect:
     filename: "\\.swift$"
 
 rules:
-    - symbol.operator: "[.:;,+*|=!?\\%]|<|>|/|-|&"
-    - statement: "(class|import|let|var|struct|enum|func|if|else|switch|case|default|for|in|internal|external|unowned|private|public|throws)\\ "
-    - statement: "(prefix|postfix|operator|extension|lazy|get|set|self|willSet|didSet|override|super|convenience|weak|strong|mutating|return|guard)\\ "
-    - preproc: "(print)"
-    - preproc: "(init)"
+    # Operators
+    - statement: "([.:;,+*|=!?\\%]|<|>|/|-|&)"
+
+      # Statements
+    - statement:  "(class|import|let|var|struct|enum|func|if|else|switch|case|default|for|in|internal|external|unowned|private|public|throws)\\ "
+    - statement:  "(prefix|postfix|operator|extension|lazy|get|set|self|willSet|didSet|override|super|convenience|weak|strong|mutating|return|guard)\\ "
+
+      # Keywords
+    - statement: "(print)"
+    - statement: "(init)"
+
+      # Numbers
     - constant.number: "([0-9]+)"
+
+      # Standard Types
     - type: "\\ ((U)?Int(8|16|32|64))"
-    - constant.bool: "(true|false|nil)"
+    - constant: "(true|false|nil)"
     - type: "\\ (Double|String|Float|Boolean|Dictionary|Array|Int)"
     - type: "\\ (AnyObject)"
-    - constant.string: "\"[^\"]*\""
-    - comment: "//.*"
-    - comment: "///.*"
+
+    - constant.string:
+        start: "\""
+        end: "\""
+        skip: "\\\\."
+        rules:
+            - constant.specialChar: "\\\\."
+
+    - comment:
+        start: "//"
+        end: "$"
+        rules:
+            - todo: "(TODO|XXX|FIXME):?"
+
+    - comment:
+        start: "///"
+        end: "$"
+        rules:
+            - todo: "(TODO|XXX|FIXME):?"
+
     - comment:
         start: "/\\*\\*"
         end: "\\*/"
-        rules: []
+        rules:
+            - todo: "(TODO|XXX|FIXME):?"
 
-    - comment: "[/**]"