diff options
| author | Maxime Coste <mawww@kakoune.org> | 2017-09-30 21:39:57 +0800 |
|---|---|---|
| committer | Maxime Coste <mawww@kakoune.org> | 2017-10-25 10:27:39 +0800 |
| commit | bf6e5daa086d4dbde812e95b00dd951f09f7d398 (patch) | |
| tree | 96c10a686a97c24840d953fc061d17ece57b3e96 /rc/base | |
| parent | 78530b82bea5788e74d425b8d206090e8a497ef8 (diff) | |
Use stricter regex syntax
boost regex tolerates non-escaped special characters, and escaped
non-special characters. Standardize on stricter syntax, where
special characters must be escaped, and non-special characters must
not.
Diffstat (limited to 'rc/base')
| -rw-r--r-- | rc/base/etc.kak | 4 | ||||
| -rw-r--r-- | rc/base/haskell.kak | 2 | ||||
| -rw-r--r-- | rc/base/ini.kak | 2 | ||||
| -rw-r--r-- | rc/base/javascript.kak | 2 | ||||
| -rw-r--r-- | rc/base/lua.kak | 8 | ||||
| -rw-r--r-- | rc/base/ruby.kak | 2 |
6 files changed, 10 insertions, 10 deletions
diff --git a/rc/base/etc.kak b/rc/base/etc.kak index 3efe5587..33acb111 100644 --- a/rc/base/etc.kak +++ b/rc/base/etc.kak @@ -23,7 +23,7 @@ hook -group etc-resolv-conf-highlight global WinSetOption filetype=(?!etc-resolv ## /etc/hosts add-highlighter -group / group etc-hosts add-highlighter -group /etc-hosts regex ^(.+?)[\s\t]+?(.*?)$ 1:type 2:attribute -add-highlighter -group /etc-hosts regex \#.*?$ 0:comment +add-highlighter -group /etc-hosts regex '#.*?$' 0:comment hook -group etc-hosts-highlight global WinSetOption filetype=etc-hosts %{ add-highlighter ref etc-hosts } hook -group etc-hosts-highlight global WinSetOption filetype=(?!etc-hosts).* %{ remove-highlighter etc-hosts } @@ -31,7 +31,7 @@ hook -group etc-hosts-highlight global WinSetOption filetype=(?!etc-hosts).* %{ ## /etc/fstab add-highlighter -group / group etc-fstab add-highlighter -group /etc-fstab regex ^(\S{1,})\s+?(\S{1,})\s+?(\S{1,})\s+?(\S{1,})\s+?(\S{1,})\s+?(\S{1,})(?:\s+)?$ 1:keyword 2:value 3:type 4:string 5:attribute 6:attribute -add-highlighter -group /etc-fstab regex \#.*?$ 0:comment +add-highlighter -group /etc-fstab regex '#.*?$' 0:comment hook -group etc-fstab-highlight global WinSetOption filetype=etc-fstab %{ add-highlighter ref etc-fstab } hook -group etc-fstab-highlight global WinSetOption filetype=(?!etc-fstab).* %{ remove-highlighter etc-fstab } diff --git a/rc/base/haskell.kak b/rc/base/haskell.kak index f3a7abef..6fd781c8 100644 --- a/rc/base/haskell.kak +++ b/rc/base/haskell.kak @@ -14,7 +14,7 @@ hook global BufCreate .*[.](hs) %{ add-highlighter -group / regions -default code haskell \ string '(?<!\'\\)(?<!\')"' (?<!\\)(\\\\)*" '' \ macro ^\h*?\K# (?<!\\)\n '' \ - pragma \{-# \#-\} \{- \ + pragma \{-# '#-\}' \{- \ comment \{- -\} \{- \ comment --(?![!#$%&*+./<>?@\\\^|~=]) $ '' diff --git a/rc/base/ini.kak b/rc/base/ini.kak index 470c0b9d..de28022c 100644 --- a/rc/base/ini.kak +++ b/rc/base/ini.kak @@ -3,7 +3,7 @@ hook global BufCreate .*\.(repo|service|target|socket|ini|cfg) %{ } add-highlighter -group / regions -default code ini \ - comment (^|\h)\K[\#\;] $ '' + comment '(^|\h)\K[#;]' $ '' add-highlighter -group /ini/code regex "^\h*\[[^\]]*\]" 0:title add-highlighter -group /ini/code regex "^\h*([^\[][^=\n]*=)([^\n]*)" 1:variable 2:value diff --git a/rc/base/javascript.kak b/rc/base/javascript.kak index d14dd263..2bcffb4f 100644 --- a/rc/base/javascript.kak +++ b/rc/base/javascript.kak @@ -25,7 +25,7 @@ add-highlighter -group /javascript/single_string fill string add-highlighter -group /javascript/regex fill meta add-highlighter -group /javascript/comment fill comment add-highlighter -group /javascript/literal fill string -add-highlighter -group /javascript/literal regex \${.*?} 0:value +add-highlighter -group /javascript/literal regex \$\{.*?\} 0:value add-highlighter -group /javascript/code regex \$\w* 0:variable add-highlighter -group /javascript/code regex \b(document|false|null|parent|self|this|true|undefined|window)\b 0:value diff --git a/rc/base/lua.kak b/rc/base/lua.kak index f37e7039..9b453dbf 100644 --- a/rc/base/lua.kak +++ b/rc/base/lua.kak @@ -12,10 +12,10 @@ hook global BufCreate .*[.](lua) %{ # ‾‾‾‾‾‾‾‾‾‾‾‾ add-highlighter -group / regions -default code lua \ - string '"' (?<!\\)(\\\\)*" '' \ - string "'" (?<!\\)(\\\\)*' '' \ - comment '--' '$' '' \ - comment '\Q--[[' ']]' '' \ + string '"' (?<!\\)(\\\\)*" '' \ + string "'" (?<!\\)(\\\\)*' '' \ + comment '--' '$' '' \ + comment '--\[\[' '\]\]' '' \ add-highlighter -group /lua/string fill string diff --git a/rc/base/ruby.kak b/rc/base/ruby.kak index 494385a2..0b1f9ff0 100644 --- a/rc/base/ruby.kak +++ b/rc/base/ruby.kak @@ -132,7 +132,7 @@ def -hidden ruby-indent-on-new-line %{ def -hidden ruby-insert-on-new-line %{ eval -no-hooks -draft -itersel %{ # copy _#_ comment prefix and following white spaces - try %{ exec -draft k <a-x> s ^ \h * \K \# \h * <ret> y gh j P } + try %{ exec -draft k <a-x> s '^\h*\K#\h*' <ret> y gh j P } # wisely add end structure eval -save-regs x %{ try %{ exec -draft k <a-x> s ^ \h + <ret> \" x y } catch %{ reg x '' } |
