Replace non-POSIX inline character replacement in shell scripts

This commit is contained in:
Frank LENORMAND 2016-03-14 18:29:11 +02:00
parent 98594cf6df
commit 3079d2a7e3
9 changed files with 126 additions and 126 deletions

View File

@ -35,25 +35,25 @@ addhl -group /dlang/code regex "\<(this)\>\s*[^(]" 1:value
%sh{
# Grammar
keywords="alias:asm:assert:body:cast:class:delegate:delete:enum:function"
keywords="${keywords}:import:in:interface:invariant:is:lazy:mixin:module"
keywords="${keywords}:new:out:pragma:struct:super:typeid:typeof:union"
keywords="${keywords}:unittest:__parameters:__traits:__vector:break:case"
keywords="${keywords}:catch:continue:default:do:else:finally:for:foreach"
keywords="${keywords}:foreach_reverse:goto:if:return:switch:throw:try:with:while"
attributes="abstract:align:auto:const:debug:deprecated:export:extern:final"
attributes="${attributes}:immutable:inout:nothrow:package:private:protected"
attributes="${attributes}:public:pure:ref:override:scope:shared:static:synchronized:version:__gshared"
types="bool:byte:cdouble:cfloat:char:creal:dchar:double:dstring:float"
types="${types}:idouble:ifloat:int:ireal:long:ptrdiff_t:real:size_t:short"
types="${types}:string:ubyte:uint:ulong:ushort:void:wchar:wstring"
values="true:false:null:__FILE__:__MODULE__:__LINE__:__FUNCTION__"
values="${values}:__PRETTY_FUNCTION__:__DATE__:__EOF__:__TIME__"
values="${values}:__TIMESTAMP__:__VENDOR__:__VERSION__"
decorators="disable:property:nogc:safe:trusted:system"
keywords="alias|asm|assert|body|cast|class|delegate|delete|enum|function"
keywords="${keywords}|import|in|interface|invariant|is|lazy|mixin|module"
keywords="${keywords}|new|out|pragma|struct|super|typeid|typeof|union"
keywords="${keywords}|unittest|__parameters|__traits|__vector|break|case"
keywords="${keywords}|catch|continue|default|do|else|finally|for|foreach"
keywords="${keywords}|foreach_reverse|goto|if|return|switch|throw|try|with|while"
attributes="abstract|align|auto|const|debug|deprecated|export|extern|final"
attributes="${attributes}|immutable|inout|nothrow|package|private|protected"
attributes="${attributes}|public|pure|ref|override|scope|shared|static|synchronized|version|__gshared"
types="bool|byte|cdouble|cfloat|char|creal|dchar|double|dstring|float"
types="${types}|idouble|ifloat|int|ireal|long|ptrdiff_t|real|size_t|short"
types="${types}|string|ubyte|uint|ulong|ushort|void|wchar|wstring"
values="true|false|null|__FILE__|__MODULE__|__LINE__|__FUNCTION__"
values="${values}|__PRETTY_FUNCTION__|__DATE__|__EOF__|__TIME__"
values="${values}|__TIMESTAMP__|__VENDOR__|__VERSION__"
decorators="disable|property|nogc|safe|trusted|system"
# Add the language's grammar to the static completion list
echo "hook global WinSetOption filetype=dlang %{
sed 's,|,:,g' <<< "hook global WinSetOption filetype=dlang %{
set window static_words '${keywords}'
set -add window static_words '${attributes}'
set -add window static_words '${types}'
@ -63,11 +63,11 @@ addhl -group /dlang/code regex "\<(this)\>\s*[^(]" 1:value
# Highlight keywords
echo "
addhl -group /dlang/code regex \<(${keywords//:/|})\> 0:keyword
addhl -group /dlang/code regex \<(${attributes//:/|})\> 0:attribute
addhl -group /dlang/code regex \<(${types//:/|})\> 0:type
addhl -group /dlang/code regex \<(${values//:/|})\> 0:value
addhl -group /dlang/code regex @(${decorators//:/|})\> 0:attribute
addhl -group /dlang/code regex \<(${keywords})\> 0:keyword
addhl -group /dlang/code regex \<(${attributes})\> 0:attribute
addhl -group /dlang/code regex \<(${types})\> 0:type
addhl -group /dlang/code regex \<(${values})\> 0:value
addhl -group /dlang/code regex @(${decorators})\> 0:attribute
"
}

View File

@ -28,15 +28,15 @@ addhl -group /golang/code regex %{-?([0-9]*\.(?!0[xX]))?\<([0-9]+|0[xX][0-9a-fA-
%sh{
# Grammar
keywords="break:default:defer:else:fallthrough:for:func:go:goto:if:import"
keywords="${keywords}:interface:make:new:package:range:return:select:case:switch:type:continue"
keywords="break|default|defer|else|fallthrough|for|func|go|goto|if|import"
keywords="${keywords}|interface|make|new|package|range|return|select|case|switch|type|continue"
attributes="const"
types="bool:byte:chan:complex128:complex64:float32:float64:int:int16:int32"
types="${types}:int64:int8:interface:intptr:map:rune:string:struct:uint:uint16:uint32:uint64:uint8"
values="false:true:nil"
types="bool|byte|chan|complex128|complex64|float32|float64|int|int16|int32"
types="${types}|int64|int8|interface|intptr|map|rune|string|struct|uint|uint16|uint32|uint64|uint8"
values="false|true|nil"
# Add the language's grammar to the static completion list
echo "hook global WinSetOption filetype=golang %{
sed 's,|,:,g' <<< "hook global WinSetOption filetype=golang %{
set window static_words '${keywords}'
set -add window static_words '${attributes}'
set -add window static_words '${types}'
@ -45,10 +45,10 @@ addhl -group /golang/code regex %{-?([0-9]*\.(?!0[xX]))?\<([0-9]+|0[xX][0-9a-fA-
# Highlight keywords
echo "
addhl -group /golang/code regex \<(${keywords//:/|})\> 0:keyword
addhl -group /golang/code regex \<(${attributes//:/|})\> 0:attribute
addhl -group /golang/code regex \<(${types//:/|})\> 0:type
addhl -group /golang/code regex \<(${values//:/|})\> 0:value
addhl -group /golang/code regex \<(${keywords})\> 0:keyword
addhl -group /golang/code regex \<(${attributes})\> 0:attribute
addhl -group /golang/code regex \<(${types})\> 0:type
addhl -group /golang/code regex \<(${values})\> 0:value
"
}

View File

@ -24,16 +24,16 @@ addhl -group /makefile/content regex [+?:]= 0:operator
%sh{
# Grammar
keywords="ifeq:ifneq:else:endif"
keywords="ifeq|ifneq|else|endif"
# Add the language's grammar to the static completion list
echo "hook global WinSetOption filetype=makefile %{
sed 's,|,:,g' <<< "hook global WinSetOption filetype=makefile %{
set window static_words '${keywords}'
}"
# Highlight keywords
echo "
addhl -group /makefile/content regex \<(${keywords//:/|})\> 0:keyword
addhl -group /makefile/content regex \<(${keywords})\> 0:keyword
"
}

View File

@ -28,23 +28,23 @@ addhl -group /perl/comment fill comment
%sh{
# Grammar
keywords="else:lock:qw:elsif:lt:qx:eq:exp:ne:sub:for:no:my:not:tr:goto:and:foreach:or:break:exit:unless:cmp:ge:package:until:continue:gt:while:if:qq:xor:do:le:qr:return"
attributes="END:AUTOLOAD:BEGIN:CHECK:UNITCHECK:INIT:DESTROY"
attributes="${attributes}:length:setpgrp:endgrent:link:setpriority:endhostent:listen:setprotoent:endnetent:local:setpwent"
attributes="${attributes}:endprotoent:localtime:setservent:endpwent:log:setsockopt:endservent:lstat:shift:eof:map:shmctl:eval:mkdir:shmget:exec:msgctl:shmread"
attributes="${attributes}:exists:msgget:shmwrite:msgrcv:shutdown:fcntl:msgsnd:sin:fileno:sleep:flock:next:socket:fork:socketpair:format:oct:sort"
attributes="${attributes}:formline:open:splice:getc:opendir:split:getgrent:ord:sprintf:getgrgid:our:sqrt:getgrnam:pack:srand:gethostbyaddr:pipe:stat:gethostbyname"
attributes="${attributes}:pop:state:gethostent:pos:study:getlogin:print:substr:getnetbyaddr:printf:symlink:abs:getnetbyname:prototype:syscall:accept:getnetent"
attributes="${attributes}:push:sysopen:alarm:getpeername:quotemeta:sysread:atan2:getpgrp:rand:sysseek:getppid:read:system:getpriority:readdir:syswrite:bind"
attributes="${attributes}:getprotobyname:readline:tell:binmode:getprotobynumber:readlink:telldir:bless:getprotoent:readpipe:tie:getpwent:recv:tied:caller"
attributes="${attributes}:getpwnam:redo:time:chdir:getpwuid:ref:times:getservbyname:rename:truncate:chmod:getservbyport:require:uc:chomp:getservent:reset:ucfirst"
attributes="${attributes}:chop:getsockname:umask:chown:getsockopt:reverse:undef:chr:glob:rewinddir:chroot:gmtime:rindex:unlink:close:rmdir:unpack"
attributes="${attributes}:closedir:grep:say:unshift:connect:hex:scalar:untie:cos:index:seek:use:crypt:seekdir:utime:dbmclose:int:select:values:dbmopen:ioctl:semctl"
attributes="${attributes}:vec:defined:join:semget:wait:delete:keys:semop:waitpid:kill:send:wantarray:die:last:setgrent:warn:dump:lc:sethostent:write:each:lcfirst:setnetent"
values="ARGV:STDERR:STDOUT:ARGVOUT:STDIN:__DATA__:__END__:__FILE__:__LINE__:__PACKAGE__"
keywords="else|lock|qw|elsif|lt|qx|eq|exp|ne|sub|for|no|my|not|tr|goto|and|foreach|or|break|exit|unless|cmp|ge|package|until|continue|gt|while|if|qq|xor|do|le|qr|return"
attributes="END|AUTOLOAD|BEGIN|CHECK|UNITCHECK|INIT|DESTROY"
attributes="${attributes}|length|setpgrp|endgrent|link|setpriority|endhostent|listen|setprotoent|endnetent|local|setpwent"
attributes="${attributes}|endprotoent|localtime|setservent|endpwent|log|setsockopt|endservent|lstat|shift|eof|map|shmctl|eval|mkdir|shmget|exec|msgctl|shmread"
attributes="${attributes}|exists|msgget|shmwrite|msgrcv|shutdown|fcntl|msgsnd|sin|fileno|sleep|flock|next|socket|fork|socketpair|format|oct|sort"
attributes="${attributes}|formline|open|splice|getc|opendir|split|getgrent|ord|sprintf|getgrgid|our|sqrt|getgrnam|pack|srand|gethostbyaddr|pipe|stat|gethostbyname"
attributes="${attributes}|pop|state|gethostent|pos|study|getlogin|print|substr|getnetbyaddr|printf|symlink|abs|getnetbyname|prototype|syscall|accept|getnetent"
attributes="${attributes}|push|sysopen|alarm|getpeername|quotemeta|sysread|atan2|getpgrp|rand|sysseek|getppid|read|system|getpriority|readdir|syswrite|bind"
attributes="${attributes}|getprotobyname|readline|tell|binmode|getprotobynumber|readlink|telldir|bless|getprotoent|readpipe|tie|getpwent|recv|tied|caller"
attributes="${attributes}|getpwnam|redo|time|chdir|getpwuid|ref|times|getservbyname|rename|truncate|chmod|getservbyport|require|uc|chomp|getservent|reset|ucfirst"
attributes="${attributes}|chop|getsockname|umask|chown|getsockopt|reverse|undef|chr|glob|rewinddir|chroot|gmtime|rindex|unlink|close|rmdir|unpack"
attributes="${attributes}|closedir|grep|say|unshift|connect|hex|scalar|untie|cos|index|seek|use|crypt|seekdir|utime|dbmclose|int|select|values|dbmopen|ioctl|semctl"
attributes="${attributes}|vec|defined|join|semget|wait|delete|keys|semop|waitpid|kill|send|wantarray|die|last|setgrent|warn|dump|lc|sethostent|write|each|lcfirst|setnetent"
values="ARGV|STDERR|STDOUT|ARGVOUT|STDIN|__DATA__|__END__|__FILE__|__LINE__|__PACKAGE__"
# Add the language's grammar to the static completion list
echo "hook global WinSetOption filetype=perl %{
sed 's,|,:,g' <<< "hook global WinSetOption filetype=perl %{
set window static_words '${keywords}'
set -add window static_words '${attributes}'
set -add window static_words '${values}'
@ -52,9 +52,9 @@ addhl -group /perl/comment fill comment
# Highlight keywords
echo "
addhl -group /perl/code regex \<(${keywords//:/|})\> 0:keyword
addhl -group /perl/code regex \<(${attributes//:/|})\> 0:attribute
addhl -group /perl/code regex \<(${values//:/|})\> 0:value
addhl -group /perl/code regex \<(${keywords})\> 0:keyword
addhl -group /perl/code regex \<(${attributes})\> 0:attribute
addhl -group /perl/code regex \<(${values})\> 0:value
"
}

View File

@ -54,17 +54,17 @@ addhl -group /ruby/code regex \<([A-Za-z]\w*:)|([$@][A-Za-z]\w*)|(\W\K:[A-Za-z]\
%sh{
# Grammar
# Keywords are collected searching for keyword_ at
# Keywords are collected searching for keywords at
# https://github.com/ruby/ruby/blob/trunk/parse.y
keywords="alias:and:begin:break:case:class:def:defined:do:else:elsif:end"
keywords="${keywords}:ensure:false:for:if:in:module:next:nil:not:or:redo"
keywords="${keywords}:rescue:retry:return:self:super:then:true:undef:unless:until:when:while:yield"
attributes="attr_reader:attr_writer:attr_accessor"
values="false:true:nil"
meta="require:include"
keywords="alias|and|begin|break|case|class|def|defined|do|else|elsif|end"
keywords="${keywords}|ensure|false|for|if|in|module|next|nil|not|or|redo"
keywords="${keywords}|rescue|retry|return|self|super|then|true|undef|unless|until|when|while|yield"
attributes="attr_reader|attr_writer|attr_accessor"
values="false|true|nil"
meta="require|include"
# Add the language's grammar to the static completion list
echo "hook global WinSetOption filetype=ruby %{
sed 's,|,:,g' <<< "hook global WinSetOption filetype=ruby %{
set window static_words '${keywords}'
set -add window static_words '${attributes}'
set -add window static_words '${values}'
@ -73,10 +73,10 @@ addhl -group /ruby/code regex \<([A-Za-z]\w*:)|([$@][A-Za-z]\w*)|(\W\K:[A-Za-z]\
# Highlight keywords
echo "
addhl -group /ruby/code regex \<(${keywords//:/|})\> 0:keyword
addhl -group /ruby/code regex \<(${attributes//:/|})\> 0:attribute
addhl -group /ruby/code regex \<(${values//:/|})\> 0:value
addhl -group /ruby/code regex \<(${meta//:/|})\> 0:meta
addhl -group /ruby/code regex \<(${keywords})\> 0:keyword
addhl -group /ruby/code regex \<(${attributes})\> 0:attribute
addhl -group /ruby/code regex \<(${values})\> 0:value
addhl -group /ruby/code regex \<(${meta})\> 0:meta
"
}

View File

@ -96,12 +96,12 @@ def -hidden _c-family-indent-on-closing-curly-brace %[
addhl -group /c/code regex %{\<NULL\>|\<-?(0x[0-9a-fA-F]+|\d+)[fdiu]?|'((\\.)?|[^'\\])'} 0:value
%sh{
# Grammar
keywords="while:for:if:else:do:switch:case:default:goto:asm:break:continue:return:sizeof"
attributes="const:auto:register:inline:static:volatile:struct:enum:union:typedef:extern:restrict"
types="void:char:short:int:long:signed:unsigned:float:double:size_t"
keywords="while|for|if|else|do|switch|case|default|goto|asm|break|continue|return|sizeof"
attributes="const|auto|register|inline|static|volatile|struct|enum|union|typedef|extern|restrict"
types="void|char|short|int|long|signed|unsigned|float|double|size_t"
# Add the language's grammar to the static completion list
echo "hook global WinSetOption filetype=c %{
sed 's,|,:,g' <<< "hook global WinSetOption filetype=c %{
set window static_words '${keywords}'
set -add window static_words '${attributes}'
set -add window static_words '${types}'
@ -109,9 +109,9 @@ addhl -group /c/code regex %{\<NULL\>|\<-?(0x[0-9a-fA-F]+|\d+)[fdiu]?|'((\\.)?|[
# Highlight keywords
echo "
addhl -group /c/code regex \<(${keywords//:/|})\> 0:keyword
addhl -group /c/code regex \<(${attributes//:/|})\> 0:attribute
addhl -group /c/code regex \<(${types//:/|})\> 0:type
addhl -group /c/code regex \<(${keywords})\> 0:keyword
addhl -group /c/code regex \<(${attributes})\> 0:attribute
addhl -group /c/code regex \<(${types})\> 0:type
"
}
@ -120,20 +120,20 @@ addhl -group /cpp/code regex %{\<-?(0x[0-9a-fA-F]+|\d+)[fdiu]?|'((\\.)?|[^'\\])'
%sh{
# Grammar
keywords="while:for:if:else:do:switch:case:default:goto:asm:break:continue"
keywords="${keywords}:return:using:try:catch:throw:new:delete:and:and_eq:or"
keywords="${keywords}:or_eq:not:operator:explicit:reinterpret_cast"
keywords="${keywords}:const_cast:static_cast:dynamic_cast:sizeof:alignof"
keywords="${keywords}:alignas:decltype"
attributes="const:constexpr:mutable:auto:noexcept:namespace:inline:static"
attributes="${attributes}:volatile:class:struct:enum:union:public:protected"
attributes="${attributes}:private:template:typedef:virtual:friend:extern"
attributes="${attributes}:typename:override:final"
types="void:char:short:int:long:signed:unsigned:float:double:size_t:bool"
values="this:true:false:NULL:nullptr"
keywords="while|for|if|else|do|switch|case|default|goto|asm|break|continue"
keywords="${keywords}|return|using|try|catch|throw|new|delete|and|and_eq|or"
keywords="${keywords}|or_eq|not|operator|explicit|reinterpret_cast"
keywords="${keywords}|const_cast|static_cast|dynamic_cast|sizeof|alignof"
keywords="${keywords}|alignas|decltype"
attributes="const|constexpr|mutable|auto|noexcept|namespace|inline|static"
attributes="${attributes}|volatile|class|struct|enum|union|public|protected"
attributes="${attributes}|private|template|typedef|virtual|friend|extern"
attributes="${attributes}|typename|override|final"
types="void|char|short|int|long|signed|unsigned|float|double|size_t|bool"
values="this|true|false|NULL|nullptr"
# Add the language's grammar to the static completion list
echo "hook global WinSetOption filetype=cpp %{
sed 's,|,:,g' <<< "hook global WinSetOption filetype=cpp %{
set window static_words '${keywords}'
set -add window static_words '${attributes}'
set -add window static_words '${types}'
@ -142,10 +142,10 @@ addhl -group /cpp/code regex %{\<-?(0x[0-9a-fA-F]+|\d+)[fdiu]?|'((\\.)?|[^'\\])'
# Highlight keywords
echo "
addhl -group /cpp/code regex \<(${keywords//:/|})\> 0:keyword
addhl -group /cpp/code regex \<(${attributes//:/|})\> 0:attribute
addhl -group /cpp/code regex \<(${types//:/|})\> 0:type
addhl -group /cpp/code regex \<(${values//:/|})\> 0:value
addhl -group /cpp/code regex \<(${keywords})\> 0:keyword
addhl -group /cpp/code regex \<(${attributes})\> 0:attribute
addhl -group /cpp/code regex \<(${types})\> 0:type
addhl -group /cpp/code regex \<(${values})\> 0:value
"
}
@ -154,18 +154,18 @@ addhl -group /objc/code regex %{\<-?\d+[fdiu]?|'((\\.)?|[^'\\])'} 0:value
%sh{
# Grammar
keywords="while:for:if:else:do:switch:case:default:goto:break:continue:return"
attributes="const:auto:inline:static:volatile:struct:enum:union:typedef"
attributes="${attributes}:extern:__block:nonatomic:assign:copy:strong"
attributes="${attributes}:retain:weak:readonly:IBAction:IBOutlet"
types="void:char:short:int:long:signed:unsigned:float:bool:size_t"
types="${types}:instancetype:BOOL:NSInteger:NSUInteger:CGFloat:NSString"
values="self:nil:id:super:TRUE:FALSE:YES:NO:NULL"
decorators="property:synthesize:interface:implementation:protocol:end"
decorators="${decorators}:selector:autoreleasepool:try:catch:class:synchronized"
keywords="while|for|if|else|do|switch|case|default|goto|break|continue|return"
attributes="const|auto|inline|static|volatile|struct|enum|union|typedef"
attributes="${attributes}|extern|__block|nonatomic|assign|copy|strong"
attributes="${attributes}|retain|weak|readonly|IBAction|IBOutlet"
types="void|char|short|int|long|signed|unsigned|float|bool|size_t"
types="${types}|instancetype|BOOL|NSInteger|NSUInteger|CGFloat|NSString"
values="self|nil|id|super|TRUE|FALSE|YES|NO|NULL"
decorators="property|synthesize|interface|implementation|protocol|end"
decorators="${decorators}|selector|autoreleasepool|try|catch|class|synchronized"
# Add the language's grammar to the static completion list
echo "hook global WinSetOption filetype=objc %{
sed 's,|,:,g' <<< "hook global WinSetOption filetype=objc %{
set window static_words '${keywords}'
set -add window static_words '${attributes}'
set -add window static_words '${types}'
@ -175,11 +175,11 @@ addhl -group /objc/code regex %{\<-?\d+[fdiu]?|'((\\.)?|[^'\\])'} 0:value
# Highlight keywords
echo "
addhl -group /objc/code regex \<(${keywords//:/|})\> 0:keyword
addhl -group /objc/code regex \<(${attributes//:/|})\> 0:attribute
addhl -group /objc/code regex \<(${types//:/|})\> 0:type
addhl -group /objc/code regex \<(${values//:/|})\> 0:value
addhl -group /objc/code regex @(${decorators//:/|})\> 0:attribute
addhl -group /objc/code regex \<(${keywords})\> 0:keyword
addhl -group /objc/code regex \<(${attributes})\> 0:attribute
addhl -group /objc/code regex \<(${types})\> 0:type
addhl -group /objc/code regex \<(${values})\> 0:value
addhl -group /objc/code regex @(${decorators})\> 0:attribute
"
}

View File

@ -10,21 +10,21 @@ addhl -group / regions -default code kakrc \
%sh{
# Grammar
keywords="hook:rmhooks:addhl:rmhl:exec:eval:source:runtime:def:alias"
keywords="${keywords}:unalias:decl:echo:edit:set:map:face:prompt:menu:info"
keywords="${keywords}:try:catch:nameclient:namebuf:cd:colorscheme"
values="default:black:red:green:yellow:blue:magenta:cyan:white"
keywords="hook|rmhooks|addhl|rmhl|exec|eval|source|runtime|def|alias"
keywords="${keywords}|unalias|decl|echo|edit|set|map|face|prompt|menu|info"
keywords="${keywords}|try|catch|nameclient|namebuf|cd|colorscheme"
values="default|black|red|green|yellow|blue|magenta|cyan|white"
# Add the language's grammar to the static completion list
echo "hook global WinSetOption filetype=kak %{
sed 's,|,:,g' <<< "hook global WinSetOption filetype=kak %{
set window static_words '${keywords}'
set -add window static_words '${values}'
}"
# Highlight keywords
echo "
addhl -group /kakrc/code regex \<(${keywords//:/|})\> 0:keyword
addhl -group /kakrc/code regex \<(${values//:/|})\> 0:value
addhl -group /kakrc/code regex \<(${keywords})\> 0:keyword
addhl -group /kakrc/code regex \<(${values})\> 0:value
"
}

View File

@ -28,14 +28,14 @@ addhl -group /python/comment fill comment
%sh{
# Grammar
values="True:False:None"
meta="import:from"
values="True|False|None"
meta="import|from"
# Keyword list is collected using `keyword.kwlist` from `keyword`
keywords="and:as:assert:break:class:continue:def:del:elif:else:except:exec:finally:for:global:if:in:is:lambda:not:or:pass:print:raise:return:try:while:with:yield"
types="bool:buffer:bytearray:complex:dict:file:float:frozenset:int:list:long:memoryview:object:set:str:tuple:unicode:xrange"
keywords="and|as|assert|break|class|continue|def|del|elif|else|except|exec|finally|for|global|if|in|is|lambda|not|or|pass|print|raise|return|try|while|with|yield"
types="bool|buffer|bytearray|complex|dict|file|float|frozenset|int|list|long|memoryview|object|set|str|tuple|unicode|xrange"
# Add the language's grammar to the static completion list
echo "hook global WinSetOption filetype=python %{
sed 's,|,:,g' <<< "hook global WinSetOption filetype=python %{
set window static_words '${values}'
set -add window static_words '${meta}'
set -add window static_words '${keywords}'
@ -44,13 +44,13 @@ addhl -group /python/comment fill comment
# Highlight keywords
echo "
addhl -group /python/code regex '\<(${values//:/|})\>' 0:value
addhl -group /python/code regex '\<(${meta//:/|})\>' 0:meta
addhl -group /python/code regex '\<(${keywords//:/|})\>' 0:keyword
addhl -group /python/code regex '\<(${values})\>' 0:value
addhl -group /python/code regex '\<(${meta})\>' 0:meta
addhl -group /python/code regex '\<(${keywords})\>' 0:keyword
"
# Highlight types, when they are not used as constructors
echo "addhl -group /python/code regex '\<(${types//:/|})\>[^(]' 1:type"
echo "addhl -group /python/code regex '\<(${types})\>[^(]' 1:type"
}
# Commands

View File

@ -17,20 +17,20 @@ addhl -group /sh/comment fill comment
%sh{
# Grammar
keywords="alias:bind:builtin:caller:case:cd:command:coproc:declare:do:done"
keywords="${keywords}:echo:elif:else:enable:esac:exit:fi:for:function:help"
keywords="${keywords}:if:in:let:local:logout:mapfile:printf:read:readarray"
keywords="${keywords}:readonly:return:select:set:shift:source:test:then"
keywords="${keywords}:time:type:typeset:ulimit:unalias:until:while"
keywords="alias|bind|builtin|caller|case|cd|command|coproc|declare|do|done"
keywords="${keywords}|echo|elif|else|enable|esac|exit|fi|for|function|help"
keywords="${keywords}|if|in|let|local|logout|mapfile|printf|read|readarray"
keywords="${keywords}|readonly|return|select|set|shift|source|test|then"
keywords="${keywords}|time|type|typeset|ulimit|unalias|until|while"
# Add the language's grammar to the static completion list
echo "hook global WinSetOption filetype=sh %{
sed 's,|,:,g' <<< "hook global WinSetOption filetype=sh %{
set window static_words '${keywords}'
}"
# Highlight keywords
echo "
addhl -group /sh/code regex \<(${keywords//:/|})\> 0:keyword
addhl -group /sh/code regex \<(${keywords})\> 0:keyword
"
}