Make recurse regex opt-in with a -recurse switch instead of opt-out

This commit is contained in:
Maxime Coste 2018-07-02 20:59:12 +10:00
parent f9fda70de6
commit 2e0e206951
58 changed files with 256 additions and 248 deletions

View File

@ -43,9 +43,11 @@ change to make Kakoune command model cleaner and more robust.
------------------------------------------------------------------ ------------------------------------------------------------------
add-highlighter <path>/<name> regions add-highlighter <path>/<name> regions
add-highlighter <path>/<name>/<region name> region <begin> <end> \ add-highlighter <path>/<name>/<region name> region <begin> <end> \
<recurse> <type> <params> <type> <params>
------------------------------------------------------------------ ------------------------------------------------------------------
The recursion regex is opt-in through a `-recurse <recurse>` flag.
They also are not necessarily groups anymore, a region can directly They also are not necessarily groups anymore, a region can directly
apply any other highlighter apply any other highlighter

View File

@ -188,7 +188,8 @@ Individual region definitions can then be added to that highlighter
---------------------------------------------------- ----------------------------------------------------
add-highlighter <path>/<name>/<region_name> region \ add-highlighter <path>/<name>/<region_name> region \
<opening> <closing> <recurse> <type> <params>... [-match-capture] [-recurse <recurse>] \
<opening> <closing> <type> <params>...
---------------------------------------------------- ----------------------------------------------------
*opening*:: *opening*::
@ -199,7 +200,8 @@ add-highlighter <path>/<name>/<region_name> region \
*recurse*:: *recurse*::
regex that defines the text that matches recursively an end token regex that defines the text that matches recursively an end token
into the region into the region, every match of *recurse* will consume a following
match of *end*, preventing it from closing the region.
*type* and *params*:: *type* and *params*::
An highlighter type, and associated params, as they would be passed An highlighter type, and associated params, as they would be passed
@ -224,9 +226,9 @@ accepts nested braces scopes ('{ ... }') so the following string is valid:
This region can be defined with: This region can be defined with:
------------------------ ---------------------------------
shell_expand %sh\{ \} \{ shell_expand -recurse \{ %sh\{ \}
------------------------ ---------------------------------
Regions are matched using the left-most rule: the left-most region opening Regions are matched using the left-most rule: the left-most region opening
starts a new region. When a region closes, the closest next opening start starts a new region. When a region closes, the closest next opening start
@ -247,8 +249,8 @@ highlighter as root:
----------------------------------------------------------------- -----------------------------------------------------------------
add-highlighter <path>/<lang> regions add-highlighter <path>/<lang> regions
add-highlighter <path>/<lang>/string '"' '"' '' fill string add-highlighter <path>/<lang>/string '"' '"' fill string
add-highlighter <path>/<lang>/comment '//' '$' '' fill comment add-highlighter <path>/<lang>/comment '//' '$' fill comment
add-highlighter <path>/<lang>/code default-region group add-highlighter <path>/<lang>/code default-region group
add-highlighter <path>/<lang>/code/variable regex ... add-highlighter <path>/<lang>/code/variable regex ...
add-highlighter <path>/<lang>/code/function regex ... add-highlighter <path>/<lang>/code/function regex ...

View File

@ -13,12 +13,12 @@ hook global BufCreate .*[.](css) %{
add-highlighter shared/css regions add-highlighter shared/css regions
add-highlighter shared/css/selector default-region group add-highlighter shared/css/selector default-region group
add-highlighter shared/css/declaration region [{] [}] '' regions add-highlighter shared/css/declaration region [{] [}] regions
add-highlighter shared/css/comment region /[*] [*]/ '' fill comment add-highlighter shared/css/comment region /[*] [*]/ fill comment
add-highlighter shared/css/declaration/base default-region group add-highlighter shared/css/declaration/base default-region group
add-highlighter shared/css/declaration/double_string region '"' (?<!\\)(\\\\)*" '' fill string add-highlighter shared/css/declaration/double_string region '"' (?<!\\)(\\\\)*" fill string
add-highlighter shared/css/declaration/single_string region "'" "'" '' fill string add-highlighter shared/css/declaration/single_string region "'" "'" fill string
# https://developer.mozilla.org/en-US/docs/Web/CSS/length # https://developer.mozilla.org/en-US/docs/Web/CSS/length
add-highlighter shared/css/declaration/base/ regex (#[0-9A-Fa-f]+)|((\d*\.)?\d+(ch|cm|em|ex|mm|pc|pt|px|rem|vh|vmax|vmin|vw)) 0:value add-highlighter shared/css/declaration/base/ regex (#[0-9A-Fa-f]+)|((\d*\.)?\d+(ch|cm|em|ex|mm|pc|pt|px|rem|vh|vmax|vmin|vw)) 0:value

View File

@ -13,16 +13,16 @@ hook global BufCreate .*\.di? %{
add-highlighter shared/d regions add-highlighter shared/d regions
add-highlighter shared/d/code default-region group add-highlighter shared/d/code default-region group
add-highlighter shared/d/string region %{(?<!')(?<!'\\)"} %{(?<!\\)(?:\\\\)*"} "" group add-highlighter shared/d/string region %{(?<!')(?<!'\\)"} %{(?<!\\)(?:\\\\)*"} group
add-highlighter shared/d/verbatim_string1 region ` ` '' fill magenta add-highlighter shared/d/verbatim_string1 region ` ` fill magenta
add-highlighter shared/d/verbatim_string2 region %{(?<!')(?<!'\\)`} %{(?<!\\)(?:\\\\)*`} "" fill magenta add-highlighter shared/d/verbatim_string2 region %{(?<!')(?<!'\\)`} %{(?<!\\)(?:\\\\)*`} fill magenta
add-highlighter shared/d/verbatim_string_prefixed region %{r`([^(]*)\(} %{\)([^)]*)`} "" fill magenta add-highlighter shared/d/verbatim_string_prefixed region %{r`([^(]*)\(} %{\)([^)]*)`} fill magenta
add-highlighter shared/d/disabled region '/\+[^+]?' '\+/' '' fill rgb:777777 add-highlighter shared/d/disabled region '/\+[^+]?' '\+/' fill rgb:777777
add-highlighter shared/d/comment1 region '/\*[^*]?' '\*/' '' fill comment add-highlighter shared/d/comment1 region '/\*[^*]?' '\*/' fill comment
add-highlighter shared/d/comment2 region '//[^/]?' $ '' fill comment add-highlighter shared/d/comment2 region '//[^/]?' $ fill comment
add-highlighter shared/d/docstring1 region '/\+\+' '\+/' '' fill blue add-highlighter shared/d/docstring1 region '/\+\+' '\+/' fill blue
add-highlighter shared/d/docstring2 region '/\*\*' '\*/' '' fill blue add-highlighter shared/d/docstring2 region '/\*\*' '\*/' fill blue
add-highlighter shared/d/docstring3 region /// $ '' fill blue add-highlighter shared/d/docstring3 region /// $ fill blue
add-highlighter shared/d/string/ fill string add-highlighter shared/d/string/ fill string
add-highlighter shared/d/string/ regex %{\\(x[0-9a-fA-F]{2}|[0-7]{1,3}|u[0-9a-fA-F]{4}|U[0-9a-fA-F]{8})\b} 0:value add-highlighter shared/d/string/ regex %{\\(x[0-9a-fA-F]{2}|[0-7]{1,3}|u[0-9a-fA-F]{4}|U[0-9a-fA-F]{8})\b} 0:value

View File

@ -13,9 +13,9 @@ hook global BufCreate .*[.](fish) %{
add-highlighter shared/fish regions add-highlighter shared/fish regions
add-highlighter shared/fish/code default-region group add-highlighter shared/fish/code default-region group
add-highlighter shared/fish/double_string region '"' (?<!\\)(\\\\)*" '' group add-highlighter shared/fish/double_string region '"' (?<!\\)(\\\\)*" group
add-highlighter shared/fish/single_string region "'" "'" '' fill string add-highlighter shared/fish/single_string region "'" "'" fill string
add-highlighter shared/fish/comment region '#' '$' '' fill comment add-highlighter shared/fish/comment region '#' '$' fill comment
add-highlighter shared/fish/double_string/ fill string add-highlighter shared/fish/double_string/ fill string
add-highlighter shared/fish/double_string/ regex (\$\w+)|(\{\$\w+\}) 0:variable add-highlighter shared/fish/double_string/ regex (\$\w+)|(\{\$\w+\}) 0:variable

View File

@ -7,10 +7,10 @@ hook global BufCreate .*\.(s|S|asm)$ %{
add-highlighter shared/gas regions add-highlighter shared/gas regions
add-highlighter shared/gas/code default-region group add-highlighter shared/gas/code default-region group
add-highlighter shared/gas/string region '"' (?<!\\)(\\\\)*" '' fill string add-highlighter shared/gas/string region '"' (?<!\\)(\\\\)*" fill string
add-highlighter shared/gas/commentMulti region /\* \*/ '' fill comment add-highlighter shared/gas/commentMulti region /\* \*/ fill comment
add-highlighter shared/gas/commentSingle1 region '#' '$' '' fill comment add-highlighter shared/gas/commentSingle1 region '#' '$' fill comment
add-highlighter shared/gas/commentSingle2 region ';' '$' '' fill comment add-highlighter shared/gas/commentSingle2 region ';' '$' fill comment
# Constant # Constant
add-highlighter shared/gas/code/ regex (0[xX][0-9]+|\b[0-9]+)\b 0:value add-highlighter shared/gas/code/ regex (0[xX][0-9]+|\b[0-9]+)\b 0:value

View File

@ -13,11 +13,11 @@ hook global BufCreate .*\.go %{
add-highlighter shared/go regions add-highlighter shared/go regions
add-highlighter shared/go/code default-region group add-highlighter shared/go/code default-region group
add-highlighter shared/go/back_string region '`' '`' '' fill string add-highlighter shared/go/back_string region '`' '`' fill string
add-highlighter shared/go/double_string region '"' (?<!\\)(\\\\)*" '' fill string add-highlighter shared/go/double_string region '"' (?<!\\)(\\\\)*" fill string
add-highlighter shared/go/single_string region "'" (?<!\\)(\\\\)*' '' fill string add-highlighter shared/go/single_string region "'" (?<!\\)(\\\\)*' fill string
add-highlighter shared/go/comment region /\* \*/ '' fill comment add-highlighter shared/go/comment region /\* \*/ fill comment
add-highlighter shared/go/comment_line region '//' $ '' fill comment add-highlighter shared/go/comment_line region '//' $ fill comment
add-highlighter shared/go/code/ regex %{-?([0-9]*\.(?!0[xX]))?\b([0-9]+|0[xX][0-9a-fA-F]+)\.?([eE][+-]?[0-9]+)?i?\b} 0:value add-highlighter shared/go/code/ regex %{-?([0-9]*\.(?!0[xX]))?\b([0-9]+|0[xX][0-9a-fA-F]+)\.?([eE][+-]?[0-9]+)?i?\b} 0:value

View File

@ -13,11 +13,11 @@ hook global BufCreate .*[.](hs) %{
add-highlighter shared/haskell regions add-highlighter shared/haskell regions
add-highlighter shared/haskell/code default-region group add-highlighter shared/haskell/code default-region group
add-highlighter shared/haskell/string region (?<!'\\)(?<!')" (?<!\\)(\\\\)*" '' fill string add-highlighter shared/haskell/string region (?<!'\\)(?<!')" (?<!\\)(\\\\)*" fill string
add-highlighter shared/haskell/macro region ^\h*?\K# (?<!\\)\n '' fill meta add-highlighter shared/haskell/macro region ^\h*?\K# (?<!\\)\n fill meta
add-highlighter shared/haskell/pragma region \{-# '#-\}' \{- fill meta add-highlighter shared/haskell/pragma region -recurse \{- \{-# '#-\}' fill meta
add-highlighter shared/haskell/comment region \{- -\} \{- fill comment add-highlighter shared/haskell/comment region -recurse \{- \{- -\} fill comment
add-highlighter shared/haskell/line_comment region --(?:[^!#$%&*+./<>?@\\\^|~=]|$) $ '' fill comment add-highlighter shared/haskell/line_comment region --(?:[^!#$%&*+./<>?@\\\^|~=]|$) $ fill comment
add-highlighter shared/haskell/code/ regex (?<!')\b0x+[A-Fa-f0-9]+ 0:value add-highlighter shared/haskell/code/ regex (?<!')\b0x+[A-Fa-f0-9]+ 0:value
add-highlighter shared/haskell/code/ regex (?<!')\b\d+([.]\d+)? 0:value add-highlighter shared/haskell/code/ regex (?<!')\b\d+([.]\d+)? 0:value

View File

@ -16,14 +16,14 @@ hook global BufCreate .*\.xml %{
# ‾‾‾‾‾‾‾‾‾‾‾‾ # ‾‾‾‾‾‾‾‾‾‾‾‾
add-highlighter shared/html regions add-highlighter shared/html regions
add-highlighter shared/html/comment region <!-- --> '' fill comment add-highlighter shared/html/comment region <!-- --> fill comment
add-highlighter shared/html/tag region < > '' regions add-highlighter shared/html/tag region < > regions
add-highlighter shared/html/style region <style\b.*?>\K (?=</style>) '' ref css add-highlighter shared/html/style region <style\b.*?>\K (?=</style>) ref css
add-highlighter shared/html/script region <script\b.*?>\K (?=</script>) '' ref javascript add-highlighter shared/html/script region <script\b.*?>\K (?=</script>) ref javascript
add-highlighter shared/html/tag/base default-region group add-highlighter shared/html/tag/base default-region group
add-highlighter shared/html/tag/ region '"' (?<!\\)(\\\\)*" '' fill string add-highlighter shared/html/tag/ region '"' (?<!\\)(\\\\)*" fill string
add-highlighter shared/html/tag/ region "'" "'" '' fill string add-highlighter shared/html/tag/ region "'" "'" fill string
add-highlighter shared/html/tag/base/ regex \b([a-zA-Z0-9_-]+)=? 1:attribute add-highlighter shared/html/tag/base/ regex \b([a-zA-Z0-9_-]+)=? 1:attribute
add-highlighter shared/html/tag/base/ regex </?(\w+) 1:keyword add-highlighter shared/html/tag/base/ regex </?(\w+) 1:keyword

View File

@ -4,7 +4,7 @@ hook global BufCreate .*\.(repo|service|target|socket|ini|cfg|properties) %{
add-highlighter shared/ini regions add-highlighter shared/ini regions
add-highlighter shared/ini/code default-region group add-highlighter shared/ini/code default-region group
add-highlighter shared/ini/comment region '(^|\h)\K[#;]' $ '' fill comment add-highlighter shared/ini/comment region '(^|\h)\K[#;]' $ fill comment
add-highlighter shared/ini/code/ regex "^\h*\[[^\]]*\]" 0:title add-highlighter shared/ini/code/ regex "^\h*\[[^\]]*\]" 0:title
add-highlighter shared/ini/code/ regex "^\h*([^\[][^=\n]*)=([^\n]*)" 1:variable 2:value add-highlighter shared/ini/code/ regex "^\h*([^\[][^=\n]*)=([^\n]*)" 1:variable 2:value

View File

@ -4,9 +4,9 @@ hook global BufCreate .*\.java %{
add-highlighter shared/java regions add-highlighter shared/java regions
add-highlighter shared/java/code default-region group add-highlighter shared/java/code default-region group
add-highlighter shared/java/string region %{(?<!')"} %{(?<!\\)(\\\\)*"} '' fill string add-highlighter shared/java/string region %{(?<!')"} %{(?<!\\)(\\\\)*"} fill string
add-highlighter shared/java/comment region /\* \*/ '' fill comment add-highlighter shared/java/comment region /\* \*/ fill comment
add-highlighter shared/java/line_comment region // $ '' fill comment add-highlighter shared/java/line_comment region // $ fill comment
add-highlighter shared/java/code/ regex %{\b(this|true|false|null)\b} 0:value add-highlighter shared/java/code/ regex %{\b(this|true|false|null)\b} 0:value
add-highlighter shared/java/code/ regex "\b(void|int|char|unsigned|float|boolean|double)\b" 0:type add-highlighter shared/java/code/ regex "\b(void|int|char|unsigned|float|boolean|double)\b" 0:type

View File

@ -45,15 +45,15 @@ define-command -hidden init-javascript-filetype -params 1 %~
add-highlighter "shared/%arg{1}" regions add-highlighter "shared/%arg{1}" regions
add-highlighter "shared/%arg{1}/code" default-region group add-highlighter "shared/%arg{1}/code" default-region group
add-highlighter "shared/%arg{1}/double_string" region '"' (?<!\\)(\\\\)*" '' fill string add-highlighter "shared/%arg{1}/double_string" region '"' (?<!\\)(\\\\)*" fill string
add-highlighter "shared/%arg{1}/single_string" region "'" (?<!\\)(\\\\)*' '' fill string add-highlighter "shared/%arg{1}/single_string" region "'" (?<!\\)(\\\\)*' fill string
add-highlighter "shared/%arg{1}/literal" region "`" (?<!\\)(\\\\)*` '' group add-highlighter "shared/%arg{1}/literal" region "`" (?<!\\)(\\\\)*` group
add-highlighter "shared/%arg{1}/comment_line" region // '$' '' fill comment add-highlighter "shared/%arg{1}/comment_line" region // '$' fill comment
add-highlighter "shared/%arg{1}/comment" region /\* \*/ '' fill comment add-highlighter "shared/%arg{1}/comment" region /\* \*/ fill comment
add-highlighter "shared/%arg{1}/shebang" region ^#! $ '' fill meta add-highlighter "shared/%arg{1}/shebang" region ^#! $ fill meta
add-highlighter "shared/%arg{1}/regex" region / (?<!\\)(\\\\)*/[gimuy]* '' fill meta add-highlighter "shared/%arg{1}/regex" region / (?<!\\)(\\\\)*/[gimuy]* fill meta
add-highlighter "shared/%arg{1}/jsx" region (?<![\w<])<[a-zA-Z][\w:.-]*(?!\hextends)(?=[\s/>])(?!>\()) (</.*?>|/>) (?<![\w<])<[a-zA-Z][\w:.-]* regions add-highlighter "shared/%arg{1}/jsx" region -recurse (?<![\w<])<[a-zA-Z][\w:.-]* (?<![\w<])<[a-zA-Z][\w:.-]*(?!\hextends)(?=[\s/>])(?!>\()) (</.*?>|/>) regions
add-highlighter "shared/%arg{1}/division" region '[\w\)\]]\K(/|(\h+/\h+))' '(?=\w)' '' group # Help Kakoune to better detect /…/ literals add-highlighter "shared/%arg{1}/division" region '[\w\)\]]\K(/|(\h+/\h+))' '(?=\w)' group # Help Kakoune to better detect /…/ literals
# Regular expression flags are: g → global match, i → ignore case, m → multi-lines, u → unicode, y → sticky # Regular expression flags are: g → global match, i → ignore case, m → multi-lines, u → unicode, y → sticky
# https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/RegExp # https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/RegExp
@ -70,14 +70,14 @@ define-command -hidden init-javascript-filetype -params 1 %~
# We inline a small XML highlighter here since it anyway need to recurse back up to the starting highlighter. # We inline a small XML highlighter here since it anyway need to recurse back up to the starting highlighter.
# To make things simple we assume that jsx is always enabled. # To make things simple we assume that jsx is always enabled.
add-highlighter "shared/%arg{1}/jsx/tag" region <(?=[/a-zA-Z]) (?<!=)> < regions add-highlighter "shared/%arg{1}/jsx/tag" region -recurse < <(?=[/a-zA-Z]) (?<!=)> regions
add-highlighter "shared/%arg{1}/jsx/expr" region \{ \} \{ ref %arg{1} add-highlighter "shared/%arg{1}/jsx/expr" region -recurse \{ \{ \} ref %arg{1}
add-highlighter "shared/%arg{1}/jsx/tag/base" default-region group add-highlighter "shared/%arg{1}/jsx/tag/base" default-region group
add-highlighter "shared/%arg{1}/jsx/tag/double_string" region =\K" (?<!\\)(\\\\)*" '' fill string add-highlighter "shared/%arg{1}/jsx/tag/double_string" region =\K" (?<!\\)(\\\\)*" fill string
add-highlighter "shared/%arg{1}/jsx/tag/single_string" region =\K' (?<!\\)(\\\\)*' '' fill string add-highlighter "shared/%arg{1}/jsx/tag/single_string" region =\K' (?<!\\)(\\\\)*' fill string
add-highlighter "shared/%arg{1}/jsx/tag/expr" region \{ \} \{ group add-highlighter "shared/%arg{1}/jsx/tag/expr" region -recurse \{ \{ \} group
add-highlighter "shared/%arg{1}/jsx/tag/base/" regex (\w+) 1:attribute add-highlighter "shared/%arg{1}/jsx/tag/base/" regex (\w+) 1:attribute
add-highlighter "shared/%arg{1}/jsx/tag/base/" regex </?([\w-$]+) 1:keyword add-highlighter "shared/%arg{1}/jsx/tag/base/" regex </?([\w-$]+) 1:keyword

View File

@ -13,7 +13,7 @@ hook global BufCreate .*[.](json) %{
add-highlighter shared/json regions add-highlighter shared/json regions
add-highlighter shared/json/code default-region group add-highlighter shared/json/code default-region group
add-highlighter shared/json/string region '"' (?<!\\)(\\\\)*" '' fill string add-highlighter shared/json/string region '"' (?<!\\)(\\\\)*" fill string
add-highlighter shared/json/code/ regex \b(true|false|null|\d+(?:\.\d+)?(?:[eE][+-]?\d*)?)\b 0:value add-highlighter shared/json/code/ regex \b(true|false|null|\d+(?:\.\d+)?(?:[eE][+-]?\d*)?)\b 0:value

View File

@ -13,8 +13,8 @@ hook global BufCreate .*\.(jl) %{
add-highlighter shared/julia regions add-highlighter shared/julia regions
add-highlighter shared/julia/code default-region group add-highlighter shared/julia/code default-region group
add-highlighter shared/julia/string region '"' (?<!\\)(\\\\)*" '' fill string add-highlighter shared/julia/string region '"' (?<!\\)(\\\\)*" fill string
add-highlighter shared/julia/comment region '#' '$' '' fill comment add-highlighter shared/julia/comment region '#' '$' fill comment
# taken from https://github.com/JuliaLang/julia/blob/master/contrib/julia-mode.el # taken from https://github.com/JuliaLang/julia/blob/master/contrib/julia-mode.el
add-highlighter shared/julia/code/ regex %{\b(true|false|C_NULL|Inf|NaN|Inf32|NaN32|nothing|\b-?\d+[fdiu]?)\b} 0:value add-highlighter shared/julia/code/ regex %{\b(true|false|C_NULL|Inf|NaN|Inf32|NaN32|nothing|\b-?\d+[fdiu]?)\b} 0:value

View File

@ -13,8 +13,8 @@ hook global BufCreate .*[.](lisp) %{
add-highlighter shared/lisp regions add-highlighter shared/lisp regions
add-highlighter shared/lisp/code default-region group add-highlighter shared/lisp/code default-region group
add-highlighter shared/lisp/string region '"' (?<!\\)(\\\\)*" '' fill string add-highlighter shared/lisp/string region '"' (?<!\\)(\\\\)*" fill string
add-highlighter shared/lisp/comment region ';' '$' '' fill comment add-highlighter shared/lisp/comment region ';' '$' fill comment
add-highlighter shared/lisp/code/ regex \b(nil|true|false)\b 0:value add-highlighter shared/lisp/code/ regex \b(nil|true|false)\b 0:value
add-highlighter shared/lisp/code/ regex (((\Q***\E)|(///)|(\Q+++\E)){1,3})|(1[+-])|(<|>|<=|=|>=) 0:operator add-highlighter shared/lisp/code/ regex (((\Q***\E)|(///)|(\Q+++\E)){1,3})|(1[+-])|(<|>|<=|=|>=) 0:operator

View File

@ -13,11 +13,11 @@ hook global BufCreate .*[.](lua) %{
add-highlighter shared/lua regions add-highlighter shared/lua regions
add-highlighter shared/lua/code default-region group add-highlighter shared/lua/code default-region group
add-highlighter shared/lua/double_string region '"' (?<!\\)(?:\\\\)*" '' fill string add-highlighter shared/lua/double_string region '"' (?<!\\)(?:\\\\)*" fill string
add-highlighter shared/lua/single_string region "'" (?<!\\)(?:\\\\)*' '' fill string add-highlighter shared/lua/single_string region "'" (?<!\\)(?:\\\\)*' fill string
add-highlighter shared/lua/comment region '--' $ '' fill comment add-highlighter shared/lua/comment region '--' $ fill comment
add-highlighter shared/lua/raw_string region -match-capture '\[(=*)\[' '\](=*)\]' '' fill string add-highlighter shared/lua/raw_string region -match-capture '\[(=*)\[' '\](=*)\]' fill string
add-highlighter shared/lua/raw_comment region -match-capture '--\[(=*)\[' '\](=*)\]' '' fill comment add-highlighter shared/lua/raw_comment region -match-capture '--\[(=*)\[' '\](=*)\]' fill comment
add-highlighter shared/lua/code/ regex \b(and|break|do|else|elseif|end|false|for|function|goto|if|in|local|nil|not|or|repeat|return|then|true|until|while)\b 0:keyword add-highlighter shared/lua/code/ regex \b(and|break|do|else|elseif|end|false|for|function|goto|if|in|local|nil|not|or|repeat|return|then|true|until|while)\b 0:keyword

View File

@ -13,7 +13,7 @@ hook global BufCreate .*[.](markdown|md|mkd) %{
add-highlighter shared/markdown regions add-highlighter shared/markdown regions
add-highlighter shared/markdown/content default-region group add-highlighter shared/markdown/content default-region group
add-highlighter shared/markdown/code region ``` ``` '' fill meta add-highlighter shared/markdown/code region ``` ``` fill meta
evaluate-commands %sh{ evaluate-commands %sh{
languages=" languages="
@ -23,10 +23,10 @@ evaluate-commands %sh{
sass scala scss sh swift tupfile typescript yaml sass scala scss sh swift tupfile typescript yaml
" "
for lang in ${languages}; do for lang in ${languages}; do
printf 'add-highlighter shared/markdown/%s region ```\h*%s\\b ``` "" regions\n' "${lang}" "${lang}" printf 'add-highlighter shared/markdown/%s region ```\h*%s\\b ``` regions\n' "${lang}" "${lang}"
printf 'add-highlighter shared/markdown/%s/ default-region fill meta\n' "${lang}" printf 'add-highlighter shared/markdown/%s/ default-region fill meta\n' "${lang}"
ref=$([ "${lang}" = kak ] && echo kakrc || echo "${lang}") ref=$([ "${lang}" = kak ] && echo kakrc || echo "${lang}")
printf 'add-highlighter shared/markdown/%s/inner region \A```[^\\n]*\K (?=```) "" ref %s\n' "${lang}" "${ref}" printf 'add-highlighter shared/markdown/%s/inner region \A```[^\\n]*\K (?=```) ref %s\n' "${lang}" "${ref}"
done done
} }

View File

@ -15,8 +15,8 @@ hook global BufCreate .*\.mli? %{
add-highlighter shared/ocaml regions add-highlighter shared/ocaml regions
add-highlighter shared/ocaml/code default-region group add-highlighter shared/ocaml/code default-region group
add-highlighter shared/ocaml/string region '"' (?<!\\)(\\\\)*" '' fill string add-highlighter shared/ocaml/string region '"' (?<!\\)(\\\\)*" fill string
add-highlighter shared/ocaml/comment region \Q(* \Q*) '' fill comment add-highlighter shared/ocaml/comment region \Q(* \Q*) fill comment
# Commands # Commands
# ‾‾‾‾‾‾‾‾ # ‾‾‾‾‾‾‾‾

View File

@ -13,10 +13,10 @@ hook global BufCreate .*\.p[lm] %{
add-highlighter shared/perl regions add-highlighter shared/perl regions
add-highlighter shared/perl/code default-region group add-highlighter shared/perl/code default-region group
add-highlighter shared/perl/command region (?<!\$)(?<!\\)` (?<!\\)(\\\\)*` '' fill magenta add-highlighter shared/perl/command region (?<!\$)(?<!\\)` (?<!\\)(\\\\)*` fill magenta
add-highlighter shared/perl/double_string region (?<!\$)(?<!\\)" (?<!\\)(\\\\)*" '' fill string add-highlighter shared/perl/double_string region (?<!\$)(?<!\\)" (?<!\\)(\\\\)*" fill string
add-highlighter shared/perl/single_string region (?<!\$)(?<!\\\\)' (?<!\\)(\\\\)*' '' fill string add-highlighter shared/perl/single_string region (?<!\$)(?<!\\\\)' (?<!\\)(\\\\)*' fill string
add-highlighter shared/perl/comment region (?<!\$)(?<!\\)# $ '' fill comment add-highlighter shared/perl/comment region (?<!\$)(?<!\\)# $ fill comment
evaluate-commands %sh{ evaluate-commands %sh{
# Grammar # Grammar

View File

@ -10,7 +10,7 @@ hook global BufCreate .*[.](rst) %{
add-highlighter shared/restructuredtext regions add-highlighter shared/restructuredtext regions
add-highlighter shared/restructuredtext/content default-region group add-highlighter shared/restructuredtext/content default-region group
add-highlighter shared/restructuredtext/code region ::\h*\n ^[^\s] '' fill meta add-highlighter shared/restructuredtext/code region ::\h*\n ^[^\s] fill meta
evaluate-commands %sh{ evaluate-commands %sh{
for ft in c cabal clojure coffee cpp css cucumber ddiff dockerfile \ for ft in c cabal clojure coffee cpp css cucumber ddiff dockerfile \
@ -19,7 +19,7 @@ evaluate-commands %sh{
perl pug python ragel ruby rust sass scala scss sh swift \ perl pug python ragel ruby rust sass scala scss sh swift \
tupfile yaml; do tupfile yaml; do
ref=$(if [ "$ft" = kak ]; then echo "kakrc"; else echo "$ft"; fi) ref=$(if [ "$ft" = kak ]; then echo "kakrc"; else echo "$ft"; fi)
printf 'add-highlighter shared/restructuredtext/%s region %s %s "" ref %s\n' "$ft" '\.\.\h*'$ft'::\h*c\h*\n' '^\S' "$ref" printf 'add-highlighter shared/restructuredtext/%s region %s %s ref %s\n' "$ft" '\.\.\h*'$ft'::\h*c\h*\n' '^\S' "$ref"
done done
} }

View File

@ -13,30 +13,30 @@ hook global BufCreate .*(([.](rb))|(irbrc)|(pryrc)|(Capfile|[.]cap)|(Gemfile|[.]
add-highlighter shared/ruby regions add-highlighter shared/ruby regions
add-highlighter shared/ruby/code default-region group add-highlighter shared/ruby/code default-region group
add-highlighter shared/ruby/double_string region '"' (?<!\\)(\\\\)*" '' regions add-highlighter shared/ruby/double_string region '"' (?<!\\)(\\\\)*" regions
add-highlighter shared/ruby/single_string region "'" (?<!\\)(\\\\)*' '' fill string add-highlighter shared/ruby/single_string region "'" (?<!\\)(\\\\)*' fill string
add-highlighter shared/ruby/backtick region '`' (?<!\\)(\\\\)*` '' regions add-highlighter shared/ruby/backtick region '`' (?<!\\)(\\\\)*` regions
add-highlighter shared/ruby/regex region '/' (?<!\\)(\\\\)*/[imox]* '' regions add-highlighter shared/ruby/regex region '/' (?<!\\)(\\\\)*/[imox]* regions
add-highlighter shared/ruby/ region '#' '$' '' fill comment add-highlighter shared/ruby/ region '#' '$' fill comment
add-highlighter shared/ruby/ region ^begin= ^=end '' fill comment add-highlighter shared/ruby/ region ^begin= ^=end fill comment
add-highlighter shared/ruby/ region '%[iqrswxIQRSWX]\(' \) \( fill meta add-highlighter shared/ruby/ region -recurse \( '%[iqrswxIQRSWX]\(' \) fill meta
add-highlighter shared/ruby/ region '%[iqrswxIQRSWX]\{' \} \{ fill meta add-highlighter shared/ruby/ region -recurse \{ '%[iqrswxIQRSWX]\{' \} fill meta
add-highlighter shared/ruby/ region '%[iqrswxIQRSWX]\[' \] \[ fill meta add-highlighter shared/ruby/ region -recurse \[ '%[iqrswxIQRSWX]\[' \] fill meta
add-highlighter shared/ruby/ region '%[iqrswxIQRSWX]<' > < fill meta add-highlighter shared/ruby/ region -recurse < '%[iqrswxIQRSWX]<' > fill meta
add-highlighter shared/ruby/heredoc region '<<[-~]?(\w+)' '^\h*(\w+)$' '' fill string add-highlighter shared/ruby/heredoc region '<<[-~]?(\w+)' '^\h*(\w+)$' fill string
add-highlighter shared/ruby/division region '[\w\)\]](/|(\h+/\h+))' '\w' '' group # Help Kakoune to better detect /…/ literals add-highlighter shared/ruby/division region '[\w\)\]](/|(\h+/\h+))' '\w' group # Help Kakoune to better detect /…/ literals
# Regular expression flags are: i → ignore case, m → multi-lines, o → only interpolate #{} blocks once, x → extended mode (ignore white spaces) # Regular expression flags are: i → ignore case, m → multi-lines, o → only interpolate #{} blocks once, x → extended mode (ignore white spaces)
# Literals are: i → array of symbols, q → string, r → regular expression, s → symbol, w → array of words, x → capture shell result # Literals are: i → array of symbols, q → string, r → regular expression, s → symbol, w → array of words, x → capture shell result
add-highlighter shared/ruby/double_string/ default-region fill string add-highlighter shared/ruby/double_string/ default-region fill string
add-highlighter shared/ruby/double_string/interpolation region \Q#{ \} \{ fill meta add-highlighter shared/ruby/double_string/interpolation region -recurse \{ \Q#{ \} fill meta
add-highlighter shared/ruby/backtick/ default-region fill meta add-highlighter shared/ruby/backtick/ default-region fill meta
add-highlighter shared/ruby/backtick/interpolation region \Q#{ \} \{ fill meta add-highlighter shared/ruby/backtick/interpolation region -recurse \{ \Q#{ \} fill meta
add-highlighter shared/ruby/regex/ default-region fill meta add-highlighter shared/ruby/regex/ default-region fill meta
add-highlighter shared/ruby/regex/interpolation region \Q#{ \} \{ fill meta add-highlighter shared/ruby/regex/interpolation region -recurse \{ \Q#{ \} fill meta
add-highlighter shared/ruby/code/ regex \b([A-Za-z]\w*:(?!:))|([$@][A-Za-z]\w*)|((?<!:):(([A-Za-z]\w*[=?!]?)|(\[\]=?)))|([A-Z]\w*|^|\h)\K::(?=[A-Z]) 0:variable add-highlighter shared/ruby/code/ regex \b([A-Za-z]\w*:(?!:))|([$@][A-Za-z]\w*)|((?<!:):(([A-Za-z]\w*[=?!]?)|(\[\]=?)))|([A-Z]\w*|^|\h)\K::(?=[A-Z]) 0:variable

View File

@ -13,9 +13,9 @@ hook global BufCreate .*[.](rust|rs) %{
add-highlighter shared/rust regions add-highlighter shared/rust regions
add-highlighter shared/rust/code default-region group add-highlighter shared/rust/code default-region group
add-highlighter shared/rust/string region %{(?<!')"} (?<!\\)(\\\\)*" '' fill string add-highlighter shared/rust/string region %{(?<!')"} (?<!\\)(\\\\)*" fill string
add-highlighter shared/rust/comment region /\* \*/ /\* fill comment add-highlighter shared/rust/comment region -recurse /\* /\* \*/ fill comment
add-highlighter shared/rust/line_comment region // $ '' fill comment add-highlighter shared/rust/line_comment region // $ fill comment
add-highlighter shared/rust/code/ regex \b[A-z0-9_]+! 0:meta add-highlighter shared/rust/code/ regex \b[A-z0-9_]+! 0:meta
# the number literals syntax is defined here: # the number literals syntax is defined here:

View File

@ -13,10 +13,10 @@ hook global BufCreate .*[.](scala) %{
add-highlighter shared/scala regions add-highlighter shared/scala regions
add-highlighter shared/scala/code default-region group add-highlighter shared/scala/code default-region group
add-highlighter shared/scala/string region '"' (?<!\\)(\\\\)*" '' fill string add-highlighter shared/scala/string region '"' (?<!\\)(\\\\)*" fill string
add-highlighter shared/scala/literal region ` ` '' fill variable add-highlighter shared/scala/literal region ` ` fill variable
add-highlighter shared/scala/comment region /[*] [*]/ /[*] fill comment add-highlighter shared/scala/comment region -recurse /[*] /[*] [*]/ fill comment
add-highlighter shared/scala/line_comment region // $ '' fill comment add-highlighter shared/scala/line_comment region // $ fill comment
# Keywords are collected at # Keywords are collected at
# http://tutorialspoint.com/scala/scala_basic_syntax.htm # http://tutorialspoint.com/scala/scala_basic_syntax.htm

View File

@ -13,11 +13,11 @@ hook global BufCreate .*/?(?i)sql %{
add-highlighter shared/sql regions add-highlighter shared/sql regions
add-highlighter shared/sql/code default-region group add-highlighter shared/sql/code default-region group
add-highlighter shared/sql/double_string region '"' (?<!\\)(\\\\)*" '' fill string add-highlighter shared/sql/double_string region '"' (?<!\\)(\\\\)*" fill string
add-highlighter shared/sql/single_string region "'" (?<!\\)(\\\\)*' '' fill string add-highlighter shared/sql/single_string region "'" (?<!\\)(\\\\)*' fill string
add-highlighter shared/sql/comment1 region '--' '$' '' fill comment add-highlighter shared/sql/comment1 region '--' '$' fill comment
add-highlighter shared/sql/comment2 region '#' '$' '' fill comment add-highlighter shared/sql/comment2 region '#' '$' fill comment
add-highlighter shared/sql/comment3 region '/\*' '\*/' '' fill comment add-highlighter shared/sql/comment3 region '/\*' '\*/' fill comment
evaluate-commands %sh{ evaluate-commands %sh{
# Keywords # Keywords

View File

@ -4,9 +4,9 @@ hook global BufCreate .*\.(swift) %{
add-highlighter shared/swift regions add-highlighter shared/swift regions
add-highlighter shared/swift/code default-region group add-highlighter shared/swift/code default-region group
add-highlighter shared/swift/string region %{(?<!')"} %{(?<!\\)(\\\\)*"} '' fill string add-highlighter shared/swift/string region %{(?<!')"} %{(?<!\\)(\\\\)*"} fill string
add-highlighter shared/swift/comment region /\* \*/ '' group add-highlighter shared/swift/comment region /\* \*/ group
add-highlighter shared/swift/line_comment region // $ '' ref swift/comment add-highlighter shared/swift/line_comment region // $ ref swift/comment
add-highlighter shared/swift/comment/ fill comment add-highlighter shared/swift/comment/ fill comment
add-highlighter shared/swift/comment/ regex "\b(TODO|XXX|MARK)\b" 0:red add-highlighter shared/swift/comment/ regex "\b(TODO|XXX|MARK)\b" 0:red

View File

@ -13,9 +13,9 @@ hook global BufCreate .*[.](ya?ml) %{
add-highlighter shared/yaml regions add-highlighter shared/yaml regions
add-highlighter shared/yaml/code default-region group add-highlighter shared/yaml/code default-region group
add-highlighter shared/yaml/double_string region '"' (?<!\\)(\\\\)*" '' fill string add-highlighter shared/yaml/double_string region '"' (?<!\\)(\\\\)*" fill string
add-highlighter shared/yaml/single_string region "'" "'" '' fill string add-highlighter shared/yaml/single_string region "'" "'" fill string
add-highlighter shared/yaml/comment region '#' '$' '' fill comment add-highlighter shared/yaml/comment region '#' '$' fill comment
add-highlighter shared/yaml/code/ regex ^(---|\.\.\.)$ 0:meta add-highlighter shared/yaml/code/ regex ^(---|\.\.\.)$ 0:meta
add-highlighter shared/yaml/code/ regex ^(\h*:\w*) 0:keyword add-highlighter shared/yaml/code/ regex ^(\h*:\w*) 0:keyword

View File

@ -138,12 +138,12 @@ evaluate-commands %sh{
printf %s\\n ' printf %s\\n '
add-highlighter shared/FT regions add-highlighter shared/FT regions
add-highlighter shared/FT/code default-region group add-highlighter shared/FT/code default-region group
add-highlighter shared/FT/string region %{MAYBEAT(?<!QUOTE)(?<!QUOTE\\)"} %{(?<!\\)(?:\\\\)*"} "" fill string add-highlighter shared/FT/string region %{MAYBEAT(?<!QUOTE)(?<!QUOTE\\)"} %{(?<!\\)(?:\\\\)*"} fill string
add-highlighter shared/FT/raw_string region %{R"([^(]*)\(} %{\)([^")]*)"} "" fill string add-highlighter shared/FT/raw_string region %{R"([^(]*)\(} %{\)([^")]*)"} fill string
add-highlighter shared/FT/comment region /\* \*/ "" fill comment add-highlighter shared/FT/comment region /\* \*/ fill comment
add-highlighter shared/FT/line_comment region // $ "" fill comment add-highlighter shared/FT/line_comment region // $ fill comment
add-highlighter shared/FT/disabled region ^\h*?#\h*if\h+(?:0|FALSE)\b "#\h*(?:else|elif|endif)" "#\h*if(?:def)?" fill rgb:666666 add-highlighter shared/FT/disabled region -recurse "#\h*if(?:def)?" ^\h*?#\h*if\h+(?:0|FALSE)\b "#\h*(?:else|elif|endif)" fill rgb:666666
add-highlighter shared/FT/macro region %{^\h*?\K#} %{(?<!\\)\n} "" group add-highlighter shared/FT/macro region %{^\h*?\K#} %{(?<!\\)\n} group
add-highlighter shared/FT/macro/ fill meta add-highlighter shared/FT/macro/ fill meta
add-highlighter shared/FT/macro/ regex ^\h*#include\h+(\S*) 1:module add-highlighter shared/FT/macro/ regex ^\h*#include\h+(\S*) 1:module

View File

@ -13,17 +13,17 @@ hook global BufCreate (.*/)?(kakrc|.*.kak) %{
add-highlighter shared/kakrc regions add-highlighter shared/kakrc regions
add-highlighter shared/kakrc/code default-region group add-highlighter shared/kakrc/code default-region group
add-highlighter shared/kakrc/comment region (^|\h)\K# $ '' fill comment add-highlighter shared/kakrc/comment region (^|\h)\K# $ fill comment
add-highlighter shared/kakrc/double_string region %{(^|\h)\K"} %{"(?!")} %{(?<!")("")+(?!")} group add-highlighter shared/kakrc/double_string region -recurse %{(?<!")("")+(?!")} %{(^|\h)\K"} %{"(?!")} group
add-highlighter shared/kakrc/single_string region %{(^|\h)\K'} %{'(?!')} %{(?<!')('')+(?!')} group add-highlighter shared/kakrc/single_string region -recurse %{(?<!')('')+(?!')} %{(^|\h)\K'} %{'(?!')} group
add-highlighter shared/kakrc/shell1 region '(^|\h)\K%?%sh\{' '\}' '\{' ref sh add-highlighter shared/kakrc/shell1 region -recurse '\{' '(^|\h)\K%?%sh\{' '\}' ref sh
add-highlighter shared/kakrc/shell2 region '(^|\h)\K%?%sh\(' '\)' '\(' ref sh add-highlighter shared/kakrc/shell2 region -recurse '\(' '(^|\h)\K%?%sh\(' '\)' ref sh
add-highlighter shared/kakrc/shell3 region '(^|\h)\K%?%sh\[' '\]' '\[' ref sh add-highlighter shared/kakrc/shell3 region -recurse '\[' '(^|\h)\K%?%sh\[' '\]' ref sh
add-highlighter shared/kakrc/shell4 region '(^|\h)\K%?%sh<' '>' '<' ref sh add-highlighter shared/kakrc/shell4 region -recurse '<' '(^|\h)\K%?%sh<' '>' ref sh
add-highlighter shared/kakrc/shell5 region '(^|\h)\K-shell-(completion|candidates)\h+%\{' '\}' '\{' ref sh add-highlighter shared/kakrc/shell5 region -recurse '\{' '(^|\h)\K-shell-(completion|candidates)\h+%\{' '\}' ref sh
add-highlighter shared/kakrc/shell6 region '(^|\h)\K-shell-(completion|candidates)\h+%\(' '\)' '\(' ref sh add-highlighter shared/kakrc/shell6 region -recurse '\(' '(^|\h)\K-shell-(completion|candidates)\h+%\(' '\)' ref sh
add-highlighter shared/kakrc/shell7 region '(^|\h)\K-shell-(completion|candidates)\h+%\[' '\]' '\[' ref sh add-highlighter shared/kakrc/shell7 region -recurse '\[' '(^|\h)\K-shell-(completion|candidates)\h+%\[' '\]' ref sh
add-highlighter shared/kakrc/shell8 region '(^|\h)\K-shell-(completion|candidates)\h+%<' '>' '<' ref sh add-highlighter shared/kakrc/shell8 region -recurse '<' '(^|\h)\K-shell-(completion|candidates)\h+%<' '>' ref sh
evaluate-commands %sh{ evaluate-commands %sh{
# Grammar # Grammar

View File

@ -11,8 +11,8 @@ hook global BufCreate .*/?[mM]akefile %{
add-highlighter shared/makefile regions add-highlighter shared/makefile regions
add-highlighter shared/makefile/content default-region group add-highlighter shared/makefile/content default-region group
add-highlighter shared/makefile/comment region '#' '$' '' fill comment add-highlighter shared/makefile/comment region '#' '$' fill comment
add-highlighter shared/makefile/evaluate-commands region '\$\(' '\)' '\(' fill value add-highlighter shared/makefile/evaluate-commands region -recurse '\(' '\$\(' '\)' fill value
add-highlighter shared/makefile/content/ regex ^[\w.%-]+\h*:\s 0:variable add-highlighter shared/makefile/content/ regex ^[\w.%-]+\h*:\s 0:variable
add-highlighter shared/makefile/content/ regex [+?:]= 0:operator add-highlighter shared/makefile/content/ regex [+?:]= 0:operator

View File

@ -13,10 +13,10 @@ hook global BufCreate .*[.](py) %{
add-highlighter shared/python regions add-highlighter shared/python regions
add-highlighter shared/python/code default-region group add-highlighter shared/python/code default-region group
add-highlighter shared/python/docstring region -match-capture ("""|''') ("""|''') '' regions add-highlighter shared/python/docstring region -match-capture ("""|''') ("""|''') regions
add-highlighter shared/python/double_string region '"' (?<!\\)(\\\\)*" '' fill string add-highlighter shared/python/double_string region '"' (?<!\\)(\\\\)*" fill string
add-highlighter shared/python/single_string region "'" (?<!\\)(\\\\)*' '' fill string add-highlighter shared/python/single_string region "'" (?<!\\)(\\\\)*' fill string
add-highlighter shared/python/comment region '#' '$' '' fill comment add-highlighter shared/python/comment region '#' '$' fill comment
# Integer formats # Integer formats
add-highlighter shared/python/code/ regex '(?i)\b0b[01]+l?\b' 0:value add-highlighter shared/python/code/ regex '(?i)\b0b[01]+l?\b' 0:value
@ -31,8 +31,8 @@ add-highlighter shared/python/code/ regex '\b\d+\.' 0:value
add-highlighter shared/python/code/ regex '\b\d+\+\d+[jJ]\b' 0:value add-highlighter shared/python/code/ regex '\b\d+\+\d+[jJ]\b' 0:value
add-highlighter shared/python/docstring/ default-region fill string add-highlighter shared/python/docstring/ default-region fill string
add-highlighter shared/python/docstring/ region '>>> \K' '\z' '' ref python add-highlighter shared/python/docstring/ region '>>> \K' '\z' ref python
add-highlighter shared/python/docstring/ region '\.\.\. \K' '\z' '' ref python add-highlighter shared/python/docstring/ region '\.\.\. \K' '\z' ref python
evaluate-commands %sh{ evaluate-commands %sh{
# Grammar # Grammar

View File

@ -4,10 +4,10 @@ hook global BufCreate .*\.(z|ba|c|k|mk)?sh(rc|_profile)? %{
add-highlighter shared/sh regions add-highlighter shared/sh regions
add-highlighter shared/sh/code default-region group add-highlighter shared/sh/code default-region group
add-highlighter shared/sh/double_string region %{(?<!\\)(?:\\\\)*\K"} %{(?<!\\)(?:\\\\)*"} '' group add-highlighter shared/sh/double_string region %{(?<!\\)(?:\\\\)*\K"} %{(?<!\\)(?:\\\\)*"} group
add-highlighter shared/sh/single_string region %{(?<!\\)(?:\\\\)*\K'} %{'} '' fill string add-highlighter shared/sh/single_string region %{(?<!\\)(?:\\\\)*\K'} %{'} fill string
add-highlighter shared/sh/comment region '(?<!\$)#' '$' '' fill comment add-highlighter shared/sh/comment region '(?<!\$)#' '$' fill comment
add-highlighter shared/sh/heredoc region -match-capture '<<-?(\w+)' '^\t*(\w+)$' '' fill string add-highlighter shared/sh/heredoc region -match-capture '<<-?(\w+)' '^\t*(\w+)$' fill string
add-highlighter shared/sh/double_string/fill fill string add-highlighter shared/sh/double_string/fill fill string

View File

@ -13,8 +13,8 @@ hook global BufCreate .*[.](cabal) %{
add-highlighter shared/cabal regions add-highlighter shared/cabal regions
add-highlighter shared/cabal/code default-region group add-highlighter shared/cabal/code default-region group
add-highlighter shared/cabal/line_comment region (--) $ '' fill comment add-highlighter shared/cabal/line_comment region (--) $ fill comment
add-highlighter shared/cabal/comment region \{- -\} \{- fill comment add-highlighter shared/cabal/comment region -recurse \{- \{- -\} fill comment
add-highlighter shared/cabal/code/ regex \b(true|false)\b|(([<>]?=?)?\d+(\.\d+)+) 0:value add-highlighter shared/cabal/code/ regex \b(true|false)\b|(([<>]?=?)?\d+(\.\d+)+) 0:value
add-highlighter shared/cabal/code/ regex \b(if|else)\b 0:keyword add-highlighter shared/cabal/code/ regex \b(if|else)\b 0:keyword

View File

@ -4,14 +4,14 @@ hook global BufCreate .+\.cmake|.*/CMakeLists.txt %{
add-highlighter shared/cmake regions add-highlighter shared/cmake regions
add-highlighter shared/cmake/code default-region group add-highlighter shared/cmake/code default-region group
add-highlighter shared/cmake/comment region '#' '$' '' fill comment add-highlighter shared/cmake/comment region '#' '$' fill comment
add-highlighter shared/cmake/argument region '\w+\h*\(\K' '(?=\))' '\(' regions add-highlighter shared/cmake/argument region -recurse '\(' '\w+\h*\(\K' '(?=\))' regions
add-highlighter shared/cmake/code/ regex '\w+\h*(?=\()' 0:meta add-highlighter shared/cmake/code/ regex '\w+\h*(?=\()' 0:meta
add-highlighter shared/cmake/argument/args default-region regex '\$\{\w+\}' 0:variable add-highlighter shared/cmake/argument/args default-region regex '\$\{\w+\}' 0:variable
add-highlighter shared/cmake/argument/quoted region '"' '(?<!\\)(\\\\)*"' '' group add-highlighter shared/cmake/argument/quoted region '"' '(?<!\\)(\\\\)*"' group
add-highlighter shared/cmake/argument/raw-quoted region -match-capture '\[(=*)\[' '\](=*)\]' '' ref cmake/argument/quoted add-highlighter shared/cmake/argument/raw-quoted region -match-capture '\[(=*)\[' '\](=*)\]' ref cmake/argument/quoted
add-highlighter shared/cmake/argument/quoted/ fill string add-highlighter shared/cmake/argument/quoted/ fill string
add-highlighter shared/cmake/argument/quoted/ regex '\$\{\w+\}' 0:variable add-highlighter shared/cmake/argument/quoted/ regex '\$\{\w+\}' 0:variable

View File

@ -13,22 +13,22 @@ hook global BufCreate .*[.](coffee) %{
add-highlighter shared/coffee regions add-highlighter shared/coffee regions
add-highlighter shared/coffee/code default-region group add-highlighter shared/coffee/code default-region group
add-highlighter shared/coffee/single_string region "'" "'" '' fill string add-highlighter shared/coffee/single_string region "'" "'" fill string
add-highlighter shared/coffee/single_string_alt region "'''" "'''" '' fill string add-highlighter shared/coffee/single_string_alt region "'''" "'''" fill string
add-highlighter shared/coffee/double_string region '"' (?<!\\)(\\\\)*" '' regions add-highlighter shared/coffee/double_string region '"' (?<!\\)(\\\\)*" regions
add-highlighter shared/coffee/double_string_alt region '"""' '"""' '' ref shared/coffee/double_string add-highlighter shared/coffee/double_string_alt region '"""' '"""' ref shared/coffee/double_string
add-highlighter shared/coffee/regex region '/' (?<!\\)(\\\\)*/[gimy]* '' regions add-highlighter shared/coffee/regex region '/' (?<!\\)(\\\\)*/[gimy]* regions
add-highlighter shared/coffee/regex_alt region '///' ///[gimy]* '' ref shared/coffee/regex add-highlighter shared/coffee/regex_alt region '///' ///[gimy]* ref shared/coffee/regex
add-highlighter shared/coffee/comment1 region '#' '$' '' fill comment add-highlighter shared/coffee/comment1 region '#' '$' fill comment
add-highlighter shared/coffee/comment2 region '###' '###' '' fill comment add-highlighter shared/coffee/comment2 region '###' '###' fill comment
# Regular expression flags are: g → global match, i → ignore case, m → multi-lines, y → sticky # Regular expression flags are: g → global match, i → ignore case, m → multi-lines, y → sticky
# https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/RegExp # https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/RegExp
add-highlighter shared/coffee/double_string/base default-region fill string add-highlighter shared/coffee/double_string/base default-region fill string
add-highlighter shared/coffee/double_string/interpolation region \Q#{ \} \{ fill meta add-highlighter shared/coffee/double_string/interpolation region -recurse \{ \Q#{ \} fill meta
add-highlighter shared/coffee/regex/base default-region fill meta add-highlighter shared/coffee/regex/base default-region fill meta
add-highlighter shared/coffee/regex/interpolation region \Q#{ \} \{ fill meta add-highlighter shared/coffee/regex/interpolation region -recurse \{ \Q#{ \} fill meta
# Keywords are collected at # Keywords are collected at
# https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Lexical_grammar#Keywords # https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Lexical_grammar#Keywords

View File

@ -13,8 +13,8 @@ hook global BufCreate .*[.](feature|story) %{
add-highlighter shared/cucumber regions add-highlighter shared/cucumber regions
add-highlighter shared/cucumber/code default-region group add-highlighter shared/cucumber/code default-region group
add-highlighter shared/cucumber/language region ^\h*#\h*language: $ '' group add-highlighter shared/cucumber/language region ^\h*#\h*language: $ group
add-highlighter shared/cucumber/comment region ^\h*# $ '' fill comment add-highlighter shared/cucumber/comment region ^\h*# $ fill comment
add-highlighter shared/cucumber/language/ fill meta add-highlighter shared/cucumber/language/ fill meta
add-highlighter shared/cucumber/language/ regex \S+$ 0:value add-highlighter shared/cucumber/language/ regex \S+$ 0:value

View File

@ -15,9 +15,9 @@ hook global BufCreate .*/?Dockerfile(\.\w+)?$ %{
add-highlighter shared/dockerfile regions add-highlighter shared/dockerfile regions
add-highlighter shared/dockerfile/code default-region group add-highlighter shared/dockerfile/code default-region group
add-highlighter shared/dockerfile/double_string region '"' '(?<!\\)(\\\\)*"' '' fill string add-highlighter shared/dockerfile/double_string region '"' '(?<!\\)(\\\\)*"' fill string
add-highlighter shared/dockerfile/single_string region "'" "'" '' fill string add-highlighter shared/dockerfile/single_string region "'" "'" fill string
add-highlighter shared/dockerfile/comment region '#' $ '' fill comment add-highlighter shared/dockerfile/comment region '#' $ fill comment
evaluate-commands %sh{ evaluate-commands %sh{
# Grammar # Grammar

View File

@ -14,13 +14,13 @@ hook global BufCreate .*[.](ex|exs) %{
add-highlighter shared/elixir regions add-highlighter shared/elixir regions
add-highlighter shared/elixir/code default-region group add-highlighter shared/elixir/code default-region group
add-highlighter shared/elixir/double_string region '"' (?<!\\)(\\\\)*" '' regions add-highlighter shared/elixir/double_string region '"' (?<!\\)(\\\\)*" regions
add-highlighter shared/elixir/triple_string region '"""' (?<!\\)(\\\\)*""" '' ref shared/elixir/double_string add-highlighter shared/elixir/triple_string region '"""' (?<!\\)(\\\\)*""" ref shared/elixir/double_string
add-highlighter shared/elixir/single_string region "'" (?<!\\)(\\\\)*' '' fill string add-highlighter shared/elixir/single_string region "'" (?<!\\)(\\\\)*' fill string
add-highlighter shared/elixir/comment region '#' '$' '' fill comment add-highlighter shared/elixir/comment region '#' '$' fill comment
add-highlighter shared/elixir/double_string/base default-region fill string add-highlighter shared/elixir/double_string/base default-region fill string
add-highlighter shared/elixir/double_string/interpolation region \Q#{ \} \{ fill builtin add-highlighter shared/elixir/double_string/interpolation region -recurse \{ \Q#{ \} fill builtin
add-highlighter shared/elixir/code/ regex ':[\w_]+\b' 0:type add-highlighter shared/elixir/code/ regex ':[\w_]+\b' 0:type
add-highlighter shared/elixir/code/ regex '[\w_]+:' 0:type add-highlighter shared/elixir/code/ regex '[\w_]+:' 0:type

View File

@ -13,9 +13,9 @@ hook global BufCreate .*[.](elm) %{
add-highlighter shared/elm regions add-highlighter shared/elm regions
add-highlighter shared/elm/code default-region group add-highlighter shared/elm/code default-region group
add-highlighter shared/elm/string region '"' (?<!\\)(\\\\)*" '' fill string add-highlighter shared/elm/string region '"' (?<!\\)(\\\\)*" fill string
add-highlighter shared/elm/line_comment region (--) $ '' fill comment add-highlighter shared/elm/line_comment region (--) $ fill comment
add-highlighter shared/elm/comment region \{- -\} \{- fill comment add-highlighter shared/elm/comment region -recurse \{- \{- -\} fill comment
add-highlighter shared/elm/code/ regex \b(import|exposing|as|module|where)\b 0:meta add-highlighter shared/elm/code/ regex \b(import|exposing|as|module|where)\b 0:meta
add-highlighter shared/elm/code/ regex \b(True|False)\b 0:value add-highlighter shared/elm/code/ regex \b(True|False)\b 0:value

View File

@ -13,14 +13,14 @@ hook global BufCreate .*[.](haml) %{
add-highlighter shared/haml regions add-highlighter shared/haml regions
add-highlighter shared/haml/code default-region group add-highlighter shared/haml/code default-region group
add-highlighter shared/haml/comment region ^\h*/ $ '' fill comment add-highlighter shared/haml/comment region ^\h*/ $ fill comment
# Filters # Filters
# http://haml.info/docs/yardoc/file.REFERENCE.html#filters # http://haml.info/docs/yardoc/file.REFERENCE.html#filters
add-highlighter shared/haml/eval1 region ^\h*%([A-Za-z][A-Za-z0-9_-]*)([#.][A-Za-z][A-Za-z0-9_-]*)?\{\K|#\{\K (?=\}) \{ ref ruby add-highlighter shared/haml/eval1 region -recurse \{ ^\h*%([A-Za-z][A-Za-z0-9_-]*)([#.][A-Za-z][A-Za-z0-9_-]*)?\{\K|#\{\K (?=\}) ref ruby
add-highlighter shared/haml/eval2 region ^\h*[=-]\K (?<!\|)(?=\n) '' ref ruby add-highlighter shared/haml/eval2 region ^\h*[=-]\K (?<!\|)(?=\n) ref ruby
add-highlighter shared/haml/coffee region ^\h*:coffee\K ^\h*[%=-]\K '' ref coffee add-highlighter shared/haml/coffee region ^\h*:coffee\K ^\h*[%=-]\K ref coffee
add-highlighter shared/haml/sass region ^\h*:sass\K ^\h*[%=-]\K '' ref sass add-highlighter shared/haml/sass region ^\h*:sass\K ^\h*[%=-]\K ref sass
add-highlighter shared/haml/code/ regex ^\h*(:[a-z]+|-|=)|^(!!!)$ 0:meta add-highlighter shared/haml/code/ regex ^\h*(:[a-z]+|-|=)|^(!!!)$ 0:meta
add-highlighter shared/haml/code/ regex ^\h*%([A-Za-z][A-Za-z0-9_-]*)([#.][A-Za-z][A-Za-z0-9_-]*)? 1:keyword 2:variable add-highlighter shared/haml/code/ regex ^\h*%([A-Za-z][A-Za-z0-9_-]*)([#.][A-Za-z][A-Za-z0-9_-]*)? 1:keyword 2:variable

View File

@ -13,9 +13,9 @@ hook global BufCreate .*[.](hbs) %{
add-highlighter shared/hbs regions add-highlighter shared/hbs regions
add-highlighter shared/hbs/html default-region ref html add-highlighter shared/hbs/html default-region ref html
add-highlighter shared/hbs/comment region \{\{!-- --\}\} ' ' fill comment add-highlighter shared/hbs/comment region -recurse ' ' \{\{!-- --\}\} fill comment
add-highlighter shared/hbs/comment_alt region \{\{! \}\} '' fill comment add-highlighter shared/hbs/comment_alt region \{\{! \}\} fill comment
add-highlighter shared/hbs/block-expression region \{\{ \}\} '' group add-highlighter shared/hbs/block-expression region \{\{ \}\} group
add-highlighter shared/hbs/block-expression/ regex \{\{((#|/|)(\w|-)+) 1:meta add-highlighter shared/hbs/block-expression/ regex \{\{((#|/|)(\w|-)+) 1:meta

View File

@ -4,10 +4,10 @@ hook global BufCreate .*(sway|i3)/config %{
add-highlighter shared/i3 regions add-highlighter shared/i3 regions
add-highlighter shared/i3/code default-region group add-highlighter shared/i3/code default-region group
add-highlighter shared/i3/double_string region %{"} %{"} "" group add-highlighter shared/i3/double_string region %{"} %{"} group
add-highlighter shared/i3/single_string region %{'} %{'} "" group add-highlighter shared/i3/single_string region %{'} %{'} group
add-highlighter shared/i3/exec region %{(?<=exec)} "$" "" fill string add-highlighter shared/i3/exec region %{(?<=exec)} "$" fill string
add-highlighter shared/i3/comment region "# " "$" "" fill comment add-highlighter shared/i3/comment region "# " "$" fill comment
add-highlighter shared/i3/double_string/ fill string add-highlighter shared/i3/double_string/ fill string
add-highlighter shared/i3/single_string/ fill string add-highlighter shared/i3/single_string/ fill string

View File

@ -24,11 +24,11 @@ define-command -hidden just-indent-on-new-line %{
add-highlighter shared/justfile regions add-highlighter shared/justfile regions
add-highlighter shared/justfile/content default-region group add-highlighter shared/justfile/content default-region group
add-highlighter shared/justfile/comment region '#' '$' '' fill comment add-highlighter shared/justfile/comment region '#' '$' fill comment
add-highlighter shared/justfile/double_string region '"' (?<!\\)(\\\\)*" '' fill string add-highlighter shared/justfile/double_string region '"' (?<!\\)(\\\\)*" fill string
add-highlighter shared/justfile/single_string region "'" (?<!\\)(\\\\)*' '' fill string add-highlighter shared/justfile/single_string region "'" (?<!\\)(\\\\)*' fill string
add-highlighter shared/justfile/inline region '`' '`' '' ref sh add-highlighter shared/justfile/inline region '`' '`' ref sh
add-highlighter shared/justfile/shell region '^\h+' '^[^\h]' '' group add-highlighter shared/justfile/shell region '^\h+' '^[^\h]' group
add-highlighter shared/justfile/shell/ ref sh add-highlighter shared/justfile/shell/ ref sh

View File

@ -4,11 +4,11 @@ hook global BufCreate .*\.ks %{
add-highlighter shared/kickstart regions add-highlighter shared/kickstart regions
add-highlighter shared/kickstart/code default-region group add-highlighter shared/kickstart/code default-region group
add-highlighter shared/kickstart/comment region '(^|\h)\K#' $ '' fill comment add-highlighter shared/kickstart/comment region '(^|\h)\K#' $ fill comment
add-highlighter shared/kickstart/double_string region '"' (?<!\\)(\\\\)*" '' fill string add-highlighter shared/kickstart/double_string region '"' (?<!\\)(\\\\)*" fill string
add-highlighter shared/kickstart/single_string region "'" (?<!\\)(\\\\)*' '' fill string add-highlighter shared/kickstart/single_string region "'" (?<!\\)(\\\\)*' fill string
add-highlighter shared/kickstart/packages region '^\h*\K%packages\b' '^\h*\K%end\b' '' group add-highlighter shared/kickstart/packages region '^\h*\K%packages\b' '^\h*\K%end\b' group
add-highlighter shared/kickstart/shell region '^\h*\K%(pre|pre-install|post)\b' '^\h*\K%end\b' '' group add-highlighter shared/kickstart/shell region '^\h*\K%(pre|pre-install|post)\b' '^\h*\K%end\b' group
add-highlighter shared/kickstart/code/ regex "^\h*\b(auth|authconfig|autopart|autostep|bootloader|btrfs|clearpart|cmdline|device|dmraid|driverdisk|fcoe|firewall|firstboot|group|graphical|halt|ignoredisk|install|cdrom|harddrive|liveimg|nfs|url|iscsi|iscsiname|keyboard|lang|logvol|logging|mediacheck|monitor|multipath|network|part|partition|poweroff|raid|realm|reboot|repo|rescue|rootpw|selinux|services|shutdown|sshkey|sshpw|skipx|text|timezone|updates|upgrade|user|vnc|volgroup|xconfig|zerombr|zfcp)\b" 1:keyword add-highlighter shared/kickstart/code/ regex "^\h*\b(auth|authconfig|autopart|autostep|bootloader|btrfs|clearpart|cmdline|device|dmraid|driverdisk|fcoe|firewall|firstboot|group|graphical|halt|ignoredisk|install|cdrom|harddrive|liveimg|nfs|url|iscsi|iscsiname|keyboard|lang|logvol|logging|mediacheck|monitor|multipath|network|part|partition|poweroff|raid|realm|reboot|repo|rescue|rootpw|selinux|services|shutdown|sshkey|sshpw|skipx|text|timezone|updates|upgrade|user|vnc|volgroup|xconfig|zerombr|zfcp)\b" 1:keyword
add-highlighter shared/kickstart/code/ regex '(--[\w-]+=? ?)([^-"\n][^\h\n]*)?' 1:attribute 2:string add-highlighter shared/kickstart/code/ regex '(--[\w-]+=? ?)([^-"\n][^\h\n]*)?' 1:attribute 2:string

View File

@ -13,7 +13,7 @@ hook global BufCreate .*\.tex %{
add-highlighter shared/latex regions add-highlighter shared/latex regions
add-highlighter shared/latex/content default-region group add-highlighter shared/latex/content default-region group
add-highlighter shared/latex/comment region '(?<!\\)%' '\n' '' fill comment add-highlighter shared/latex/comment region '(?<!\\)%' '\n' fill comment
# Scopes, starting with a backslash # Scopes, starting with a backslash
add-highlighter shared/latex/content/ regex '\\(?!_)\w+\b' 0:keyword add-highlighter shared/latex/content/ regex '\\(?!_)\w+\b' 0:keyword

View File

@ -13,12 +13,12 @@ hook global BufCreate .*[.](moon) %{
add-highlighter shared/moon regions add-highlighter shared/moon regions
add-highlighter shared/moon/code default-region group add-highlighter shared/moon/code default-region group
add-highlighter shared/moon/double_string region '"' (?<!\\)(\\\\)*" '' regions add-highlighter shared/moon/double_string region '"' (?<!\\)(\\\\)*" regions
add-highlighter shared/moon/single_string region "'" (?<!\\)(\\\\)*' '' fill string add-highlighter shared/moon/single_string region "'" (?<!\\)(\\\\)*' fill string
add-highlighter shared/moon/comment region '--' '$' '' fill comment add-highlighter shared/moon/comment region '--' '$' fill comment
add-highlighter shared/moon/double_string/base default-region fill string add-highlighter shared/moon/double_string/base default-region fill string
add-highlighter shared/moon/double_string/interpolation region \Q#{ \} \{ fill meta add-highlighter shared/moon/double_string/interpolation region -recurse \{ \Q#{ \} fill meta
add-highlighter shared/moon/code/ regex ([.\\](?=[A-Za-z]))|(\b[A-Za-z]\w*:)|(\b[A-Za-z]\w*\K!+)|(\W\K[@:][A-Za-z]\w*) 0:variable add-highlighter shared/moon/code/ regex ([.\\](?=[A-Za-z]))|(\b[A-Za-z]\w*:)|(\b[A-Za-z]\w*\K!+)|(\W\K[@:][A-Za-z]\w*) 0:variable
add-highlighter shared/moon/code/ regex \b(and|break|catch|class|continue|do|else(if)?|export|extends|false|finally|for|from|if|import|in|local|nil|not|or|return|super|switch|then|true|try|unless|using|when|while|with)\b 0:keyword add-highlighter shared/moon/code/ regex \b(and|break|catch|class|continue|do|else(if)?|export|extends|false|finally|for|from|if|import|in|local|nil|not|or|return|super|switch|then|true|try|unless|using|when|while|with)\b 0:keyword

View File

@ -13,9 +13,9 @@ hook global BufCreate .*\.nim(s|ble)? %{
add-highlighter shared/nim regions add-highlighter shared/nim regions
add-highlighter shared/nim/code default-region group add-highlighter shared/nim/code default-region group
add-highlighter shared/nim/double_string region '"' (?<!\\)(\\\\)*" '' fill string add-highlighter shared/nim/double_string region '"' (?<!\\)(\\\\)*" fill string
add-highlighter shared/nim/triple_string region '"""' '"""' '' fill string add-highlighter shared/nim/triple_string region '"""' '"""' fill string
add-highlighter shared/nim/comment region '#?#\[' '\]##?' '' fill comment add-highlighter shared/nim/comment region '#?#\[' '\]##?' fill comment
add-highlighter shared/nim/code/ regex \b(0[xXocCbB])?[\d_]+('[iIuUfFdD](8|16|32|64|128))?\b 0:value add-highlighter shared/nim/code/ regex \b(0[xXocCbB])?[\d_]+('[iIuUfFdD](8|16|32|64|128))?\b 0:value
add-highlighter shared/nim/code/ regex \b\d+\.\d+\b 0:value add-highlighter shared/nim/code/ regex \b\d+\.\d+\b 0:value

View File

@ -10,13 +10,13 @@ hook global BufCreate .*[.](php) %{
add-highlighter shared/php regions add-highlighter shared/php regions
add-highlighter shared/php/code default-region group add-highlighter shared/php/code default-region group
add-highlighter shared/php/double_string region '"' (?<!\\)(\\\\)*" '' group add-highlighter shared/php/double_string region '"' (?<!\\)(\\\\)*" group
add-highlighter shared/php/single_string region "'" (?<!\\)(\\\\)*' '' fill string add-highlighter shared/php/single_string region "'" (?<!\\)(\\\\)*' fill string
add-highlighter shared/php/doc_comment region /// '$' '' group add-highlighter shared/php/doc_comment region /// '$' group
add-highlighter shared/php/doc_comment2 region /\*\* \*/ '' ref php/doc_comment add-highlighter shared/php/doc_comment2 region /\*\* \*/ ref php/doc_comment
add-highlighter shared/php/comment1 region // '$' '' fill comment add-highlighter shared/php/comment1 region // '$' fill comment
add-highlighter shared/php/comment2 region /\* \*/ '' fill comment add-highlighter shared/php/comment2 region /\* \*/ fill comment
add-highlighter shared/php/comment3 region '#' '$' '' fill comment add-highlighter shared/php/comment3 region '#' '$' fill comment
@ -43,7 +43,7 @@ add-highlighter shared/php/code/ regex \b(__halt_compiler|abstract|and|array|as|
# Highlighter for html with php tags in it, i.e. the structure of conventional php files # Highlighter for html with php tags in it, i.e. the structure of conventional php files
add-highlighter shared/php-file regions add-highlighter shared/php-file regions
add-highlighter shared/php-file/html default-region ref html add-highlighter shared/php-file/html default-region ref html
add-highlighter shared/php-file/php region '<\?(php)?' '\?>' '' ref php add-highlighter shared/php-file/php region '<\?(php)?' '\?>' ref php
# Commands # Commands
# ‾‾‾‾‾‾‾‾ # ‾‾‾‾‾‾‾‾

View File

@ -13,10 +13,10 @@ hook global BufCreate .*[.](pony) %{
add-highlighter shared/pony regions add-highlighter shared/pony regions
add-highlighter shared/pony/code default-region group add-highlighter shared/pony/code default-region group
add-highlighter shared/pony/triple_string region '"""' '"""' '' fill string add-highlighter shared/pony/triple_string region '"""' '"""' fill string
add-highlighter shared/pony/double_string region '"' (?<!\\)(\\\\)*" '' fill string add-highlighter shared/pony/double_string region '"' (?<!\\)(\\\\)*" fill string
add-highlighter shared/pony/comment region '/\*' '\*/' '' fill comment add-highlighter shared/pony/comment region '/\*' '\*/' fill comment
add-highlighter shared/pony/line_comment region '//' '$' '' fill comment add-highlighter shared/pony/line_comment region '//' '$' fill comment
evaluate-commands %sh{ evaluate-commands %sh{
# Grammar # Grammar

View File

@ -17,14 +17,14 @@ hook global BufCreate .*[.](pug|jade) %{
add-highlighter shared/pug regions add-highlighter shared/pug regions
add-highlighter shared/pug/code default-region group add-highlighter shared/pug/code default-region group
add-highlighter shared/pug/text region ^\h*\|\s $ '' regex \h*(\|) 1:meta add-highlighter shared/pug/text region ^\h*\|\s $ regex \h*(\|) 1:meta
add-highlighter shared/pug/text2 region '^\h*([A-Za-z][A-Za-z0-9_-]*)?(#[A-Za-z][A-Za-z0-9_-]*)?((?:\.[A-Za-z][A-Za-z0-9_-]*)*)?(?<!\t)(?<! )(?<!\n)\h+\K.*' $ '' regex \h*(\|) 1:meta add-highlighter shared/pug/text2 region '^\h*([A-Za-z][A-Za-z0-9_-]*)?(#[A-Za-z][A-Za-z0-9_-]*)?((?:\.[A-Za-z][A-Za-z0-9_-]*)*)?(?<!\t)(?<! )(?<!\n)\h+\K.*' $ regex \h*(\|) 1:meta
add-highlighter shared/pug/javascript region ^\h*[-=!] $ '' ref javascript add-highlighter shared/pug/javascript region ^\h*[-=!] $ ref javascript
add-highlighter shared/pug/double_string region '"' (?:(?<!\\)(\\\\)*"|$) '' fill string add-highlighter shared/pug/double_string region '"' (?:(?<!\\)(\\\\)*"|$) fill string
add-highlighter shared/pug/single_string region "'" (?:(?<!\\)(\\\\)*'|$) '' fill string add-highlighter shared/pug/single_string region "'" (?:(?<!\\)(\\\\)*'|$) fill string
add-highlighter shared/pug/comment region // $ '' fill comment add-highlighter shared/pug/comment region // $ fill comment
add-highlighter shared/pug/attribute region \( \) \( group add-highlighter shared/pug/attribute region -recurse \( \( \) group
add-highlighter shared/pug/puglang region ^\h*\b(\block|extends|include|append|prepend|if|unless|else|case|when|default|each|while|mixin)\b $ '' group add-highlighter shared/pug/puglang region ^\h*\b(\block|extends|include|append|prepend|if|unless|else|case|when|default|each|while|mixin)\b $ group
# Filters # Filters
# ‾‾‾‾‾‾‾ # ‾‾‾‾‾‾‾

View File

@ -15,9 +15,9 @@ hook global BufCreate .*[.](ragel|rl) %{
add-highlighter shared/ragel regions add-highlighter shared/ragel regions
add-highlighter shared/ragel/code default-region group add-highlighter shared/ragel/code default-region group
add-highlighter shared/ragel/double_string region '"' (?<!\\)(\\\\)*" '' fill string add-highlighter shared/ragel/double_string region '"' (?<!\\)(\\\\)*" fill string
add-highlighter shared/ragel/single_string region "'" "'" '' fill string add-highlighter shared/ragel/single_string region "'" "'" fill string
add-highlighter shared/ragel/comment region '#' '$' '' fill comment add-highlighter shared/ragel/comment region '#' '$' fill comment
add-highlighter shared/ragel/code/ regex \b(true|false)\b 0:value add-highlighter shared/ragel/code/ regex \b(true|false)\b 0:value
add-highlighter shared/ragel/code/ regex '%%\{|\}%%|<\w+>' 0:variable add-highlighter shared/ragel/code/ regex '%%\{|\}%%|<\w+>' 0:variable

View File

@ -13,9 +13,9 @@ hook global BufCreate .*[.](sass) %{
add-highlighter shared/sass regions add-highlighter shared/sass regions
add-highlighter shared/sass/code default-region group add-highlighter shared/sass/code default-region group
add-highlighter shared/sass/single_string region '"' (?<!\\)(\\\\)*" '' fill string add-highlighter shared/sass/single_string region '"' (?<!\\)(\\\\)*" fill string
add-highlighter shared/sass/double_string region "'" "'" '' fill string add-highlighter shared/sass/double_string region "'" "'" fill string
add-highlighter shared/sass/comment region '/' '$' '' fill comment add-highlighter shared/sass/comment region '/' '$' fill comment
add-highlighter shared/sass/code/ regex [*]|[#.][A-Za-z][A-Za-z0-9_-]* 0:variable add-highlighter shared/sass/code/ regex [*]|[#.][A-Za-z][A-Za-z0-9_-]* 0:variable
add-highlighter shared/sass/code/ regex &|@[A-Za-z][A-Za-z0-9_-]* 0:meta add-highlighter shared/sass/code/ regex &|@[A-Za-z][A-Za-z0-9_-]* 0:meta

View File

@ -15,7 +15,7 @@ hook global BufCreate .*[.](scss) %{
add-highlighter shared/scss regions add-highlighter shared/scss regions
add-highlighter shared/scss/core default-region group add-highlighter shared/scss/core default-region group
add-highlighter shared/scss/comment region // $ '' fill comment add-highlighter shared/scss/comment region // $ fill comment
add-highlighter shared/scss/core/ ref css add-highlighter shared/scss/core/ ref css
add-highlighter shared/scss/core/ regex @[A-Za-z][A-Za-z0-9_-]* 0:meta add-highlighter shared/scss/core/ regex @[A-Za-z][A-Za-z0-9_-]* 0:meta

View File

@ -13,11 +13,11 @@ hook global BufCreate .*\.(toml) %{
add-highlighter shared/toml regions add-highlighter shared/toml regions
add-highlighter shared/toml/code default-region group add-highlighter shared/toml/code default-region group
add-highlighter shared/toml/comment region '#' $ '' fill comment add-highlighter shared/toml/comment region '#' $ fill comment
add-highlighter shared/toml/string1 region '"""' (?<!\\)(\\\\)*""" '' fill string add-highlighter shared/toml/string1 region '"""' (?<!\\)(\\\\)*""" fill string
add-highlighter shared/toml/string2 region "'''" "'''" '' fill string add-highlighter shared/toml/string2 region "'''" "'''" fill string
add-highlighter shared/toml/string3 region '"' (?<!\\)(\\\\)*" '' fill string add-highlighter shared/toml/string3 region '"' (?<!\\)(\\\\)*" fill string
add-highlighter shared/toml/string4 region "'" "'" '' fill string add-highlighter shared/toml/string4 region "'" "'" fill string
add-highlighter shared/toml/code/ regex \ add-highlighter shared/toml/code/ regex \
"^\h*\[\[?([A-Za-z0-9._-]*)\]\]?" 1:title "^\h*\[\[?([A-Za-z0-9._-]*)\]\]?" 1:title

View File

@ -13,8 +13,8 @@ hook global BufCreate .*/?Tup(file|rules)(\.\w+)?$ %{
add-highlighter shared/tupfile regions add-highlighter shared/tupfile regions
add-highlighter shared/tupfile/code default-region group add-highlighter shared/tupfile/code default-region group
add-highlighter shared/tupfile/string region '"' (?<!\\)(\\\\)*" '' fill string add-highlighter shared/tupfile/string region '"' (?<!\\)(\\\\)*" fill string
add-highlighter shared/tupfile/comment region '#' $ '' fill comment add-highlighter shared/tupfile/comment region '#' $ fill comment
add-highlighter shared/tupfile/code/ regex '%[fbBeoOdg]\b' 0:value add-highlighter shared/tupfile/code/ regex '%[fbBeoOdg]\b' 0:value
add-highlighter shared/tupfile/code/ regex '[$@]\([\w_]+\)' 0:value add-highlighter shared/tupfile/code/ regex '[$@]\([\w_]+\)' 0:value

View File

@ -1858,9 +1858,9 @@ public:
throw runtime_error{"region highlighter can only be added to a regions parent"}; throw runtime_error{"region highlighter can only be added to a regions parent"};
static const ParameterDesc param_desc{ static const ParameterDesc param_desc{
{ { "match-capture", { false, "" } } }, { { "match-capture", { false, "" } }, { "recurse", { true, "" } } },
ParameterDesc::Flags::SwitchesOnlyAtStart | ParameterDesc::Flags::IgnoreUnknownSwitches, ParameterDesc::Flags::SwitchesOnlyAtStart | ParameterDesc::Flags::IgnoreUnknownSwitches,
4 3
}; };
ParametersParser parser{params, param_desc}; ParametersParser parser{params, param_desc};
@ -1872,14 +1872,18 @@ public:
const RegexCompileFlags flags = match_capture ? const RegexCompileFlags flags = match_capture ?
RegexCompileFlags::Optimize : RegexCompileFlags::NoSubs | RegexCompileFlags::Optimize; RegexCompileFlags::Optimize : RegexCompileFlags::NoSubs | RegexCompileFlags::Optimize;
const auto& type = parser[3]; const auto& type = parser[2];
auto& registry = HighlighterRegistry::instance(); auto& registry = HighlighterRegistry::instance();
auto it = registry.find(type); auto it = registry.find(type);
if (it == registry.end()) if (it == registry.end())
throw runtime_error(format("no such highlighter type: '{}'", type)); throw runtime_error(format("no such highlighter type: '{}'", type));
auto delegate = it->value.factory(parser.positionals_from(4), nullptr); Regex recurse;
return std::make_unique<RegionHighlighter>(std::move(delegate), Regex{parser[0], flags}, Regex{parser[1], flags}, parser[2].empty() ? Regex{} : Regex{parser[2], flags}, match_capture); if (auto recurse_switch = parser.get_switch("recurse"))
recurse = Regex{*recurse_switch, flags};
auto delegate = it->value.factory(parser.positionals_from(3), nullptr);
return std::make_unique<RegionHighlighter>(std::move(delegate), Regex{parser[0], flags}, Regex{parser[1], flags}, recurse, match_capture);
} }
static std::unique_ptr<Highlighter> create_default_region(HighlighterParameters params, Highlighter* parent) static std::unique_ptr<Highlighter> create_default_region(HighlighterParameters params, Highlighter* parent)

View File

@ -1,3 +1,3 @@
add-highlighter window/regions_test regions add-highlighter window/regions_test regions
add-highlighter window/regions_test/code default-region fill yellow add-highlighter window/regions_test/code default-region fill yellow
add-highlighter window/regions_test/argument region '\w+\h*\(\K' '(?=\))' '\(' fill red add-highlighter window/regions_test/argument region -recurse '\(' '\w+\h*\(\K' '(?=\))' fill red

View File

@ -1,4 +1,4 @@
add-highlighter window/regions_test regions add-highlighter window/regions_test regions
add-highlighter window/regions_test/code default-region fill yellow add-highlighter window/regions_test/code default-region fill yellow
add-highlighter window/regions_test/string region %{"} %{(?<!\\)(\\\\)*"} '' fill green add-highlighter window/regions_test/string region %{"} %{(?<!\\)(\\\\)*"} fill green
add-highlighter window/regions_test/shell region '\$\{' '\}' '\{' fill red add-highlighter window/regions_test/shell region -recurse '\{' '\$\{' '\}' fill red

View File

@ -1,3 +1,3 @@
add-highlighter window/sh regions add-highlighter window/sh regions
add-highlighter window/sh/code default-region group add-highlighter window/sh/code default-region group
add-highlighter window/sh/heredoc region -match-capture '<<-?(\w+)' '^\t*(\w+)$' '' group add-highlighter window/sh/heredoc region -match-capture '<<-?(\w+)' '^\t*(\w+)$' group