Merge remote-tracking branch 'greenfork/improve-janet-syntax'

This commit is contained in:
Maxime Coste 2023-11-02 18:21:59 +11:00
commit e882c23501

View File

@ -35,14 +35,15 @@ add-highlighter shared/janet regions
add-highlighter shared/janet/code default-region group
add-highlighter shared/janet/comment region '(?<!\\)(?:\\\\)*\K#' '$' fill comment
add-highlighter shared/janet/comment-form region -recurse \( '(?<!\\)(?:\\\\)*\K\(comment ' '\)' fill comment
add-highlighter shared/janet/string region '(^\s+```)|(?<!\\)(?:\\\\)*\K"' '(^\s+```)|(?<!\\)(?:\\\\)*"' fill string
add-highlighter shared/janet/string region '(?<!\\)(?:\\\\)*\K"' '(?<!\\)(?:\\\\)*"' fill string
add-highlighter shared/janet/raw-string region -match-capture '(`+)' '(`+)' fill string
add-highlighter shared/janet/code/ regex \b(nil|true|false)\b 0:value
add-highlighter shared/janet/code/keyword regex \W\K:[!@$%\^&*\-_+=:<>.?\w]+ 0:value
add-highlighter shared/janet/code/number regex \W\K(?:[\-+]?\dx?[\der._+a-f]*)\b 0:value
add-highlighter shared/janet/code/function-definition regex \((?:defn|fn)\s([!@$%\^&*\-_+=:<>.?\w]+) 1:function
add-highlighter shared/janet/code/function-definition regex \((?:defn-?|fn)\s([!@$%\^&*\-_+=:<>.?\w/]+) 1:function
add-highlighter shared/janet/code/function-call regex \(([!@$%\^&*\-_+=:<>.?\w/]+) 1:function
add-highlighter shared/janet/code/special regex \((def|defn|var|fn|do|quote|if|splice|while|break|set|quasiquote|unquote|upscope)\b\s 1:keyword
add-highlighter shared/janet/code/ regex \W\K(&|&opt)\W 1:keyword
add-highlighter shared/janet/code/keyword regex \W\K:[!@$%\^&*\-_+=:<>.?\w/]+ 0:value
add-highlighter shared/janet/code/special regex \((def-?|defn-?|var-?|fn|do|quote|if|splice|while|break|set|quasiquote|unquote|upscope)\s 1:keyword
add-highlighter shared/janet/code/ regex \W\K(&|&opt|&keys|&named)\W 1:keyword
# Commands
# ‾‾‾‾‾‾‾‾
@ -72,6 +73,8 @@ define-command -hidden janet-indent-on-new-line %{
try %{ execute-keys -draft '[rl"i<a-Z><gt>' }
try %{ execute-keys -draft '[Bl"i<a-Z><gt>' }
execute-keys -draft '"i<a-z>a&,'
# trim trailing whitespace on the previous line
try %{ execute-keys -draft k : janet-trim-indent <ret> }
}
}