[sh] Do not highlight keywords if preceded/succeeded by a hyphen

This commit is contained in:
Lennard Hofmann 2020-02-03 21:34:36 +01:00
parent 75bb796b2b
commit 8dbc86c54a

View File

@ -48,10 +48,10 @@ evaluate-commands %sh{
printf %s\\n "declare-option str-list sh_static_words $(join "${keywords}" ' ') $(join "${builtins}" ' ')" printf %s\\n "declare-option str-list sh_static_words $(join "${keywords}" ' ') $(join "${builtins}" ' ')"
# Highlight keywords # Highlight keywords
printf %s\\n "add-highlighter shared/sh/code/ regex \b($(join "${keywords}" '|'))\b 0:keyword" printf %s\\n "add-highlighter shared/sh/code/ regex (?<!-)\b($(join "${keywords}" '|'))\b(?!-) 0:keyword"
# Highlight builtins # Highlight builtins
printf %s "add-highlighter shared/sh/code/builtin regex \b($(join "${builtins}" '|'))\b 0:builtin" printf %s "add-highlighter shared/sh/code/builtin regex (?<!-)\b($(join "${builtins}" '|'))\b(?!-) 0:builtin"
} }
add-highlighter shared/sh/code/operators regex [\[\]\(\)&|]{1,2} 0:operator add-highlighter shared/sh/code/operators regex [\[\]\(\)&|]{1,2} 0:operator