]> git.lizzy.rs Git - micro.git/blobdiff - runtime/syntax/lua.yaml
Merge pull request #1315 from matbesancon/patch-1
[micro.git] / runtime / syntax / lua.yaml
index cb1ee24e15af66b75e4ce0aacb9d37385f76f5e3..e5dab4efd9071c0f7c9cd8dcc5d156c54855d894 100644 (file)
@@ -23,7 +23,8 @@ rules:
     - constant: "\\b(false|nil|true)\\b"
     - statement: "(\\b(dofile|require|include)|%q|%!|%Q|%r|%x)\\b"
     - constant.number: "\\b([0-9]+)\\b"
-    - symbol: "(\\(|\\)|\\[|\\]|\\{|\\}|\\*\\*|\\*|/|%|\\+|-|\\^|>|>=|<|<=|~=|=|[\\.]{2,3}|#)"
+    - symbol.brackets: "[(){}\\[\\]]"
+    - symbol: "(\\*|//|/|%|\\+|-|\\^|>|>=|<|<=|~=|=|[\\.]{2,3}|#)"
 
     - constant.string:
         start: "\""
@@ -45,11 +46,64 @@ rules:
         rules:
             - constant.specialChar: "\\\\."
 
+# support first few lengths of "long brackets" explicitly
+# brackets longer than that will give false positives
+
+    - constant.string:
+        start: "\\[=\\["
+        end: "\\]=\\]"
+        rules:
+            - constant.specialChar: "\\\\."
+
+    - constant.string:
+        start: "\\[==\\["
+        end: "\\]==\\]"
+        rules:
+            - constant.specialChar: "\\\\."
+
+    - constant.string:
+        start: "\\[===\\["
+        end: "\\]===\\]"
+        rules:
+            - constant.specialChar: "\\\\."
+
+    - constant.string:
+        start: "\\[====+\\["
+        end: "\\]====+\\]"
+        rules:
+            - constant.specialChar: "\\\\."
+
     - special: "\\\\[0-7][0-7][0-7]|\\\\x[0-9a-fA-F][0-9a-fA-F]|\\\\[abefnrs]|(\\\\c|\\\\C-|\\\\M-|\\\\M-\\\\C-)."
 
     - comment.block:
-        start: "\\-\\-\\[(\\=*|\\#*)\\["
-        end: "\\-\\-\\](\\=*|\\#*)\\]"
+        start: "\\-\\-\\[\\["
+        end: "\\]\\]"
+        rules:
+            - todo: "(TODO|NOTE|FIXME):?"
+
+# support long brackets, same as with multiline strings
+
+    - comment.block:
+        start: "\\-\\-\\[=\\["
+        end: "\\]=\\]"
+        rules:
+            - todo: "(TODO|NOTE|FIXME):?"
+
+    - comment.block:
+        start: "\\-\\-\\[==\\["
+        end: "\\]==\\]"
+        rules:
+            - todo: "(TODO|NOTE|FIXME):?"
+
+    - comment.block:
+        start: "\\-\\-\\[===\\["
+        end: "\\]===\\]"
+        rules:
+            - todo: "(TODO|NOTE|FIXME):?"
+
+    - comment.block:
+        start: "\\-\\-\\[====+\\["
+        end: "\\]====+\\]"
         rules:
             - todo: "(TODO|NOTE|FIXME):?"
 
@@ -59,4 +113,4 @@ rules:
         start: "\\-\\-"
         end: "$"
         rules:
-          - todo: "(TODO|NOTE|FIXME):?"
+            - todo: "(TODO|NOTE|FIXME):?"