2022-08-25 16:39:50 +03:00
# #######################################################
#
# -------------------------------------------------------
# "PROCNAME" in procFindString will be changed on
# "procName" from procRegexpCommand
# -------------------------------------------------------
2022-08-24 15:04:19 +03:00
# TCL/TK
2022-08-24 15:53:57 +03:00
dict set lexers TCL commentSymbol { # }
2022-11-01 16:21:02 +03:00
dict set lexers TCL variableSymbol { $ }
2022-08-25 16:39:50 +03:00
dict set lexers TCL procFindString { proc PROCNAME}
dict set lexers TCL procRegexpCommand { regexp - nocase - all - - { ^ \ s * ? ( proc ) ( . * ? ) \ { ( . * ? ) \ } \ { } $line match keyWord procName params}
2022-09-02 17:01:53 +03:00
dict set lexers TCL varRegexpCommand { regexp - nocase - all - - { ^ \ s * ? set\ s+ ( [ a-zA-Z0-9 \ : \ - _$ ] + ) \ s+ ( . + ? ) ( $ | ; ) } $line match varName varValue lineEnd}
2022-11-08 12:54:28 +03:00
dict set lexers TCL commands [ info commands]
2022-08-24 15:04:19 +03:00
# --------------------------------------------------
# Go lang
2022-08-24 15:53:57 +03:00
dict set lexers GO commentSymbol { / / }
2022-08-25 16:39:50 +03:00
dict set lexers GO procFindString { func. * ? PROCNAME}
dict set lexers GO procRegexpCommand { regexp - nocase - all - - { \ s * ? func\ s* ? ( \ ( \ w + \ s* ? \ ** ? \ w+ \ ) | ) \ s* ? ( \ w + ) \ ( ( . * ? ) \ ) \ s+ ? ( [ a-zA-Z0-9 \ { \ } \ [ \ ] \ ( \ ) - _.] * ? | ) \ s* ? \ { } $line match linkName procName params returns}
2022-09-08 17:01:18 +03:00
dict set lexers GO varRegexpCommand { regexp - nocase - all - line - - { ^ \ s * ? var\ s+ ( [ a-zA-Z0-9 \ - _$ ] + ) \ s+ ( . + ? ) ( \ s * $ ) } $line match varName varType lineEnd}
2022-08-25 16:39:50 +03:00
# --------------------------------------------------
# SHELL (Bash)
dict set lexers SH commentSymbol { # }
2022-11-01 16:54:26 +03:00
dict set lexers SH variableSymbol { $ }
2022-08-25 16:39:50 +03:00
dict set lexers SH procFindString { ( function | ) \ s * ? PROCNAME\ ( \ ) }
dict set lexers SH procRegexpCommand { regexp - nocase - all - - { ^ \ s * ? ( function | ) \ s* ? ( . * ? ) \ ( ( ) \ ) } $line match keyWord procName params}
2022-08-24 15:53:57 +03:00
2022-08-26 12:29:19 +03:00
# --------------------------------------------------
# Python
dict set lexers PY commentSymbol { # }
dict set lexers PY procFindString { ( def ) \ s * ? PROCNAME}
dict set lexers PY procRegexpCommand { regexp - nocase - all - - { ^ \ s * ? ( def ) \ s* ? ( . * ? ) \ ( ( . * ? ) \ ) : } $line match keyWord procName params}
2022-12-15 11:59:05 +03:00
dict set lexers PY varRegexpCommand { regexp - nocase - all - line - - { ^ \ s * ? ( \ w + ) \ s* = \ s* ( . + ) ( $ ) } $line match varName varValue lineEnd}
2022-09-02 17:01:53 +03:00
# --------------------------------------------------
# Ruby
dict set lexers RB commentSymbol { # }
dict set lexers RB tabSize 2
2022-12-08 09:39:14 +03:00
dict set lexers RB procFindString { ( def | class ) \ s * ? PROCNAME}
dict set lexers RB procRegexpCommand { regexp - nocase - all - - { ^ \ s * ? ( def | class) \ s( [ a-zA-Z0-9 \ - _:\ ? ] + ? ) ( $ | \ s | \ ( . + ? \ ) ) } $line match keyWord procName params}
2022-09-02 17:01:53 +03:00
# --------------------------------------------------
# YAML (ansible)
dict set lexers YML commentSymbol { # }
2022-11-01 16:21:02 +03:00
# dict set lexers YML variableSymbol {\{\{}
2022-09-02 17:01:53 +03:00
dict set lexers YML tabSize 2
dict set lexers YML procFindString { ( - name:) \ s * ? PROCNAME}
dict set lexers YML procRegexpCommand { regexp - nocase - all - - { ^ \ s * ? - ( name ) : \ s( . + ? ) $ } $line match keyWord procName}
2022-09-08 17:01:18 +03:00
dict set lexers YML varRegexpCommand { regexp - nocase - all - - { ^ ( \ s * ? ) ( [ a-zA-Z0-9 \ - _$ ] + ) : \ s + ( . + ? ) ( \ s * $ ) } $line match indent varName varValue lineEnd}
dict set lexers YML varRegexpCommandMultiline { regexp - all - line - - { ^ ( \ s * ) ( set_fact | vars) : $ } $line match indent keyWord}
2022-09-02 17:01:53 +03:00
2022-11-25 11:08:14 +03:00
# --------------------------------------------------
# MD (markdown)
dict set lexers MD tabSize 2
dict set lexers MD procFindString { ( # +?)\s*?PROCNAME}
2022-11-25 12:41:00 +03:00
dict set lexers MD procRegexpCommand { regexp - nocase - all - - { ^ ( # +?)\s(.+?)$} $line match keyWord procName}
2022-11-25 11:08:14 +03:00
# dict set lexers YML varRegexpCommandMultiline {regexp -all -line -- {^(\s*)(set_fact|vars):$} $line match indent keyWord}
2022-12-07 13:14:37 +03:00
# --------------------------------------------------
# Perl
dict set lexers PL commentSymbol { # }
dict set lexers PL variableSymbol { $ }
dict set lexers PL tabSize 4
dict set lexers PL procFindString { ( sub ) \ s * ? PROCNAME}
dict set lexers PL procRegexpCommand { regexp - nocase - all - - { ^ \ s * ? ( sub ) \ s( [ a-zA-Z0-9 \ - _:] + ? ) ( $ | \ ( . + ? \ ) ) } $line match keyWord procName params}
dict set lexers PL varRegexpCommand { regexp - nocase - all - - { ^ ( \ s * ? ) \ $ ( [ a-zA-Z0-9 \ - _$ ] + ) \ s + = \ s+ ( . + ? ) ( \ s * ; $ ) } $line match indent varName varValue lineEnd}
2022-12-07 14:21:09 +03:00
# --------------------------------------------------
2022-12-08 09:39:44 +03:00
# INI
2022-12-07 14:21:09 +03:00
dict set lexers INI commentSymbol { # }
dict set lexers INI tabSize 4
dict set lexers INI procFindString { ( \ [ ) PROCNAME ( \ ] ) }
2022-12-09 15:25:47 +03:00
# dict set lexers INI procRegexpCommand {regexp -nocase -all -- {^\s*?(\[)([a-zA-Z0-9\-_:\s]+?)(\])$} $line match keyWord procName}
dict set lexers INI procRegexpCommand { regexp - nocase - all - - { ^ \ s * ? ( \ [ ) ( . + ? ) ( \ ] ) $ } $line match keyWord procName}
2022-12-07 14:21:09 +03:00
2022-12-09 11:34:54 +03:00
# -------------------------------------------------
# HTML
2022-12-09 11:25:34 +03:00
dict set lexers HTML commentSymbol { < \ ! -- }
dict set lexers HTML tabSize 4
dict set lexers HTML procFindString { < h [ 0-9 ] > ( < . + > | ) PROCNAME( < / . + > | ) < / h[ 0-9 ] > }
dict set lexers HTML procRegexpCommand { regexp - nocase - all - - { < h [ 0-9 ] > ( < . + > | ) ( . + ? ) ( < / . + > | ) < / h[ 0-9 ] > } $line match v1 procName v2}
2022-12-09 11:34:54 +03:00
# -------------------------------------------------
# HTM
dict set lexers HTM commentSymbol { < \ ! -- }
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}
2022-11-25 11:08:14 +03:00
# -------------------------------------------------
2022-09-16 15:43:46 +03:00
dict set lexers ALL varDirectory { variables vars group_vars host_vars defaults}