2022-07-21 10:56:46 +03:00
# #####################################################
# ProjMan 2
# Distributed under GNU Public License
# Author: Sergey Kalinin svk@nuk-svk.ru
# Copyright (c) "", 2022, https://nuk-svk.ru
# #####################################################
namespace eval Highlight { } {
proc TCL { txt } {
ctext : : addHighlightClassForRegexp $txt flags orange { \ s- [ a-zA-Z ] + }
ctext : : addHighlightClass $txt stackControl # 19 a2a6 [ info commands]
2022-08-26 16:26:03 +03:00
ctext : : addHighlightClass $txt widgets # 9 d468d [ list canvas ctext button entry label text labelframe frame toplevel scrollbar checkbutton canvas listbox menu menubar menubutton radiobutton scale entry message tk_chooseDir tk_getSaveFile tk_getOpenFile tk_chooseColor tk_optionMenu ttk::button ttk::checkbutton ttk::combobox ttk::entry ttk::frame ttk::intro ttk::label ttk::labelframe ttk::menubutton ttk::treeview ttk::notebook ttk::panedwindow ttk::progressbar ttk::radiobutton ttk::scale ttk::scrollbar ttk::separator ttk::sizegrip ttk::spinbox ]
2022-07-21 10:56:46 +03:00
ctext : : addHighlightClassWithOnlyCharStart $txt vars # 4471 ca " \$ "
ctext : : addHighlightClass $txt variable_funcs gold { set global variable unset}
ctext : : addHighlightClassForSpecialChars $txt brackets green { [ ] { } ( ) }
ctext : : addHighlightClassForRegexp $txt paths lightblue { \ . [ a-zA-Z0-9 \ _\ - ] + }
ctext : : addHighlightClassForRegexp $txt namespaces # 4 f64ff { : : }
ctext : : addHighlightClassForSpecialChars $txt qoute # b84a0c { " ' ` }
2022-12-09 11:51:24 +03:00
ctext : : addHighlightClassForRegexp $txt colors # 68 ceff { ( # )(\w)+?(\s|$)}
2022-12-09 15:02:53 +03:00
ctext : : addHighlightClassForRegexp $txt comments # 666666 { ( ^ | ; ) \ s * ( # )[^\n\r]*}
2022-12-19 15:29:30 +03:00
ctext : : addHighlightClass $txt bool # 3 e803b { null false true}
2022-07-21 10:56:46 +03:00
}
proc Default { txt } {
ctext : : addHighlightClassForRegexp $txt flags orange { \ s- [ a-zA-Z \ - _] + }
ctext : : addHighlightClass $txt stackControl # 19 a2a6 [ info commands]
ctext : : addHighlightClassWithOnlyCharStart $txt vars # 4471 ca " \$ "
ctext : : addHighlightClass $txt variable_funcs gold { set global variable unset}
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 # 4 f64ff { : : }
ctext : : addHighlightClassForSpecialChars $txt qoute # b84a0c { " ' ` }
}
proc SH { txt } {
ctext : : addHighlightClassForRegexp $txt flags orange { - + [ a-zA-Z \ - _] + }
2022-11-02 16:17:36 +03:00
ctext : : addHighlightClass $txt stackControl # 19 a2a6 { 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}
2022-07-21 10:56:46 +03:00
ctext : : addHighlightClassWithOnlyCharStart $txt vars # 4471 ca " \$ "
ctext : : addHighlightClassForRegexp $txt vars_extended # 4471 ca { \ $ \ { [ a-zA-Z0-9 \ _\ - : \ ./ \ $ \ { \ } ] + \ } }
ctext : : addHighlightClass $txt variable_funcs gold { set export}
ctext : : addHighlightClassForSpecialChars $txt brackets green { [ ] { } ( ) }
ctext : : addHighlightClassForRegexp $txt paths lightblue { \ . [ a-zA-Z0-9 \ _\ - ] + }
ctext : : addHighlightClassForRegexp $txt comments # 666666 { ( # |//)[^\n\r]*}
ctext : : addHighlightClassForSpecialChars $txt qoute # b84a0c { " ' ` }
}
2022-07-22 16:20:53 +03:00
2022-07-22 16:01:30 +03:00
proc GO { txt } {
ctext : : addHighlightClassForRegexp $txt flags orange { - + [ a-zA-Z \ - _] + }
2022-08-26 16:57:08 +03:00
ctext : : addHighlightClass $txt stackControl # 19 a2a6 { break default func goto select case defer if map chan else import package switch const fallthrough interface range continue for go return}
2022-07-22 16:01:30 +03:00
ctext : : addHighlightClass $txt types # 7187 d5 { string int int16 int32 int64 float bool byte}
ctext : : addHighlightClassWithOnlyCharStart $txt vars # 4471 ca " \& "
2022-07-22 16:20:53 +03:00
ctext : : addHighlightClassWithOnlyCharStart $txt vars # 4471 ca " \* "
2022-07-22 16:01:30 +03:00
# ctext::addHighlightClassForRegexp $txt vars_extended #4471ca {\$\{[a-zA-Z0-9\_\-:\./\$\{\}]+\}}
ctext : : addHighlightClass $txt variable_funcs gold { var type struct}
ctext : : addHighlightClassForSpecialChars $txt brackets green { [ ] { } ( ) }
ctext : : addHighlightClassForRegexp $txt paths lightblue { \ . [ a-zA-Z0-9 \ _\ - ] + }
ctext : : addHighlightClassForRegexp $txt comments # 666666 { ( # |//)[^\n\r]*}
2022-12-16 10:11:07 +03:00
ctext : : addHighlightClass $txt bool # 3 e803b { nil false true}
2022-07-22 16:01:30 +03:00
ctext : : addHighlightClassForSpecialChars $txt qoute # b84a0c { " ' ` }
}
2022-08-26 16:57:08 +03:00
2022-08-26 12:29:19 +03:00
proc PY { txt } {
ctext : : addHighlightClassForRegexp $txt flags orange { - + [ a-zA-Z \ - _] + }
2022-12-09 15:02:53 +03:00
ctext : : addHighlightClass $txt stackControl # 19 a2a6 { if else elif for while case switch def import from return make break defer continue package len print with open try: except: in }
2022-08-26 12:29:19 +03:00
ctext : : addHighlightClass $txt types # 7187 d5 { string int int16 int32 int64 float bool byte}
ctext : : addHighlightClassWithOnlyCharStart $txt vars # 4471 ca " \& "
ctext : : addHighlightClassWithOnlyCharStart $txt vars # 4471 ca " \* "
# ctext::addHighlightClass $txt variable_funcs gold {var type struct}
ctext : : addHighlightClassForSpecialChars $txt brackets green { [ ] { } ( ) }
ctext : : addHighlightClassForRegexp $txt paths lightblue { \ . [ a-zA-Z0-9 \ _\ - ] + }
ctext : : addHighlightClassForRegexp $txt comments # 666666 { ( # |//)[^\n\r]*}
ctext : : addHighlightClassForSpecialChars $txt qoute # b84a0c { " ' ` }
}
2022-12-09 15:02:53 +03:00
2022-09-02 17:01:53 +03:00
proc YAML { txt } {
ctext : : addHighlightClassForRegexp $txt qoute # b84a0c { ( " | ' | ` ) . * ? ( " | ' | ` ) }
ctext : : addHighlightClassForRegexp $txt stackControl # 19 a2a6 { \ s * ? [ \ w ] + : }
ctext : : addHighlightClassForRegexp $txt vars # 4471 ca { ( \ $ | \ * | \ & ) [ \ .a-zA-Z0-9 \ _\ - ] + }
2022-11-02 16:17:36 +03:00
ctext : : addHighlightClassForRegexp $txt varsansible # 4471 ca { ( \ { \ { ) ( \ s * ? | ) [ \ .a-zA-Z0-9 \ _\ - ] + ( ( \ s * ? | ) ) ( \ } \ } ) }
2022-09-02 17:01:53 +03:00
ctext : : addHighlightClassForSpecialChars $txt brackets green { [ ] { } ( ) }
ctext : : addHighlightClassForRegexp $txt paths lightblue { \ . [ a-zA-Z0-9 \ _\ - ] + }
ctext : : addHighlightClassForRegexp $txt comments # 666666 { ( # |//)[^\n\r]*}
}
2022-12-09 15:02:53 +03:00
2022-09-02 17:01:53 +03:00
proc YML { txt } {
2022-12-09 11:34:54 +03:00
Highlight : : YAML $txt
2022-09-02 17:01:53 +03:00
}
2022-12-09 15:02:53 +03:00
2022-09-02 17:01:53 +03:00
proc XML { txt } {
ctext : : addHighlightClassForRegexp $txt qoute # b84a0c { ( " | ' | ` ) . * ? ( " | ' | ` ) }
2022-12-09 11:25:34 +03:00
ctext : : addHighlightClassForRegexp $txt stackControl # 19 a2a6 { ( < | < \ \ ) * ? [ \ w ] + ( / | ) ( > ) }
2022-09-02 17:01:53 +03:00
ctext : : addHighlightClassForRegexp $txt vars # 4471 ca { ( \ $ | \ * | \ & ) [ \ .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]*}
2022-12-09 11:25:34 +03:00
ctext : : addHighlightClassForSpecialChars $txt tags lightgreen { < > / }
}
2022-12-09 15:02:53 +03:00
2022-12-09 11:25:34 +03:00
proc HTML { txt } {
ctext : : addHighlightClassForRegexp $txt qoute # b84a0c { ( " | ' | ` ) . * ? ( " | ' | ` ) }
ctext : : addHighlightClassForRegexp $txt stackControl # 19 a2a6 { ( < | < / ) ( [ \ w ] + ) }
ctext : : addHighlightClassForRegexp $txt vars # 4471 ca { ( \ $ | \ * | \ & ) [ \ .a-zA-Z0-9 \ _\ - ] + }
ctext : : addHighlightClassForSpecialChars $txt brackets green { [ ] { } ( ) }
ctext : : addHighlightClassForRegexp $txt paths lightblue { ( \ s ) ( [ \ w ] + ) ( = ) }
ctext : : addHighlightClassForSpecialChars $txt tags lightgreen { < > / }
ctext : : addHighlightClassForRegexp $txt comments # 666666 { ( < \ ! -- ) \ s * ( . + ) \ s* ( -- > ) }
2022-09-02 17:01:53 +03:00
}
2022-12-09 15:02:53 +03:00
2022-12-09 11:34:54 +03:00
proc HTM { txt } {
Highlight : : HTML $txt
}
2022-12-09 15:02:53 +03:00
2022-09-02 17:01:53 +03:00
proc RB { txt } {
ctext : : addHighlightClassForRegexp $txt qoute # b84a0c { ( " | ' | ` ) . * ? ( " | ' | ` ) }
ctext : : addHighlightClassForRegexp $txt flags orange { \ s- [ a-zA-Z ] + }
2022-12-16 10:11:07 +03:00
ctext : : addHighlightClass $txt stackControl # 19 a2a6 { def end class if else for while case when require module begin rescue self return include unless raise private new do synchronize}
2022-09-02 17:01:53 +03:00
ctext : : addHighlightClassForRegexp $txt vars # 4471 ca { ( \ $ | \ * | \ & ) [ \ .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 # 4 f64ff { : : }
2022-12-08 09:39:14 +03:00
ctext : : addHighlightClassForRegexp $txt dog # 00 82 ff { ( @ ) [ \ .a-zA-Z0-9 \ _\ - ] + }
2022-12-16 10:11:07 +03:00
ctext : : addHighlightClass $txt bool # 7 e5fb3 { nil false true}
2022-09-02 17:01:53 +03:00
}
2022-12-09 15:02:53 +03:00
2022-11-25 11:08:14 +03:00
proc MD { txt } {
2022-11-25 12:41:00 +03:00
ctext : : addHighlightClassForRegexp $txt comments # 666666 { ^ \ s + ? ( # |//).*$}
2022-11-25 11:08:14 +03:00
ctext : : addHighlightClassForRegexp $txt lists # 4471 ca { ( \ * | - | \ + ) + }
ctext : : addHighlightClassForSpecialChars $txt brackets green { [ ] { } ( ) }
2022-11-25 12:41:00 +03:00
ctext : : addHighlightClassForRegexp $txt url # 19 a2a6 { ( http | https| ftp| ssh) ( : / / ) ( \ w | \ .| - | / ) + ? }
2022-11-25 11:08:14 +03:00
ctext : : addHighlightClassForRegexp $txt email # 467 a7b { ( \ w | \ .| - ) + ? ( @ ) ( \ w | \ .| - ) + ? ( $ | \ s ) }
ctext : : addHighlightClassForRegexp $txt qoute # b84a0c { ( " | ' | ` ) . * ? ( " | ' | ` ) }
2022-11-25 12:41:00 +03:00
ctext : : addHighlightClassForRegexp $txt sharp # 975 db4 { ^ ( # +?)\s(.*?)$}
2022-11-25 11:08:14 +03:00
ctext : : addHighlightClassForRegexp $txt quotedtext # a9b36c { ^ ( \ s * ? ) ( > + ) . + ? $ }
2022-11-25 12:41:00 +03:00
ctext : : addHighlightClassForRegexp $txt italictext # dff74e { ( ( _ | \ * ) + ? ) ( \ w + ? ) ( ( _ | \ * ) + ? ) }
2022-11-25 11:08:14 +03:00
}
2022-12-07 13:14:37 +03:00
proc PL { txt } {
ctext : : addHighlightClassForRegexp $txt qoute # b84a0c { ( " | ' | ` ) . * ? ( " | ' | ` ) }
ctext : : addHighlightClassForRegexp $txt flags orange { \ s- [ a-zA-Z ] + }
2022-12-08 09:39:14 +03:00
ctext : : addHighlightClass $txt stackControl # 19 a2a6 { sub my end class new if else elsif for foreach while case when use ne eq print exit chdir rand die lt gt le ge say unless return chomp package push exec grep eval warn scalar next continue close module require}
2022-12-07 13:14:37 +03:00
ctext : : addHighlightClassForRegexp $txt vars # 4471 ca { ( \ $ | \ * | \ & ) [ \ .a-zA-Z0-9 \ _\ - \ [ \ ] ] + }
ctext : : addHighlightClassForSpecialChars $txt brackets green { [ ] { } ( ) }
# ctext::addHighlightClassForSpecialChars $txt dog #0082ff {@}
ctext : : addHighlightClassForRegexp $txt dog # 00 82 ff { ( @ ) [ \ .a-zA-Z0-9 \ _\ - \ [ \ ] ] + }
ctext : : addHighlightClassForRegexp $txt paths lightblue { \ . [ a-zA-Z0-9 \ _\ - ] + }
ctext : : addHighlightClassForRegexp $txt comments # 666666 { ( # |//)[^\n\r]*}
ctext : : addHighlightClassForRegexp $txt namespaces # 00 93 ff { - > | \ + \ + | : : }
}
2022-12-09 15:02:53 +03:00
2022-12-07 14:21:09 +03:00
proc INI { txt } {
ctext : : addHighlightClassForRegexp $txt qoute # b84a0c { ( " | ' | ` ) . * ? ( " | ' | ` ) }
ctext : : addHighlightClassForRegexp $txt flags orange { \ s- [ a-zA-Z ] + }
2022-12-09 15:25:47 +03:00
ctext : : addHighlightClassForRegexp $txt stackControl # 4471 ca { ^ ( \ s * ? ) \ [ [ \ .a-zA-Z0-9 \ _\ - \ [ \ ] \ s\ .:] + \ ] }
2022-12-07 14:21:09 +03:00
ctext : : addHighlightClassForSpecialChars $txt brackets green { [ ] { } ( ) }
ctext : : addHighlightClassForRegexp $txt dog # 00 82 ff { ( @ ) [ \ .a-zA-Z0-9 \ _\ - \ [ \ ] ] + }
2022-12-09 15:25:47 +03:00
ctext : : addHighlightClassForRegexp $txt colors # 68 ceff { ( # )[\w]+?}
ctext : : addHighlightClassForRegexp $txt keyword # 19 a2a6 { ^ ( \ s * ? ) . + ( \ s * ? = ) }
2022-12-07 14:21:09 +03:00
ctext : : addHighlightClassForSpecialChars $txt equal # 00 82 ff { = }
2022-12-09 15:45:23 +03:00
ctext : : addHighlightClassForRegexp $txt comments # 666666 { ( ^ \ s * # | ^ \ s* ; | \ s + ; ) [ ^ \ n \ r] * }
2022-12-09 15:25:47 +03:00
ctext : : addHighlightClassForRegexp $txt colors # 68 ceff { ( # )(\w)+?(\s|$)}
2022-12-07 14:21:09 +03:00
}
2022-12-09 15:02:53 +03:00
proc DESKTOP { txt } {
Highlight : : INI $txt
}
proc SPEC { txt } {
ctext : : addHighlightClassForRegexp $txt qoute # b84a0c { ( " | ' | ` ) . * ? ( " | ' | ` ) }
ctext : : addHighlightClassForRegexp $txt flags orange { \ s- [ a-zA-Z0-9 ] + }
ctext : : addHighlightClassForRegexp $txt macros # 00 82 ff { ( % ) [ \ .a-zA-Z0-9 \ _\ - ] + }
ctext : : addHighlightClassForSpecialChars $txt brackets green { [ ] { } ( ) }
ctext : : addHighlightClassForRegexp $txt var # 4471 ca { ( \ $ ) [ \ .a-zA-Z0-9 \ _\ - \ [ \ ] ] + }
# ctext::addHighlightClassForRegexp $txt colors #68ceff {(#)[^\n\r]*}
ctext : : addHighlightClassForRegexp $txt keyword # 68 ceff { ^ ( \ s * ? ) [ a-zA-Z0-9 \ _\ - ] + ( \ s * ? : ) }
ctext : : addHighlightClassForSpecialChars $txt equal # 00 82 ff { = }
ctext : : addHighlightClassForRegexp $txt changelog lightgreen { ^ ( \ s * ? ) ( \ * | \ - ) ( . + ? ) $ }
2022-12-09 15:25:47 +03:00
ctext : : addHighlightClass $txt shelcommand # 19 a2a6 { 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}
2022-12-09 15:02:53 +03:00
ctext : : addHighlightClassForRegexp $txt comments # 666666 { ( # |//)[^\n\r]*}
}
2022-12-19 15:29:30 +03:00
proc LUA { txt } {
ctext : : addHighlightClassForRegexp $txt qoute # b84a0c { ( " | ' | ` ) . * ? ( " | ' | ` ) }
ctext : : addHighlightClassForRegexp $txt flags orange { \ s- [ a-zA-Z ] + }
ctext : : addHighlightClass $txt stackControl # 19 a2a6 { 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 # 00 93 ff { - > | \ + \ + | : : }
ctext : : addHighlightClass $txt bool # 3 e803b { null false true}
}
2022-07-21 10:56:46 +03:00
}