vim: add support for new extensible syntax

This commit is contained in:
2025-11-16 20:09:20 +00:00
parent 612a6feac2
commit 9b2dc1d49c

View File

@@ -4,37 +4,45 @@ endif
let s:save_cpo = &cpoptions let s:save_cpo = &cpoptions
set cpoptions&vim set cpoptions&vim
setlocal iskeyword+=-
syn keyword mieUnspecifiedStatement record data define type global syn keyword mieUnspecifiedKeyword to step iter-args
syn keyword mieInstruction
\ alloca load store call br cmp
\ add sub div mul msg
\ getelementptr switch ret
syn keyword mieInstructionFlag syn keyword mieInstructionFlag
\ eq gt ge lt le \ eq gt ge lt le
syn match mieRegister "%[0-9]\>" syn match mieRegister "%[0-9]\>"
syn match mieRegister "%[1-9][0-9]\+\>" syn match mieRegister "%[1-9][0-9]\+\>"
syn match mieRegister "%[A-Za-z\.][A-Za-z0-9\.]*\>" syn match mieRegister "%[A-Za-z_\-\.][A-Za-z0-9_\-\.]*\>"
syn match mieIdentifier /@\(\w\+\)\(\.\(\w\+\)\)*\>/ syn match mieIdentifier /@\(\w\+\)\(\.\(\w\+\)\)*\>/
syn match mieIdentifier /@\.\(\w\+\)\(\.\(\w\+\)\)*\>/ syn match mieIdentifier /@\.\(\w\+\)\(\.\(\w\+\)\)*\>/
syn match mieLabel /\(\w\+\)\(\.\(\w\+\)\)*\:/ syn match mieBlockIdentifier /\^\(\w\+\)\(\.\(\w\+\)\)*/
syn keyword mieType id ptr str atom label void syn match mieBlockLabel /\^\(\w\+\)\(\.\(\w\+\)\)*\:/
syn keyword mieTypeModifier external syn keyword mieBuiltinType void index
syn match mieType "i[0-9]\>" syn keyword mieBuiltinType f16 f32 f64 f80 f128
syn match mieType "i[1-9][0-9]\+\>" " Use syn match for type names that are ALSO dialect names, to ensure that
syn keyword mieBlockType lambda instance static class " dialect operations are still matched as such.
syn match mieBuiltinType /\<memref\>/
syn match mieBuiltinType "i[0-9]\>"
syn match mieBuiltinType "i[1-9][0-9]\+\>"
syn match mieDialectType /#[A-Za-z][A-Za-z0-9\-]*\(\.[A-Za-z][A-Za-z0-9\-]*\)\+/
syn match mieFieldIndex /#[0-9]\+:\>/ syn match mieCustomOperation /\<[A-Za-z][A-Za-z0-9\-]*\(\.[A-Za-z][A-Za-z0-9\-]*\)\+\>/
syn match mieFieldIndex /#-[0-9]\+:\>/ syn match mieGenericOperation /\*[A-Za-z][A-Za-z0-9\-]*\(\.[A-Za-z][A-Za-z0-9\-]*\)\+\([>\*]\)\@!\>/
syn match mieFieldIndex /#0x[:xdigit:]\+:\>/
syn match mieFieldIndex /#-0x[:xdigit:]\+:\>/ syn match mieAttributeName /\<[A-Za-z][A-Za-z0-9\-_\.]*\(\s*=\)\@=\>/
syn region mieString start=+"+ end=+"\%(u8\)\=+ end=+$+ extend syn region mieString start=+"+ end=+"\%(u8\)\=+ end=+$+ extend
syn match mieInteger /#[0-9]\+\>/ syn match mieFloat /[0-9]\+\.[0-9]\+/
syn match mieInteger /#-[0-9]\+\>/ syn match mieFloat /-[0-9]\+\.[0-9]\+/
syn match mieInteger /#0x[:xdigit:]\+\>/ syn match mieFloat /+[0-9]\+\.[0-9]\+/
syn match mieInteger /#-0x[:xdigit:]\+\>/
syn match mieInteger /[0-9]\+\(\.\)\@!\>/
syn match mieInteger /-[0-9]\+\(\.\)\@!\>/
syn match mieInteger /0x[:xdigit:]\+\>/
syn match mieInteger /-0x[:xdigit:]\+\>/
syn match mieIntegerDimension /[0-9]\+x/
syn match mieIntegerDimension /0x[:xdigit:]\+x/
syn keyword mieTodo contained TODO FIXME XXX NOTE HACK TBD syn keyword mieTodo contained TODO FIXME XXX NOTE HACK TBD
syn region mieBlockComment start="/\*" end="\*/" contains=mieTodo,mieBlockComment syn region mieBlockComment start="/\*" end="\*/" contains=mieTodo,mieBlockComment
@@ -43,33 +51,39 @@ syn cluster mieComment contains=mieLineComment,mieBlockComment
syn match mieBrackets "[[\]]" display syn match mieBrackets "[[\]]" display
syn match mieParens "[()]" display syn match mieParens "[()]" display
syn match mieBraces "[{}]" display
syn match mieAngleBrackets "[<>]" display
syn match mieOperator "[=:]" display
syn match mieOperator "->" display
syn match ivyPropertySymbol "\$" display syn match ivyPropertySymbol "\$" display
" The default highlighting. " The default highlighting.
hi def link mieUnspecifiedStatement Statement hi def link mieUnspecifiedKeyword Keyword
hi def link ivyPropertySymbol Statement hi def link ivyPropertySymbol Statement
hi def link mieInteger Number hi def link mieInteger Number
hi def link mieFloat Number
hi def link mieParens Delimiter hi def link mieParens Delimiter
hi def link mieBraces Structure hi def link mieBraces Structure
hi def link mieBrackets Delimiter
hi def link mieAngleBrackets StorageClass
hi def link miePropertyName @property hi def link mieDialectType Type
hi def link mieFieldName @variable.parameter
hi def link mieClassName Type
hi def link mieLambdaName @variable.parameter
hi def link mieInstruction Function hi def link mieGenericOperation @function.builtin
hi def link mieCustomOperation Function
hi def link mieInstructionFlag StorageClass hi def link mieInstructionFlag StorageClass
hi def link mieIdentifier Identifier hi def link mieIdentifier Identifier
hi def link mieLabel Tag hi def link mieBlockIdentifier Label
hi def link mieIndexBase @variable.builtin hi def link mieBlockLabel Label
hi def link mieRegister Constant hi def link mieRegister @variable
hi def link mieString String hi def link mieString String
hi def link mieType Type hi def link mieBuiltinType @type.builtin
hi def link mieBlockType @attribute hi def link mieBlockType @attribute
hi def link mieTypeModifier @attribute hi def link mieTypeModifier @attribute
hi def link mieAttributeName @property
hi def link mieComment Comment hi def link mieComment Comment
hi def link mieLineComment mieComment hi def link mieLineComment mieComment