diff options
| author | Maxime Coste <mawww@kakoune.org> | 2017-10-08 12:17:18 +0800 |
|---|---|---|
| committer | Maxime Coste <mawww@kakoune.org> | 2017-10-25 10:28:59 +0800 |
| commit | 870d2d22d7aa5f2edbf9efb2e73157e08566d789 (patch) | |
| tree | 2cacfa4a8381287ed84fb78a45b54945c0561847 | |
| parent | 0fa59e5fd283dc89ad9c6ceb8c3e0b0974d8b1d0 (diff) | |
haskell.kak: Remove some complex lookarounds
| -rw-r--r-- | rc/base/haskell.kak | 27 |
1 files changed, 13 insertions, 14 deletions
diff --git a/rc/base/haskell.kak b/rc/base/haskell.kak index 4106b895..bccf6eaf 100644 --- a/rc/base/haskell.kak +++ b/rc/base/haskell.kak @@ -12,24 +12,23 @@ hook global BufCreate .*[.](hs) %{ # ‾‾‾‾‾‾‾‾‾‾‾‾ add-highlighter -group / regions -default code haskell \ - string '(?<!\'\\)(?<!\')"' (?<!\\)(\\\\)*" '' \ - macro ^\h*?\K# (?<!\\)\n '' \ - pragma \{-# '#-\}' \{- \ - comment \{- -\} \{- \ - comment --(?![!#$%&*+./<>?@\\\^|~=]) $ '' + string '(?<!\'\\)(?<!\')"' (?<!\\)(\\\\)*" '' \ + macro ^\h*?\K# (?<!\\)\n '' \ + pragma \{-# '#-\}' \{- \ + comment \{- -\} \{- \ + comment --(?:[^!#$%&*+./<>?@\\\^|~=]|$) $ '' add-highlighter -group /haskell/string fill string add-highlighter -group /haskell/comment fill comment add-highlighter -group /haskell/pragma fill meta add-highlighter -group /haskell/macro fill meta -# Use (?<!['\w]) and (?!['\w]) instead of \b because ' is valid in identifiers -add-highlighter -group /haskell/code regex (?<!['\w])0x+[A-Fa-f0-9]+ 0:value -add-highlighter -group /haskell/code regex (?<!['\w])\d+([.]\d+)? 0:value -add-highlighter -group /haskell/code regex (?<!['\w])(import|hiding|qualified|module)(?!['\w]) 0:keyword -add-highlighter -group /haskell/code regex (?<!['\w])(import)(?!['\w])[^\n]+(?<!['\w])(as)(?!['\w]) 2:keyword -add-highlighter -group /haskell/code regex (?<!['\w])(class|data|default|deriving|infix|infixl|infixr|instance|module|newtype|pattern|type|where)(?!['\w]) 0:keyword -add-highlighter -group /haskell/code regex (?<!['\w])(case|do|else|if|in|let|mdo|of|proc|rec|then)(?!['\w]) 0:attribute +add-highlighter -group /haskell/code regex (?<!')\b0x+[A-Fa-f0-9]+ 0:value +add-highlighter -group /haskell/code regex (?<!')\b\d+([.]\d+)? 0:value +add-highlighter -group /haskell/code regex (?<!')\b(import|hiding|qualified|module)(?!')\b 0:keyword +add-highlighter -group /haskell/code regex (?<!')\b(import)(?!')\b[^\n]+(?<!')\b(as)(?!')\b 2:keyword +add-highlighter -group /haskell/code regex (?<!')\b(class|data|default|deriving|infix|infixl|infixr|instance|module|newtype|pattern|type|where)(?!')\b 0:keyword +add-highlighter -group /haskell/code regex (?<!')\b(case|do|else|if|in|let|mdo|of|proc|rec|then)(?!')\b 0:attribute # The complications below is because period has many uses: # As function composition operator (possibly without spaces) like "." and "f.g" @@ -40,7 +39,7 @@ add-highlighter -group /haskell/code regex (?<!['\w])(case|do|else|if|in|let|mdo # matches uppercase identifiers: Monad Control.Monad # not non-space separated dot: Just.const -add-highlighter -group /haskell/code regex \b([A-Z]['\w]*\.)*[A-Z]['\w]*(?!['\w])(?![.\l]) 0:variable +add-highlighter -group /haskell/code regex \b([A-Z]['\w]*\.)*[A-Z]['\w]*(?!\.) 0:variable # matches infix identifier: `mod` `Apa._T'M` add-highlighter -group /haskell/code regex `\b([A-Z]['\w]*\.)*[\w]['\w]*` 0:operator @@ -65,7 +64,7 @@ add-highlighter -group /haskell/code regex \b(forall)\b[^.\n]*?(\.) 1:keyword 2: # matches 'x' '\\' '\'' '\n' '\0' # not incomplete literals: '\' # not valid identifiers: w' _' -add-highlighter -group /haskell/code regex (?<!\w)'([^\\]|[\\]['"\w\d\\])' 0:string +add-highlighter -group /haskell/code regex \B'([^\\]|[\\]['"\w\d\\])' 0:string # this has to come after operators so '-' etc is correct # Commands |
