From dd699cc93351aea197cae701e2afa0799bfb0727 Mon Sep 17 00:00:00 2001 From: Annwan Date: Sun, 31 May 2026 20:46:55 +0200 Subject: [PATCH] tooling: add vim syntax for ain-48 assembly --- .gitignore | 1 + editors/vim/ftdetect/ain48asm.vim | 6 +++++ editors/vim/syntax/ain48asm.vim | 39 +++++++++++++++++++++++++++++++ 3 files changed, 46 insertions(+) create mode 100644 editors/vim/ftdetect/ain48asm.vim create mode 100644 editors/vim/syntax/ain48asm.vim diff --git a/.gitignore b/.gitignore index 3afbbe9..801b2be 100644 --- a/.gitignore +++ b/.gitignore @@ -2,4 +2,5 @@ /build /docs/*.pdf /ain48 +/scratch diff --git a/editors/vim/ftdetect/ain48asm.vim b/editors/vim/ftdetect/ain48asm.vim new file mode 100644 index 0000000..e9a070b --- /dev/null +++ b/editors/vim/ftdetect/ain48asm.vim @@ -0,0 +1,6 @@ +" ftdetect file for AIN-48 assembly + +au BufRead,BufNewFile *.ain48s set filetype=ain48asm +au BufRead,BufNewFile *.ain48asm set filetype=ain48asm +au BufRead,BufNewFile *.a48s set filetype=ain48asm +au BufRead,BufNewFile *.a48asm set filetype=ain48asm diff --git a/editors/vim/syntax/ain48asm.vim b/editors/vim/syntax/ain48asm.vim new file mode 100644 index 0000000..602b76a --- /dev/null +++ b/editors/vim/syntax/ain48asm.vim @@ -0,0 +1,39 @@ +" Vim syntax file +" Language: AIN-48 Assembly +" Maintainer: Annwan +" Latest Revision: 31 May 2026 + +if exists("b:current_syntax") + finish +endif + +syn case ignore +syn keyword ain48Mnemonic add aeq aut cess cst dem dst dvd ei et i ilg imlg iplg irrv ivc lg mpl nam ncivc ncrv nec nei ni nni npi nui padd pdem pdvd pi pilg pimlg piplg pmpl prsd pstr rsd rv sc sim str tsc ui vel + +" Senary constants +syn match ain48Immediate "#[Ss][0-5]\+" +syn match ain48Immediate "#-[Ss][0-5]\+" +" Octal constants +syn match ain48Immediate "#[Oo][0-7]\+" +syn match ain48Immediate "#-[Oo][0-7]\+" +" Decimal constants +syn match ain48Immediate "#[Xx][0-9]\+" +syn match ain48Immediate "#-[Xx][0-9]\+" +" Binary constants +syn match ain48Immediate "#[Bb][01]\+" +syn match ain48Immediate "#-[Bb][01]\+" + +syn match ain48Register "%[0-7a-z]\+" +syn match ain48Directive "\.[a-z0-9_-]\+" + +syn match ain48Comment ";.*$" contains=ain48Todo +syn keyword ain48Todo contained TODO FIXME NOTE + +syn match ain48Label "^[a-zA-Z0-9_-]\+:" + +hi link ain48Mnemonic Statement +hi link ain48Comment Comment +hi link ain48Immediate Constant +hi link ain48Directive PreProc +hi link ain48Label Label +hi link ain48Register Identifier