]> git.lizzy.rs Git - micro.git/blobdiff - runtime/syntax/c.yaml
Merge branch 'PR-find-on-type' of https://github.com/ilius/micro into ilius-PR-find...
[micro.git] / runtime / syntax / c.yaml
index dcb48995b3e25f0cd3b72f35760ef3e7a3a74a93..15310ee82053fced3984192caa4b0597e3591a20 100644 (file)
@@ -1,30 +1,49 @@
 filetype: c
 
-detect: 
-    filename: "\\.(c|C)$|\\.(h|H)$|\\.ii?$|\\.(def)$"
+detect:
+    filename: "(\\.(c|C)$|\\.(h|H)$|\\.ii?$|\\.(def)$)"
 
 rules:
     - identifier: "\\b[A-Z_][0-9A-Z_]+\\b"
     - type: "\\b(float|double|char|int|short|long|sizeof|enum|void|static|const|struct|union|typedef|extern|(un)?signed|inline)\\b"
     - type: "\\b((s?size)|((u_?)?int(8|16|32|64|ptr)))_t\\b"
     - type.extended: "\\b(bool)\\b"
-    - statement: "\\b(typename|mutable|volatile|register|explicit)\\b"
+    - statement: "\\b(volatile|register)\\b"
     - statement: "\\b(for|if|while|do|else|case|default|switch)\\b"
-    - statement: "\\b(try|throw|catch|operator|new|delete)\\b"
-    - special: "\\b(goto|continue|break|return)\\b"
+    - statement: "\\b(goto|continue|break|return)\\b"
     - preproc: "^[[:space:]]*#[[:space:]]*(define|pragma|include|(un|ifn?)def|endif|el(if|se)|if|warning|error)"
-    - constant: "'([^'\\\\]|(\\\\[\"'abfnrtv\\\\]))'|'\\\\(([0-3]?[0-7]{1,2}))'|'\\\\x[0-9A-Fa-f]{1,2}'"
-    - statement: "__attribute__[[:space:]]*\\(\\([^)]*\\)\\)|__(aligned|asm|builtin|hidden|inline|packed|restrict|section|typeof|weak)__"
-    - constant.string: "<.+?>"
-    - symbol.operator: "[.:;,+*|=!\\%]|<|>|/|-|&"
+      # GCC builtins
+    - statement: "__attribute__[[:space:]]*\\(\\([^)]*\\)\\)"
+    - statement: "__(aligned|asm|builtin|hidden|inline|packed|restrict|section|typeof|weak)__"
+      # Operator Color
+    - symbol.operator: "([.:;,+*|=!\\%]|<|>|/|-|&)"
     - symbol.brackets: "[(){}]|\\[|\\]"
-    - constant.number: "\\b[0-9]+\\b|\\b0x[0-9A-Fa-f]+\\b"
+    - constant.number: "(\\b[0-9]+\\b|\\b0x[0-9A-Fa-f]+\\b)"
     - constant.number: "NULL"
-    - constant.string: "\"(\\\\.|[^\"])*\""
-    - comment: "//.*"
+
+    - constant.string:
+        start: "\""
+        end: "\""
+        skip: "\\\\."
+        rules:
+            - constant.specialChar: "\\\\([\"'abfnrtv\\\\]|[0-3]?[0-7]{1,2}|x[0-9A-Fa-f]{1,2}|u[0-9A-Fa-f]{4}|U[0-9A-Fa-f]{8})"
+
+    - constant.string:
+        start: "'"
+        end: "'"
+        skip: "\\\\."
+        rules:
+            - error: "..+"
+            - constant.specialChar: "\\\\([\"'abfnrtv\\\\]|[0-3]?[0-7]{1,2}|x[0-9A-Fa-f]{1,2}|u[0-9A-Fa-f]{4}|U[0-9A-Fa-f]{8})"
+
+    - comment:
+        start: "//"
+        end: "$"
+        rules:
+            - todo: "(TODO|XXX|FIXME):?"
+
     - comment:
         start: "/\\*"
         end: "\\*/"
-        rules: []
-
-    - indent-char.whitespace: "[[:space:]]+$"
+        rules:
+            - todo: "(TODO|XXX|FIXME):?"