]> git.lizzy.rs Git - micro.git/blobdiff - runtime/syntax/lua.yaml
better top
[micro.git] / runtime / syntax / lua.yaml
index 3ee256e1f47a024f2dd1f2f7bced137b02837876..e5dab4efd9071c0f7c9cd8dcc5d156c54855d894 100644 (file)
@@ -18,11 +18,13 @@ rules:
     - identifier: "coroutine\\.\\b(create|isyieldable|resume|running|status|wrap|yield)\\b"
     - identifier: "debug\\.\\b(debug|getfenv|gethook|getinfo|getlocal|getmetatable|getregistry|getupvalue|getuservalue|setfenv|sethook|setlocal|setmetatable|setupvalue|setuservalue|traceback|upvalueid|upvaluejoin)\\b"
     - identifier: "bit32\\.\\b(arshift|band|bnot|bor|btest|bxor|extract|replace|lrotate|lshift|rrotate|rshift)\\b"
-    - identifier: "\\:\\b(close|flush|lines|read|seek|setvbuf|write)\\b"
+    - identifier: "\\:\\b(close|flush|lines|read|seek|setvbuf|write|byte|char|dump|find|format|gmatch|gsub|len|lower|match|pack|packsize|rep|reverse|sub|unpack|upper)\\b"
+    - identifier: "\\b(self|arg)\\b"
     - constant: "\\b(false|nil|true)\\b"
     - statement: "(\\b(dofile|require|include)|%q|%!|%Q|%r|%x)\\b"
     - constant.number: "\\b([0-9]+)\\b"
-    - symbol: "(\\(|\\)|\\[|\\]|\\{|\\}|\\*\\*|\\*|/|%|\\+|-|\\^|>|>=|<|<=|~=|=|\\.\\.|#)"
+    - symbol.brackets: "[(){}\\[\\]]"
+    - symbol: "(\\*|//|/|%|\\+|-|\\^|>|>=|<|<=|~=|=|[\\.]{2,3}|#)"
 
     - constant.string:
         start: "\""
@@ -44,17 +46,71 @@ 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|XXX|FIXME):?"
+            - todo: "(TODO|NOTE|FIXME):?"
+
+    - comment.block:
+        start: "\\-\\-\\[====+\\["
+        end: "\\]====+\\]"
+        rules:
+            - todo: "(TODO|NOTE|FIXME):?"
 
 # this has to go after block comment or block comment does not work
 
     - comment: 
         start: "\\-\\-"
         end: "$"
-        rules: []
\ No newline at end of file
+        rules:
+            - todo: "(TODO|NOTE|FIXME):?"