haskell-vim
haskell-vim copied to clipboard
Fixed broken character literal highlighting (#132)
(See #132)
When a character literal contains a "region" start pattern ('(','[','{','"'), everything after the start pattern is interpreted as a contained region, and consequently breaks syntax highlighting. After further investigation, the regex used to match character literal is actually incorrect according to the Haskell 2010 language specification (https://www.haskell.org/onlinereport/haskell2010/haskellch2.html#x7-200002.6), which means most valid character literals aren't highlighted at all, and the \u<code> pattern while not being a legal character in Haskell, is correctly highlighted.
This commit tries to remedy the above issues.
Like I explained in #132, this is the current state of affairs:

This is what this commit does instead, the escaped characters are highlighted as SpecialChar:

Your changes break the highlighting of ' in the middle and end of the word, so that now foldl' starts a char region:

And also it breaks 'this and ''This
Sorry for the late response, I got caught up with my works lately so I haven't been (and won't be, for the time being) able to look into this :(
I just tried to port how other languages' syntax plugin do char regions to Haskell, but I did overlook identifiers in Haskell can have ' in them, and I didn't find any obvious way to address that, and of course real life caught up. If you could try to find a solution for the time being, that would be much appreciated!
Absolutely no problems. It's not even my repo..
You can check the issue thread where I posted my findings on the matter. Meanwhile I've been using this sequence: \k\@123<! in front of every '. This is not ideal as it misses some corner cases with multiple quotes, so my reasearch continues.