From c842f8a1ea6b65cc463ef4cec66456e581249bda Mon Sep 17 00:00:00 2001 From: John Tyree Date: Mon, 21 Sep 2015 23:49:25 -0500 Subject: [PATCH] Add Haddock highlighting --- syntax/haskell.vim | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/syntax/haskell.vim b/syntax/haskell.vim index bf674e0..7afd7e7 100644 --- a/syntax/haskell.vim +++ b/syntax/haskell.vim @@ -89,6 +89,22 @@ syn region haskellBlockComment start="{-" end="-}" \ haskellBlockComment, \ haskellTodo, \ @Spell + +" FIXME: haddock block comments should be able to contain hsBlockComments, but +" it doesn't seem to work at the moment. +syn region haskellHaddockLineComment start='{-|' end='-}' contains=hsFIXME,@Spell +syn match hsLineComment "--.*$" contains=hsFIXME,@Spell +" Line-based haddock comments are trickier - they continue until +" the next line that isn't part of the same block of comments. +syn region haskellHaddockLineComment start='-- |' end='^\(\s*--\)\@!' contains=hsFIXME,@Spell +syn region haskellHaddockLineComment start='-- \$\w\+' end='^\(\s*--\)\@!' contains=hsFIXME,@Spell +syn region haskellHaddockLineComment start='-- ^' end='^\(\s*--\)\@!' contains=hsFIXME,@Spell +" Haddock sections for import lists +syn match hsHaddockSection '-- \*.*$' +" Named documentation chunks (also for import lists) +syn match hsHaddockSection '-- \$.*$' + + syn region haskellPragma start="{-#" end="#-}" syn match haskellQuasiQuoted "." containedin=haskellQuasiQuote contained syn region haskellQuasiQuote matchgroup=haskellTH start="\[[_a-z][a-zA-z0-9_']*|" end="|\]" @@ -137,6 +153,8 @@ highlight def link haskellType Include highlight def link haskellLineComment Comment highlight def link haskellBlockComment Comment highlight def link haskellPragma SpecialComment +highlight def link haskellHaddockLineComment SpecialComment +highlight def link haskellHaddockBlockComment SpecialComment highlight def link haskellString String highlight def link haskellChar String highlight def link haskellBacktick Operator