haskell.kak: Remove some complex lookarounds

This commit is contained in:
Maxime Coste 2017-10-08 12:17:18 +08:00
parent 0fa59e5fd2
commit 870d2d22d7

View File

@ -16,20 +16,19 @@ add-highlighter -group / regions -default code haskell \
macro ^\h*?\K# (?<!\\)\n '' \
pragma \{-# '#-\}' \{- \
comment \{- -\} \{- \
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