]> git.lizzy.rs Git - micro.git/blobdiff - runtime/syntax/go.yaml
Merge branch 'python-highlight-zero' of https://github.com/a11ce/micro into a11ce...
[micro.git] / runtime / syntax / go.yaml
index fe98124bcc5c5050aa2610748dbb4cee6ffc8472..3885c7b17d952f88d53d26ff1ef3773243ec0f5b 100644 (file)
@@ -1,31 +1,62 @@
 filetype: go
 
-detect: 
+detect:
     filename: "\\.go$"
 
 rules:
-    - special: "\\b(break|case|continue|default|go|goto|range|return)\\b"
-    - statement: "\\b(else|for|if|switch)\\b"
-    - preproc: "\\b(package|import|const|var|type|struct|func|go|defer|iota)\\b"
+    # Conditionals and control flow
+    - special: "\\b(break|case|continue|default|go|goto|range|return|println|fallthrough)\\b"
+    - statement: "\\b(else|for|if|switch|select)\\b"
+    - preproc: "\\b(package|import|const|var|type|struct|func|defer|iota|make|new|copy|len|cap|panic|append|close|delete|print|recover)\\b"
     - symbol.operator: "[-+/*=<>!~%&|^]|:="
-    - special: "[a-zA-Z0-9]*\\("
+
+      # Types
     - symbol: "(,|\\.)"
     - type: "\\b(u?int(8|16|32|64)?|float(32|64)|complex(64|128))\\b"
     - type: "\\b(uintptr|byte|rune|string|interface|bool|map|chan|error)\\b"
     - type.keyword: "\\b(struct)\\b"
     - constant.bool: "\\b(true|false|nil)\\b"
+
+      # Brackets
     - symbol.brackets: "(\\{|\\})"
     - symbol.brackets: "(\\(|\\))"
     - symbol.brackets: "(\\[|\\])"
+
+      # Numbers and strings
     - constant.number: "\\b([0-9]+|0x[0-9a-fA-F]*)\\b|'.'"
-    - constant.string: "\"(\\\\.|[^\"])*\"|'(\\\\.|[^'])*'"
-    - constant.specialChar: "\\\\[abfnrtv'\\\"\\\\]"
-    - constant.specialChar: "\\\\([0-7]{3}|x[A-Fa-f0-9]{2}|u[A-Fa-f0-9]{4}|U[A-Fa-f0-9]{8})"
-    - constant.string: "`[^`]*`"
-    - comment: "(^|[[:space:]])//.*"
+
+    - constant.string:
+        start: "\""
+        end: "\""
+        skip: "\\\\."
+        rules:
+            - constant.specialChar: "%."
+            - constant.specialChar: "\\\\[abfnrtv'\\\"\\\\]"
+            - constant.specialChar: "\\\\([0-7]{3}|x[A-Fa-f0-9]{2}|u[A-Fa-f0-9]{4}|U[A-Fa-f0-9]{8})"
+
+    - constant.string:
+        start: "'"
+        end: "'"
+        skip: "\\\\."
+        rules:
+            - error: "..+"
+            - constant.specialChar: "%."
+            - constant.specialChar: "\\\\[abfnrtv'\\\"\\\\]"
+            - constant.specialChar: "\\\\([0-7]{3}|x[A-Fa-f0-9]{2}|u[A-Fa-f0-9]{4}|U[A-Fa-f0-9]{8})"
+
+    - constant.string:
+        start: "`"
+        end: "`"
+        rules: []
+
+    - comment:
+        start: "//"
+        end: "$"
+        rules:
+            - todo: "(TODO|XXX|FIXME):?"
+
     - comment:
         start: "/\\*"
         end: "\\*/"
-        rules: []
-
-    - todo: "(TODO|XXX|FIXME):?"
+        rules:
+            - todo: "(TODO|XXX|FIXME):?"