commit 0bdef854f8531747438f7764cf7553ba16e56fb8
parent 63ace8b027a79c39995326ee4f82c931295423ea
Author: Amelia Clarke <me@rsaihe.dev>
Date: Mon, 22 Aug 2022 19:57:50 -0700
syntax: improve use statement
Use statements are now highlighted correctly in all cases, including
when there is leading whitespace or when they take up multiple lines,
including comments inside.
Signed-off-by: Amelia Clarke <me@rsaihe.dev>
Diffstat:
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/syntax/hare.vim b/syntax/hare.vim
@@ -90,7 +90,9 @@ syn match hareType "\v<size>((\_s*//.*\_$)*\_s*\()@!" contains=hareComment
syn match hareSpaceError "\v\s+$" display excludenl
syn match hareSpaceError "\v\zs +\ze\t" display
-syn match harePreProc "^use .*;"
+" Use statement.
+syn region hareUse start="\v^\s*\zsuse>" end=";" contains=hareComment display
+
syn match hareErrorAssertion "\v(^([^/]|//@!)*\)\_s*)@<=!\=@!"
syn match hareQuestionMark "?"
@@ -109,7 +111,6 @@ hi def link hareLabel Label
hi def link hareNull Constant
hi def link hareNumber Number
hi def link hareOperator Operator
-hi def link harePreProc PreProc
hi def link hareQuestionMark Special
hi def link hareRepeat Repeat
hi def link hareRune Character
@@ -119,6 +120,7 @@ hi def link hareStructure Structure
hi def link hareTodo Todo
hi def link hareType Type
hi def link hareTypedef Typedef
+hi def link hareUse PreProc
hi def link hareSpaceError Error
autocmd InsertEnter * hi link hareSpaceError NONE