lua.kak: keyword should have higher priority than function call

Currently, the "return" in `return {}` is highlighted as a function call, instead of being highlighted as a keyword
This commit is contained in:
Hugo Musso Gualandi 2021-07-28 19:10:43 -03:00
parent 7b126704c7
commit 43d9f59fda

View File

@ -46,14 +46,14 @@ add-highlighter shared/lua/double_string region '"' (?<!\\)(?:\\\\)*" fill str
add-highlighter shared/lua/single_string region "'" (?<!\\)(?:\\\\)*' fill string
add-highlighter shared/lua/comment region '--' $ fill comment
add-highlighter shared/lua/code/function_declaration regex \b(?:function\h+)(?:\w+\h*\.\h*)*([a-zA-Z_]\w*)\( 1:function
add-highlighter shared/lua/code/function_call regex \b([a-zA-Z_]\w*)\h*(?=[\(\{]) 1:function
add-highlighter shared/lua/code/keyword regex \b(and|break|do|else|elseif|end|for|function|goto|if|in|not|or|repeat|return|then|until|while)\b 0:keyword
add-highlighter shared/lua/code/value regex \b(false|nil|true|[0-9]+(:?\.[0-9])?(:?[eE]-?[0-9]+)?|0x[0-9a-fA-F])\b 0:value
add-highlighter shared/lua/code/operator regex (\+|-|\*|/|%|\^|==?|~=|<=?|>=?|\.\.|\.\.\.|#) 0:operator
add-highlighter shared/lua/code/builtin regex \b(_G|_E)\b 0:builtin
add-highlighter shared/lua/code/module regex \b(_G|_E)\b 0:module
add-highlighter shared/lua/code/attribute regex \b(local)\b 0:attribute
add-highlighter shared/lua/code/function_declaration regex \b(?:function\h+)(?:\w+\h*\.\h*)*([a-zA-Z_]\w*)\( 1:function
add-highlighter shared/lua/code/function_call regex \b([a-zA-Z_]\w*)\h*(?=[\(\{]) 1:function
# Commands
# ‾‾‾‾‾‾‾‾