From 9323c83b316d0ee52fe66c764fc0b037ffbfed10 Mon Sep 17 00:00:00 2001 From: Max Wash Date: Tue, 5 Nov 2024 22:16:50 +0000 Subject: [PATCH] vim: add support for ivy assembly language --- ivy.vim/autoload/ivyasm.vim | 0 ivy.vim/ftdetect/ivy.vim | 1 + ivy.vim/ftdetect/ivyasm.vim | 0 ivy.vim/ftplugin/ivyasm.vim | 4 ++ ivy.vim/syntax/ivyasm.vim | 74 +++++++++++++++++++++++++++++++++++++ 5 files changed, 79 insertions(+) create mode 100755 ivy.vim/autoload/ivyasm.vim create mode 100755 ivy.vim/ftdetect/ivyasm.vim create mode 100755 ivy.vim/ftplugin/ivyasm.vim create mode 100755 ivy.vim/syntax/ivyasm.vim diff --git a/ivy.vim/autoload/ivyasm.vim b/ivy.vim/autoload/ivyasm.vim new file mode 100755 index 0000000..e69de29 diff --git a/ivy.vim/ftdetect/ivy.vim b/ivy.vim/ftdetect/ivy.vim index 0ff0b6e..f62302b 100755 --- a/ivy.vim/ftdetect/ivy.vim +++ b/ivy.vim/ftdetect/ivy.vim @@ -1 +1,2 @@ autocmd BufNewFile,BufRead *.im setfiletype ivy +autocmd BufNewFile,BufRead *.iasm setfiletype ivyasm diff --git a/ivy.vim/ftdetect/ivyasm.vim b/ivy.vim/ftdetect/ivyasm.vim new file mode 100755 index 0000000..e69de29 diff --git a/ivy.vim/ftplugin/ivyasm.vim b/ivy.vim/ftplugin/ivyasm.vim new file mode 100755 index 0000000..25eeecd --- /dev/null +++ b/ivy.vim/ftplugin/ivyasm.vim @@ -0,0 +1,4 @@ +setlocal tabstop=8 +setlocal softtabstop=8 +setlocal shiftwidth=8 +setlocal noexpandtab diff --git a/ivy.vim/syntax/ivyasm.vim b/ivy.vim/syntax/ivyasm.vim new file mode 100755 index 0000000..0ba68af --- /dev/null +++ b/ivy.vim/syntax/ivyasm.vim @@ -0,0 +1,74 @@ +if exists('b:current_syntax') + finish +endif + +let s:save_cpo = &cpoptions +set cpoptions&vim + +setlocal iskeyword+=@-@ +setlocal iskeyword+=. +syn keyword ivyasmUnspecifiedStatement @end @lambda @class @msgh @use @constpool @selector @ident +syn keyword ivyasmInstruction ldr str ret ret.n +syn match ivyasmRegister "x[0-9]" +syn match ivyasmRegister "x[1-9][0-9]" +syn keyword ivyasmIndexBase self bp sp + +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 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 ivyasmFieldIndex /#-[0-9]\+:\>/ +syn match ivyasmFieldIndex /#0x[:xdigit:]\+:\>/ +syn match ivyasmFieldIndex /#-0x[:xdigit:]\+:\>/ + +syn match ivyasmSelectorLabel /\<[a-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 + + +let b:current_syntax = 'ivyasm' + +let &cpoptions = s:save_cpo +unlet s:save_cpo + +" vim: vts=16,28;ech