From 051942e243425072cc7cc0f4cd6cf4c10d931c4c Mon Sep 17 00:00:00 2001 From: Max Wash Date: Sun, 1 Dec 2024 13:14:48 +0000 Subject: [PATCH] vim: add missing operators; fix highlighting of tokens after labels --- ivy.vim/syntax/ivy.vim | 29 +++++++++++++++++------------ 1 file changed, 17 insertions(+), 12 deletions(-) diff --git a/ivy.vim/syntax/ivy.vim b/ivy.vim/syntax/ivy.vim index 5ef9330..8b35bd3 100755 --- a/ivy.vim/syntax/ivy.vim +++ b/ivy.vim/syntax/ivy.vim @@ -4,16 +4,22 @@ endif let s:save_cpo = &cpoptions set cpoptions&vim -setlocal iskeyword+=: +"setlocal iskeyword+=: -syn keyword ivyType Object Int Enum Bool Iterator Lambda Selector Package String Exception Tuple syn match ivyType /\<[A-Z]\{1,2\}\([a-z0-9]\+[A-Z]\{0,2\}\)*\>/ -syn keyword ivyStorage class protocol -syn keyword ivyRepeat for while in break continue -syn keyword ivyConditional if elif else unless match -syn match ivySelectorLabel /\<[a-z]\([A-Za-z0-9_]\+\)\:\(\:\)\@!/ -syn match ivySelectorLabel /\<\([a-z]\([A-Za-z0-9_]\+\)\:\(\:\)\@!\)\+/ +" we have to use syn match for keywords because any keyword can be used as a +" label by adding : to the end, and adding : to iskeyword causes more problems +" than it solves. +syn match ivyStorage /\(class\|protocol\)\(\:\)\@!/ +syn match ivyRepeat /\(for\|while\|break\|continue\)\(\:\)\@!/ +syn match ivyConditional /\(if\|elif\|else\|unless\|match\)\(\:\)\@!/ +syn match ivyException /\(try\|catch\|finally\|throw\)\(\:\)\@!/ +syn match ivyBuiltinVar /\(error\|cout\|cin\|cerr\)\(\:\)\@!/ +syn match ivyUnspecifiedStatement /\(end\|package\|use\|as\|then\|do\|get\|set\)\(\:\)\@!/ + +syn match ivySelectorLabel /\<[a-z][A-Za-z0-9_]*\:/ +"syn match ivySelectorLabel /\<\([a-z]\([A-Za-z0-9_]\+\)\:\(\:\)\@!\)\+/ syn match ivyUnnamedVariable /\<_\>/ syn match ivyAtomName /#[a-z][a-z0-9_:/]*\>/ @@ -29,12 +35,9 @@ syn match ivyPropertyName /\($\s*\)\@<=[a-z][A-Za-z0-9_]*/ syn match ivyLineContinuation /\\\n/ " Modifiers -syn keyword ivyException try catch finally throw syn match ivySelfVar /\/ syn match ivyUseStmtIdentifier /\(use \)\@<=\([A-Za-z_][A-Za-z0-9_]*\)\(.\([A-Za-z_][A-Za-z0-9_]*\)\)*\(\n\)\@=\>/ @@ -43,8 +46,10 @@ syn match ivyUseStmtIdentifier /\(use \)\@<=\([A-Za-z_][A-Za-z0-9_]*\)\(.\([A-Za syn match ivyBraces "[{}]" display syn match ivyBrackets "[[\]]" display syn match ivyParens "[()]" display -syn match ivyOpSymbols "+\{1,2}" display -syn match ivyOpSymbols "-\{1,2}" display +syn match ivyOpSymbols "+" display +syn match ivyOpSymbols "-" display +syn match ivyOpSymbols "\*" display +syn match ivyOpSymbols "/" display syn match ivyOpSymbols "=\{1,2}" display syn match ivyOpSymbols ">\{1,2}" display syn match ivyOpSymbols "<\{1,2}" display