filename: "\\.lua$"
rules:
- - statement: "\\b(do|end|while|repeat|until|if|elseif|then|else|for|in|function|local|return)\\b"
+ - statement: "\\b(do|end|while|break|repeat|until|if|elseif|then|else|for|in|function|local|return)\\b"
- statement: "\\b(not|and|or)\\b"
- statement: "\\b(debug|string|math|table|io|coroutine|os|utf8|bit32)\\b\\."
- statement: "\\b(_ENV|_G|_VERSION|assert|collectgarbage|dofile|error|getfenv|getmetatable|ipairs|load|loadfile|module|next|pairs|pcall|print|rawequal|rawget|rawlen|rawset|require|select|setfenv|setmetatable|tonumber|tostring|type|unpack|xpcall)\\s*\\("
- 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: "\""
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):?"
start: "\\-\\-"
end: "$"
rules:
- - todo: "(TODO|NOTE|FIXME):?"
+ - todo: "(TODO|NOTE|FIXME):?"