syntax: lua: do not color strings inside comments, and add a linter

Also, don't partially color "..." as an operator, because it isn't,
and color also the unary operator "#".

Signed-off-by: Mark-Weston <markweston@cock.li>
master
Mark-Weston 2018-08-05 14:38:52 +03:00 committed by Benno Schulenberg
parent a18b48f0f7
commit bf5949395d
1 changed files with 7 additions and 4 deletions

View File

@ -5,12 +5,15 @@
syntax lua "\.lua$"
magic "Lua script"
linter "luacheck --no-color"
comment "--"
color brightwhite "\[\[.*\]\]"
# Operators
color brightyellow ":|\*|/|%|\+|-|\^|>|>=|<|<=|~=|=|\.\.|\<(not|and|or)\>"
color brightyellow ":|\*|/|%|\+|-|\^|>|>=|<|<=|~=|=|\.\.|#|\<(not|and|or)\>"
# Don't partially color ... as an operator
color normal "\.\.\."
# Statements
color brightblue "\<(do|end|while|repeat|until|if|elseif|then|else|for|in|function|local|return|break)\>"
@ -49,9 +52,9 @@ color brightmagenta "\(|\)|\[|\]|\{|\}"
# Shebang
color brightcyan "^#!.*"
# Strings
color red ""(\\.|[^"\])*"|'(\\.|[^'\])*'"
# Simple comments and multiline comments
color green "--.*"
color green start="--\[\[" end="\]\]"
# Strings
color red ""(\\.|[^"\])*"|'(\\.|[^'\])*'"