commit 5c758cdbbabd6e4ba92bced9428cd1fa4212f003
parent 69e1962e98beb1080114d0e404260c1567f6af97
Author: Sebastian <sebastian@sebsite.pw>
Date: Thu, 23 Jun 2022 19:37:03 -0400
Highlight error assertion operator bold red
! is highlighted bold red when it appears immediately after a closing
parentheses that wasn't part of a comment, and is not immediately
followed by an equals sign.
Note that this only works when ! comes after a function call, as it
almost always does. Handling all edge cases where ! is used after a
non-call expression is, if not impossible, extremely impractical without
the use of semantic analysis.
Signed-off-by: Sebastian <sebastian@sebsite.pw>
Diffstat:
1 file changed, 3 insertions(+), 0 deletions(-)
diff --git a/syntax/hare.vim b/syntax/hare.vim
@@ -18,6 +18,7 @@ syn match hareBuiltin "\v<size>((\_s|//.*\n)*\()@="
syn match harePreProc "^use .*;"
syn match harePreProc "@[a-z]*"
syn match hareOperator "\.\.\." "\.\."
+syn match hareErrorAssertion "\v(^([^/]|//@!)*\)\_s*)@<=!\=@!"
syn region hareString start=+\z(["']\)+ end=+\z1+ skip=+\\\\\|\\\z1+
syn region hareString start=+`+ end=+`+
@@ -79,4 +80,6 @@ hi def link hareSpaceError Error
autocmd InsertEnter * hi link hareSpaceError NONE
autocmd InsertLeave * hi link hareSpaceError Error
+hi hareErrorAssertion ctermfg=red cterm=bold guifg=red gui=bold
+
" vim: tabstop=8 shiftwidth=2 expandtab