commit cbfa398e18d1cde71866647b430650acaa1171a2
parent 14d8800cc15fca7aa9819fb1d72b65b3b37c6808
Author: Sebastian <sebastian@sebsite.pw>
Date: Fri, 11 Mar 2022 18:46:37 -0500
Use \v regular expressions for syntax matching
This makes the regular expressions more readable (I'm using the word
"readable" very loosely here) by decreasing the backslash spam. \v is
applied consistently.
Signed-off-by: Sebastian <sebastian@sebsite.pw>
Diffstat:
1 file changed, 9 insertions(+), 9 deletions(-)
diff --git a/syntax/hare.vim b/syntax/hare.vim
@@ -23,20 +23,20 @@ syn region hareString start=+`+ end=+`+
"adapted from c.vim
"integer number, or floating point number without a dot and with "f".
-syn match hareNumbers display transparent "\<\d" contains=hareNumber,hareOctal,hareBinary,hareFloat
-syn match hareNumber display contained "\d\+\(e[-+]\?\d\+\)\?\([ziu]\d*\)\?"
+syn match hareNumbers display transparent "\v<\d" contains=hareNumber,hareOctal,hareBinary,hareFloat
+syn match hareNumber display contained "\v\d+(e[-+]?\d+)?([ziu]\d*)?"
"hex number
-syn match hareNumber display contained "0x\x\+\([ziu]\d*\)\?"
+syn match hareNumber display contained "\v0x\x+([ziu]\d*)?"
"octal number
-syn match hareOctal display contained "0o\o\+\([ziu]\d*\)\?"
+syn match hareOctal display contained "\v0o\o+([ziu]\d*)?"
"binary number
-syn match hareBinary display contained '0b[01]\+\([ziu]\d*\)\?'
-syn match hareFloat display contained "\d\+\(e[-+]\?\d\+\)\?\(f32\|f64\)"
+syn match hareBinary display contained '\v0b[01]+([ziu]\d*)?'
+syn match hareFloat display contained "\v\d+(e[-+]?\d+)?(f32|f64)"
"floating point number, with dot, optional exponent
-syn match hareFloat display contained "\d\+\.\d\+\(e[-+]\?\d\+\)\?\(f32\|f64\)\?"
+syn match hareFloat display contained "\v\d+\.\d+(e[-+]?\d+)?(f32|f64)?"
-syn match hareSpaceError display excludenl "\s\+$"
-syn match hareSpaceError display " \+\t"me=e-1
+syn match hareSpaceError display excludenl "\v\s+$"
+syn match hareSpaceError display "\v +\t"me=e-1
syn keyword hareTodo contained TODO FIXME XXX
syn region hareComment start="//" end="$" contains=hareTodo,@Spell