vim: add missing operators; fix highlighting of tokens after labels

This commit is contained in:
2024-12-01 13:14:48 +00:00
parent 624f183de8
commit 051942e243

View File

@@ -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 /\<self\([^a-zA-Z0-9_]\)\@=/
syn keyword ivyBuiltinVar error cout cin cerr
syn keyword ivyUnspecifiedStatement end package use as then do get set
syn match ivyPackageStmtIdentifier /\(package \)\@<=\([A-Za-z_][A-Za-z0-9_]*\)\(.\([A-Za-z_][A-Za-z0-9_]*\)\)*\(\n\)\@=\>/
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