Compare commits
2 Commits
3467d6a89a
...
cb6cefd8ac
Author | SHA1 | Date |
---|---|---|
svkalinin | cb6cefd8ac | |
svkalinin | 0fe4541dc0 |
|
@ -16,6 +16,7 @@ Highlightning and source code navigation:
|
|||
* Shell (BASH)
|
||||
* Markdown
|
||||
* YAML (Ansible support)
|
||||
* Lua
|
||||
|
||||
Highlightning:
|
||||
|
||||
|
|
|
@ -87,14 +87,14 @@ namespace eval Editor {
|
|||
set lineNum [lindex [split $pos "."] 0]
|
||||
set posNum [lindex [split $pos "."] 1]
|
||||
|
||||
if {[info procs GetComment:$fileType] ne ""} {
|
||||
set commentProcedure "GetComment:$fileType"
|
||||
} else {
|
||||
set commentProcedure {GetComment:Unknown}
|
||||
}
|
||||
# set commentProcedure "GetComment"
|
||||
# if {[info procs GetComment:$fileType] ne ""} {
|
||||
# set commentProcedure "GetComment"
|
||||
# } else {
|
||||
# set commentProcedure {GetComment:Unknown}
|
||||
# }
|
||||
set commentProcedure "GetComment"
|
||||
|
||||
# puts "$fileType, $commentProcedure"
|
||||
puts "$fileType, $commentProcedure"
|
||||
if {$selIndex != ""} {
|
||||
set lineBegin [lindex [split [lindex $selIndex 0] "."] 0]
|
||||
set lineEnd [lindex [split [lindex $selIndex 1] "."] 0]
|
||||
|
@ -105,7 +105,7 @@ namespace eval Editor {
|
|||
}
|
||||
for {set i $lineBegin} {$i <=$lineEnd} {incr i} {
|
||||
set str [$txt get $i.0 $i.end]
|
||||
set commentSymbolIndex [$commentProcedure $str]
|
||||
set commentSymbolIndex [$commentProcedure $fileType $str]
|
||||
if {$commentSymbolIndex != 0} {
|
||||
$txt delete $i.[lindex $commentSymbolIndex 0] $i.[lindex $commentSymbolIndex 1]
|
||||
}
|
||||
|
@ -116,7 +116,7 @@ namespace eval Editor {
|
|||
} else {
|
||||
set posNum [lindex [split $pos "."] 1]
|
||||
set str [$txt get $lineNum.0 $lineNum.end]
|
||||
set commentSymbolIndex [$commentProcedure $str]
|
||||
set commentSymbolIndex [$commentProcedure $fileType $str]
|
||||
if {$commentSymbolIndex != 0} {
|
||||
$txt delete $lineNum.[lindex $commentSymbolIndex 0] $lineNum.[lindex $commentSymbolIndex 1]
|
||||
}
|
||||
|
@ -127,12 +127,23 @@ namespace eval Editor {
|
|||
proc GetComment {fileType str} {
|
||||
global lexers
|
||||
# puts [dict get $lexers $fileType commentSymbol]
|
||||
if {[dict exists $lexers $fileType commentSymbol] == 0} {
|
||||
return
|
||||
if [dict exists $lexers $fileType commentSymbol] {
|
||||
# return
|
||||
set symbol [dict get $lexers $fileType commentSymbol]
|
||||
} else {
|
||||
set symbol "#"
|
||||
}
|
||||
regsub -all {\{} $str "\\{" str
|
||||
regsub -all {\}} $str "\\}" str
|
||||
regsub -all {\[} $str {\\[} str
|
||||
regsub -all {\]} $str {\\]} str
|
||||
|
||||
if {[regexp -nocase -indices -- {(^| )([dict get $lexers $fileType commentSymbol]\s)(.+)} $str match v1 v2 v3]} {
|
||||
puts "$match, $v1, $v2, $v3"
|
||||
set cmd "regexp -nocase -indices -- {(^|\s+)\\s*($symbol\\s*)(.*)} {$str} match v1 v2 v3"
|
||||
|
||||
puts $cmd
|
||||
# puts [eval $cmd]
|
||||
if [eval $cmd] {
|
||||
puts "$match, $v2, $v3"
|
||||
return [list [lindex [split $v2] 0] [lindex [split $v3] 0]]
|
||||
} else {
|
||||
return 0
|
||||
|
|
|
@ -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}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -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==
|
||||
}
|
||||
|
||||
|
|
|
@ -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}
|
||||
|
|
|
@ -10,7 +10,7 @@ exec wish "$0" -- "$@"
|
|||
######################################################
|
||||
# Version: 2.0.0
|
||||
# Release: alpha
|
||||
# Build: 16122022145953
|
||||
# Build: 19122022152600
|
||||
######################################################
|
||||
|
||||
# определим текущую версию, релиз и т.д.
|
||||
|
|
Loading…
Reference in New Issue