vim: add syntax highlighting support for intermediate language
This commit is contained in:
93
ivy.vim/syntax/ivy-asm.vim
Executable file
93
ivy.vim/syntax/ivy-asm.vim
Executable file
@@ -0,0 +1,93 @@
|
||||
if exists('b:current_syntax')
|
||||
finish
|
||||
endif
|
||||
|
||||
let s:save_cpo = &cpoptions
|
||||
set cpoptions&vim
|
||||
|
||||
setlocal iskeyword+=@-@
|
||||
setlocal iskeyword+=.
|
||||
syn keyword ivyasmUnspecifiedStatement @end @class @block @import @constpool @selector @ident @atom @package @property @var @msgh @lambda
|
||||
syn keyword ivyasmInstruction
|
||||
\ ldr str ret ret.n
|
||||
\ c.z c.nz c.eq c.ne c.lt c.le c.gt c.ge
|
||||
\ br br.t br.f
|
||||
\ add sub div mul push pop msg
|
||||
syn match ivyasmRegister "x[0-9]"
|
||||
syn match ivyasmRegister "x[1-9][0-9]"
|
||||
syn keyword ivyasmIndexBase self bp sp pool
|
||||
|
||||
syn match ivyasmFieldIndex /#[0-9]\+:\>/
|
||||
syn match ivyasmFieldIndex /#-[0-9]\+:\>/
|
||||
syn match ivyasmFieldIndex /#0x[:xdigit:]\+:\>/
|
||||
syn match ivyasmFieldIndex /#-0x[:xdigit:]\+:\>/
|
||||
|
||||
syn region ivyasmString matchgroup=ivyQuote start=+"+ end=+"\%(u8\)\=+ end=+$+ extend
|
||||
|
||||
syn match ivyasmInteger /#[0-9]\+\>/
|
||||
syn match ivyasmInteger /#-[0-9]\+\>/
|
||||
syn match ivyasmInteger /#0x[:xdigit:]\+\>/
|
||||
syn match ivyasmInteger /#-0x[:xdigit:]\+\>/
|
||||
|
||||
syn keyword ivyasmTodo contained TODO FIXME XXX NOTE HACK TBD
|
||||
syn region ivyasmBlockComment start="/\*" end="\*/" contains=ivyasmTodo,ivyasmBlockComment
|
||||
syn match ivyasmLineComment ";.*$" contains=ivyasmTodo,ivyasmBlockComment
|
||||
syn cluster ivyasmComment contains=ivyasmLineComment,ivyasmBlockComment
|
||||
|
||||
syn match ivyasmPropertyName /\($\s*\)\@<=[a-zA-Z_][A-Za-z0-9_]*/
|
||||
syn match ivyasmFieldName /\(#[0-9]\+:\s\)\@<=[a-zA-Z_][A-Za-z0-9_]*\>/
|
||||
|
||||
syn match ivyasmClassName /\(@msgh (\)\@<=\([A-Za-z_][A-Za-z0-9_]*\)\(.\([A-Za-z_][A-Za-z0-9_]*\)\)*\()\)\@=\>/
|
||||
syn match ivyasmClassName /\(@class (\)\@<=\([A-Za-z_][A-Za-z0-9_]*\)\(.\([A-Za-z_][A-Za-z0-9_]*\)\)*\()\)\@=\>/
|
||||
syn match ivyasmLambdaName /\(@lambda (\)\@<=\([A-Za-z_][A-Za-z0-9_]*\)\()\)\@=\>/
|
||||
|
||||
syn match ivyasmIdent /\(@ident\(\s\)*\[\)\@<=\([A-Za-z_][A-Za-z0-9_]*\)\(\]\)\@=\>/
|
||||
syn match ivyasmAtom /\(@atom\(\s\)*\[\)\@<=\([A-Za-z_][A-Za-z0-9_]*\)\(\]\)\@=\>/
|
||||
|
||||
syn match ivyasmFieldIndex /#-[0-9]\+:\>/
|
||||
syn match ivyasmFieldIndex /#0x[:xdigit:]\+:\>/
|
||||
syn match ivyasmFieldIndex /#-0x[:xdigit:]\+:\>/
|
||||
|
||||
syn match ivyasmSelectorLabel /\<[A-Za-z_]\([A-Za-z0-9_]*\)\:/
|
||||
|
||||
syn match ivyasmBrackets "[[\]]" display
|
||||
syn match ivyasmParens "[()]" display
|
||||
syn match ivyPropertySymbol "\$" display
|
||||
|
||||
" The default highlighting.
|
||||
hi def link ivyasmUnspecifiedStatement Statement
|
||||
hi def link ivyPropertySymbol Statement
|
||||
|
||||
hi def link ivyasmInteger Number
|
||||
hi def link ivyasmFieldIndex Tag
|
||||
|
||||
hi def link ivyasmParens Delimiter
|
||||
hi def link ivyasmBraces Structure
|
||||
|
||||
hi def link ivyasmPropertyName @property
|
||||
hi def link ivyasmFieldName @variable.parameter
|
||||
hi def link ivyasmClassName Type
|
||||
hi def link ivyasmLambdaName @variable.parameter
|
||||
|
||||
hi def link ivyasmInstruction Identifier
|
||||
hi def link ivyasmIndexBase @variable.builtin
|
||||
hi def link ivyasmRegister Constant
|
||||
|
||||
hi def link ivyasmSelectorLabel Label
|
||||
|
||||
hi def link ivyasmString String
|
||||
|
||||
hi def link ivyasmComment Comment
|
||||
hi def link ivyasmLineComment ivyasmComment
|
||||
hi def link ivyasmBlockComment ivyasmComment
|
||||
hi def link ivyasmLineContinuation ivyasmComment
|
||||
|
||||
hi def link ivyasmIdent @variable.builtin
|
||||
hi def link ivyasmAtom Constant
|
||||
|
||||
let b:current_syntax = 'ivy-asm'
|
||||
|
||||
let &cpoptions = s:save_cpo
|
||||
unlet s:save_cpo
|
||||
|
||||
" vim: vts=16,28;ech
|
||||
Reference in New Issue
Block a user