add vim syntax highlighting plugin
This commit is contained in:
201
ivy.vim/syntax/ivy.vim
Executable file
201
ivy.vim/syntax/ivy.vim
Executable file
@@ -0,0 +1,201 @@
|
||||
if exists('b:current_syntax')
|
||||
finish
|
||||
endif
|
||||
|
||||
let s:save_cpo = &cpoptions
|
||||
set cpoptions&vim
|
||||
|
||||
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 ivyUnnamedVariable /\<_\>/
|
||||
|
||||
syn match ivyAtomName /#[a-z][a-z0-9_:]*\>/
|
||||
|
||||
syn match ivyComplexMessageName /\<\zs[A-Za-z][A-Za-z0-9]\+\ze(/
|
||||
"syn match ivyUnaryMessageName /-\s*[a-zA-z][a-zA-Z0-9_]\+\s*\n/
|
||||
syn match ivyUnaryMessageName /\(-\s*\)\@<=[a-z][A-Za-z0-9_]*\(\s*\n\)\@=/
|
||||
syn match ivyPropertyName /\($\s*\)\@<=[a-z][A-Za-z0-9_]*\(\s*\n\)\@=/
|
||||
|
||||
syn match ivyLineContinuation /\\\n/
|
||||
|
||||
" Modifiers
|
||||
syn keyword ivyException try catch finally throw
|
||||
|
||||
syn keyword ivyBuiltinVar self error cout cin cerr
|
||||
|
||||
syn keyword ivyUnspecifiedStatement end package use as then do
|
||||
|
||||
" Operators/Punctuation
|
||||
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 "=\{1,2}" display
|
||||
syn match ivyOpSymbols ">\{1,2}" display
|
||||
syn match ivyOpSymbols "<\{1,2}" display
|
||||
syn match ivyOpSymbols "[!><+\-*/^]=" display
|
||||
syn match ivyOtherSymbols "=>" display
|
||||
syn match ivyLambdaSymbols "|" display
|
||||
syn match ivyLogicSymbols "&&" display
|
||||
syn match ivyLogicSymbols "||" display
|
||||
|
||||
" PROVIDES: @ivyCommentHook
|
||||
syn keyword ivyTodo contained TODO FIXME XXX NOTE HACK TBD
|
||||
syn region ivyBlockComment start="/\*" end="\*/" contains=ivyTodo,ivyBlockComment
|
||||
syn match ivyLineComment "--.*$" contains=ivyTodo,ivyBlockComment
|
||||
syn cluster ivyComment contains=ivyLineComment,ivyBlockComment
|
||||
|
||||
" Since syntax/xml.vim contains `syn spell toplevel`, we need to set it back to `default` here.
|
||||
syn spell default
|
||||
|
||||
" Pre-processing directives
|
||||
syn keyword ivyBoolean false true
|
||||
syn keyword ivyNull null
|
||||
|
||||
" Strings and constants
|
||||
syn match ivySpecialError "\\." contained
|
||||
syn match ivySpecialCharError "[^']" contained
|
||||
" Character literals
|
||||
syn match ivySpecialChar +\\["\\'0abfnrtv]+ contained display
|
||||
syn match ivyUnicodeNumber +\\x\x\{1,4}+ contained contains=ivyUnicodeSpecifier display
|
||||
syn match ivyUnicodeNumber +\\u\x\{4}+ contained contains=ivyUnicodeSpecifier display
|
||||
syn match ivyUnicodeNumber +\\U00\x\{6}+ contained contains=ivyUnicodeSpecifier display
|
||||
syn match ivyUnicodeSpecifier +\\[uUx]+ contained display
|
||||
|
||||
syn region ivyString matchgroup=ivyQuote start=+"+ end=+"\%(u8\)\=+ end=+$+ extend contains=ivySpecialChar,ivySpecialError,ivyUnicodeNumber,@Spell
|
||||
syn match ivyCharacter "'[^']*'" contains=ivySpecialChar,ivySpecialCharError,ivyUnicodeNumber display
|
||||
syn match ivyCharacter "'\\''" contains=ivySpecialChar display
|
||||
syn match ivyCharacter "'[^\\]'" display
|
||||
|
||||
" Numbers
|
||||
syn case ignore
|
||||
syn match ivyInteger "\<0b[01_]*[01]\%([lu]\|lu\|ul\)\=\>" display
|
||||
syn match ivyInteger "\<\d\+\%(_\+\d\+\)*\%([lu]\|lu\|ul\)\=\>" display
|
||||
syn match ivyInteger "\<0x[[:xdigit:]_]*\x\%([lu]\|lu\|ul\)\=\>" display
|
||||
syn match ivyReal "\<\d\+\%(_\+\d\+\)*\.\d\+\%(_\+\d\+\)*\%\(e[-+]\=\d\+\%(_\+\d\+\)*\)\=[fdm]\=" display
|
||||
syn match ivyReal "\.\d\+\%(_\+\d\+\)*\%(e[-+]\=\d\+\%(_\+\d\+\)*\)\=[fdm]\=\>" display
|
||||
syn match ivyReal "\<\d\+\%(_\+\d\+\)*e[-+]\=\d\+\%(_\+\d\+\)*[fdm]\=\>" display
|
||||
syn match ivyReal "\<\d\+\%(_\+\d\+\)*[fdm]\>" display
|
||||
syn case match
|
||||
syn cluster ivyNumber contains=ivyInteger,ivyReal
|
||||
|
||||
syn region ivyInterpolatedString matchgroup=ivyQuote start=+\'+ end=+\'+ extend contains=ivyInterpolation,ivyEscapedInterpolation,ivySpecialChar,ivySpecialError,ivyUnicodeNumber,@Spell
|
||||
|
||||
syn region ivyInterpolation matchgroup=ivyInterpolationDelimiter start=+{+ end=+}+ keepend contained contains=@ivyAll,ivyBraced,ivyBracketed,ivyInterpolationAlign,ivyInterpolationFormat
|
||||
syn match ivyEscapedInterpolation "{{" transparent contains=NONE display
|
||||
syn match ivyEscapedInterpolation "}}" transparent contains=NONE display
|
||||
syn region ivyInterpolationAlign matchgroup=ivyInterpolationAlignDel start=+,+ end=+}+ end=+:+me=e-1 contained contains=@ivyNumber,ivyBoolean,ivyConstant,ivyCharacter,ivyParens,ivyOpSymbols,ivyOtherSymbols,ivyString,ivyBracketed display
|
||||
syn match ivyInterpolationFormat +:[^}]\+}+ contained contains=ivyInterpolationFormatDel display
|
||||
syn match ivyInterpolationAlignDel +,+ contained display
|
||||
syn match ivyInterpolationFormatDel +:+ contained display
|
||||
|
||||
syn region ivyVerbatimString matchgroup=ivyQuote start=+@"+ end=+"\%(u8\)\=+ skip=+""+ extend contains=ivyVerbatimQuote,@Spell
|
||||
syn match ivyVerbatimQuote +""+ contained
|
||||
|
||||
syn region ivyInterVerbString matchgroup=ivyQuote start=+$@"+ start=+@$"+ end=+"\%(u8\)\=+ skip=+""+ extend contains=ivyInterpolation,ivyEscapedInterpolation,ivySpecialChar,ivySpecialError,ivyUnicodeNumber,ivyVerbatimQuote,@Spell
|
||||
|
||||
syn cluster ivyString contains=ivyString,ivyInterpolatedString,ivyVerbatimString,ivyInterVerbString
|
||||
|
||||
syn cluster ivyLiteral contains=ivyBoolean,@ivyNumber,ivyCharacter,@ivyString,ivyNull
|
||||
|
||||
syn region ivyBracketed matchgroup=ivyParens start=+(+ end=+)+ extend contained transparent contains=@ivyAll,ivyBraced,ivyBracketed
|
||||
syn region ivyBraced matchgroup=ivyParens start=+{+ end=+}+ extend contained transparent contains=@ivyAll,ivyBraced,ivyBracketed
|
||||
|
||||
syn cluster ivyAll contains=@ivyLiteral,ivyClassType,@ivyComment,ivyEndColon,ivyIsType,ivySelectorLabel,ivyLogicSymbols,ivyNewType,ivyOpSymbols,ivyOtherSymbols,ivyParens,@ivyPreProcessor,ivySummary,@ivyNamespaceAlias,ivyType,ivyUnicodeNumber,ivyUserType,ivyUserIdentifier,ivyUserInterface,ivyUserMethod,ivyBuiltinVar,ivyLambdaParameter
|
||||
|
||||
" Keyword identifiers
|
||||
syn match ivyIdentifier "@\h\w*"
|
||||
|
||||
" The default highlighting.
|
||||
hi def link ivyUnspecifiedStatement Statement
|
||||
hi def link ivyUnsupportedStatement Statement
|
||||
hi def link ivyUnspecifiedKeyword Keyword
|
||||
|
||||
hi def link ivyGlobalNamespaceAlias Include
|
||||
|
||||
hi def link ivyType Type
|
||||
|
||||
hi def link ivyStorage Keyword
|
||||
hi def link ivyIsAs Keyword
|
||||
hi def link ivyAccessor Keyword
|
||||
hi def link ivyBuiltinVar @variable.builtin
|
||||
|
||||
hi def link ivyStatement Statement
|
||||
hi def link ivyRepeat Repeat
|
||||
hi def link ivyConditional Conditional
|
||||
hi def link ivySelectorLabel Tag
|
||||
hi def link ivyUnnamedLabel @variable.builtin
|
||||
hi def link ivyUnnamedVariable @variable.builtin
|
||||
hi def link ivyLambdaParameter @variable.builtin
|
||||
hi def link ivyException Exception
|
||||
|
||||
hi def link ivyParens Delimiter
|
||||
hi def link ivyBraces Structure
|
||||
hi def link ivyBrackets Define
|
||||
hi def link ivyLambdaSymbols Define
|
||||
|
||||
hi def link ivyModifier StorageClass
|
||||
hi def link ivyAccessModifier ivyModifier
|
||||
hi def link ivyAsyncModifier ivyModifier
|
||||
hi def link ivyCheckedModifier ivyModifier
|
||||
hi def link ivyManagedModifier ivyModifier
|
||||
hi def link ivyUsingModifier ivyModifier
|
||||
|
||||
hi def link ivyTodo Todo
|
||||
hi def link ivyComment Comment
|
||||
hi def link ivyLineComment ivyComment
|
||||
hi def link ivyBlockComment ivyComment
|
||||
hi def link ivyLineContinuation ivyComment
|
||||
|
||||
hi def link ivyKeywordOperator Keyword
|
||||
hi def link ivyAsyncOperator ivyKeywordOperator
|
||||
hi def link ivyTypeOf ivyKeywordOperator
|
||||
hi def link ivyTypeOfOperand Typedef
|
||||
hi def link ivyTypeOfError Error
|
||||
hi def link ivyOpSymbols Operator
|
||||
hi def link ivyOtherSymbols Structure
|
||||
hi def link ivyLogicSymbols Operator
|
||||
|
||||
hi def link ivySpecialError Error
|
||||
hi def link ivySpecialCharError Error
|
||||
hi def link ivyString String
|
||||
hi def link ivyQuote String
|
||||
hi def link ivyInterpolatedString String
|
||||
hi def link ivyVerbatimString String
|
||||
hi def link ivyInterVerbString String
|
||||
hi def link ivyVerbatimQuote SpecialChar
|
||||
|
||||
hi def link ivyConstant Constant
|
||||
hi def link ivyNull Constant
|
||||
hi def link ivyBoolean Boolean
|
||||
hi def link ivyCharacter Character
|
||||
hi def link ivySpecialChar SpecialChar
|
||||
hi def link ivyInteger Number
|
||||
hi def link ivyReal Float
|
||||
hi def link ivyUnicodeNumber SpecialChar
|
||||
hi def link ivyUnicodeSpecifier SpecialChar
|
||||
hi def link ivyInterpolationDelimiter Delimiter
|
||||
hi def link ivyInterpolationAlignDel ivyInterpolationDelimiter
|
||||
hi def link ivyInterpolationFormat ivyInterpolationDelimiter
|
||||
hi def link ivyInterpolationFormatDel ivyInterpolationDelimiter
|
||||
|
||||
hi def link ivyGenericBraces ivyBraces
|
||||
|
||||
hi def link ivyAtomName Constant
|
||||
|
||||
hi def link ivyComplexMessageName Function
|
||||
hi def link ivyUnaryMessageName Function
|
||||
hi def link ivyPropertyName @property
|
||||
|
||||
let b:current_syntax = 'ivy'
|
||||
|
||||
let &cpoptions = s:save_cpo
|
||||
unlet s:save_cpo
|
||||
|
||||
" vim: vts=16,28
|
||||
Reference in New Issue
Block a user