Добавлена поддержка Lua

This commit is contained in:
svkalinin 2022-12-19 15:29:30 +03:00
parent 0fe4541dc0
commit cb6cefd8ac
3 changed files with 27 additions and 2 deletions

View File

@ -17,7 +17,7 @@ namespace eval Highlight {} {
ctext::addHighlightClassForSpecialChars $txt qoute #b84a0c {"'`}
ctext::addHighlightClassForRegexp $txt colors #68ceff {(#)(\w)+?(\s|$)}
ctext::addHighlightClassForRegexp $txt comments #666666 {(^|;)\s*(#)[^\n\r]*}
ctext::addHighlightClass $txt bool #3e803b {nil false true}
ctext::addHighlightClass $txt bool #3e803b {null false true}
}
proc Default {txt} {
@ -179,4 +179,16 @@ namespace eval Highlight {} {
ctext::addHighlightClass $txt shelcommand #19a2a6 {if fi else elseif then while case esac do in exit source echo package mkdir ls rm sed awk grep date jq zip tar gzip mount umount test make curl git iconv less gcc scp rsync cut tr function install}
ctext::addHighlightClassForRegexp $txt comments #666666 {(#|//)[^\n\r]*}
}
proc LUA {txt} {
ctext::addHighlightClassForRegexp $txt qoute #b84a0c {("|'|`).*?("|'|`)}
ctext::addHighlightClassForRegexp $txt flags orange {\s-[a-zA-Z]+}
ctext::addHighlightClass $txt stackControl #19a2a6 {and break do else elseif end false for function goto if in local nil not or repeat return then true until while}
# ctext::addHighlightClassForRegexp $txt vars #4471ca {(\$|\*|\&)[\.a-zA-Z0-9\_\-\[\]]+}
ctext::addHighlightClassForSpecialChars $txt brackets green {[]{}()}
ctext::addHighlightClassForRegexp $txt paths lightblue {\.[a-zA-Z0-9\_\-]+}
ctext::addHighlightClassForRegexp $txt comments #666666 {(--)[^\n\r]*}
ctext::addHighlightClassForRegexp $txt namespaces #0093ff {->|\+\+|::}
ctext::addHighlightClass $txt bool #3e803b {null false true}
}
}

View File

@ -1719,5 +1719,13 @@ image create photo image_16x12 -data {
Chm/n66JCfRmg3DPIPf3iwSDM6RSB1jWp4AWHA4FxS5yUiyS/mnycHXE0tICuq6TSlWHLP9/X9O8
Qohnupub0FYW0X70YxhpQqFQ3f/4MIEQo4yN7bHb+o2XrVkaGzt4e5M+fbAPAF3XAY1c7g8wjmVB
ONyL2+2uD/ieTEprk5Mim82iqiqqqlaZCoVCXcBfmFeL22lAPa8AAAAASUVORK5CYII=
}
image create photo lua_16x12 -data {
iVBORw0KGgoAAAANSUhEUgAAAAwAAAAMCAYAAABWdVznAAAACXBIWXMAAAjbAAAI2wHNrPlDAAAA
GXRFWHRTb2Z0d2FyZQB3d3cuaW5rc2NhcGUub3Jnm+48GgAAARdJREFUKJGNkC1IQ3EUxX/nbfoY
ikkxaxQMRi2CzcG2uGFasy3owkCQV7SsuCI2i7iP+KaLVouCcSCI0aAgTFAn2zX8/dqeiCeee3+c
c6/4j6rNXWQFREUDgyDwmFuYpR8bYcK7IZl8BaAWdoBxoOOARiOG+ZuYNoDpD/wJOCRhW7yohFEA
KsJM1JtVIPsjy4BTYBLwSdgymUwHwKN+kh9aBtk+uXSKbGoJ1OVZO58jD1iPHNnn3oEysAcgT6vl
A8TB5iOAVKQWCjQFtgqIx94M0I6D3lzlAY0B2wO+qesqyc4jCVHdcX1x64AeZX6JGOpYJgj6DlhL
nyEr/QEd077c+0K/7XAFjyKwCIyCrjA7IJc6ct9yegcG+1TkMUCBoAAAAABJRU5ErkJggg==
}

View File

@ -95,5 +95,10 @@ dict set lexers HTM tabSize 4
dict set lexers HTM procFindString {<h[0-9]>(<.+>|)PROCNAME(</.+>|)</h[0-9]>}
dict set lexers HTM procRegexpCommand {regexp -nocase -all -- {<h[0-9]>(<.+>|)(.+?)(</.+>|)</h[0-9]>} $line match v1 procName v2}
dict set lexers LUA commentSymbol {--}
dict set lexers LUA procFindString {function\s*?PROCNAME}
dict set lexers LUA procRegexpCommand {regexp -nocase -all -- {^(local|)\s*?(function)\s([a-zA-Z0-9\-_:]+?)\s+\((.+?)\)} $line match v1 keyWord procName params}
dict set lexers LUA varRegexpCommand {regexp -nocase -all -- {^(\s*?)([a-zA-Z0-9\-_\.]+)\s+=\s+(.+?)(\s*$|--)} $line match indent varName varValue lineEnd}
# -------------------------------------------------
dict set lexers ALL varDirectory {variables vars group_vars host_vars defaults}