230 lines
9.6 KiB
VimL
Executable File
230 lines
9.6 KiB
VimL
Executable File
if exists('b:current_syntax')
|
|
finish
|
|
endif
|
|
|
|
let s:save_cpo = &cpoptions
|
|
set cpoptions&vim
|
|
"setlocal iskeyword+=:
|
|
|
|
syn match ivyType /\<[A-Z]\{1,2\}\([a-z0-9]\+[A-Z]\{0,2\}\)*\>/
|
|
|
|
" 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_:/]*\>/
|
|
|
|
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 ivyUnaryMessageName /\(-\s*\)\@<=[a-z][A-Za-z0-9_]*\(\s*|\)\@=/
|
|
syn match ivyUnaryMessageName /\(+\s*\)\@<=[a-z][A-Za-z0-9_]*\(\s*\n\)\@=/
|
|
syn match ivyUnaryMessageName /\(+\s*\)\@<=[a-z][A-Za-z0-9_]*\(\s*|\)\@=/
|
|
syn match ivyPropertyName /\($\s*\)\@<=[a-z][A-Za-z0-9_]*/
|
|
|
|
syn match ivyLineContinuation /\\\n/
|
|
|
|
" Modifiers
|
|
|
|
syn match ivySelfVar /\<self\([^a-zA-Z0-9_]\)\@=/
|
|
|
|
|
|
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\)\@=\>/
|
|
|
|
" Operators/Punctuation
|
|
syn match ivyBraces "[{}]" display
|
|
syn match ivyBrackets "[[\]]" display
|
|
syn match ivyParens "[()]" 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
|
|
syn match ivyOpSymbols "[!><+\-*/^]=" display
|
|
syn match ivyOtherSymbols "=>" display
|
|
syn match ivyLambdaSymbols "|" display
|
|
syn match ivyLogicSymbols "&&" display
|
|
syn match ivyLogicSymbols "||" display
|
|
syn match ivyPropertySymbol "\$" display
|
|
syn match ivyStatementSeparator "\.\s*" display
|
|
syn match ivyMessageTerminator "\!\s*" display
|
|
syn keyword ivyWordOperator is not understands and or
|
|
|
|
" 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 ivySelfVar @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 ivyWordOperator 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
|
|
hi def link ivyPropertySymbol Statement
|
|
|
|
hi def link ivyStatementSeparator Comment
|
|
hi def link ivyMessageTerminator @punctuation.special
|
|
|
|
hi def link ivyPackageStmtIdentifier @string.special.url
|
|
hi def link ivyUseStmtIdentifier @module
|
|
|
|
|
|
let b:current_syntax = 'ivy'
|
|
|
|
let &cpoptions = s:save_cpo
|
|
unlet s:save_cpo
|
|
|
|
" vim: vts=16,28
|