Implemented simple Vim syntax highlighting.
h3rald h3rald@h3rald.com
Wed, 04 Feb 2026 14:17:01 +0100
1 files changed,
61 insertions(+),
0 deletions(-)
jump to
A
xyw.vim
@@ -0,0 +1,61 @@
+" Vim syntax file +" Language: xyw Assembly +" Maintainer: Fabio Cevasco +" Latest Revision: 2026-02-04 + +if exists("b:current_syntax") + finish +endif + +" Comments +syntax match xywComment ";.*$" + +" Directives +syntax match xywDirective "\.\(include\|label\|macro\|string\|byte\)\>" + +" Label definitions (name after .label) +syntax match xywLabelDef "\(\.label\s\+\)\@<=[a-zA-Z_][a-zA-Z0-9_.\-]*" + +" Macro definitions (name after .macro) +syntax match xywMacroDef "\(\.macro\s\+\)\@<=[a-zA-Z_][a-zA-Z0-9_.\-]*" + +" Strings +syntax region xywString start=+"+ end=+"+ contains=xywEscape +syntax match xywEscape "\\." contained + +" Numbers +syntax match xywHexNumber "\$[0-9a-fA-F]\+" +syntax match xywBinNumber "%[01]\+" + +" Regular identifiers +syntax match xywIdentifier "\<[a-zA-Z_][a-zA-Z0-9_.\-]*\>" + +" Device identifiers (system.*, terminal.*, file.*, clock.*, beeper.*) +syntax match xywDeviceId "\<\(system\|terminal\|file\|clock\|beeper\)\.[a-zA-Z0-9_.\-]*\>" + +" Instructions - BRK and RTS have no modifiers +syntax match xywInstruction "\<\(BRK\|RTS\)\>" + +" Instructions - OVR and ROT only support w modifier +syntax match xywInstruction "\<\(OVR\|ROT\)w\?\>" + +" Instructions - JMP, JCN, JSR support x or y (not both) and w +syntax match xywInstruction "\<\(JMP\|JCN\|JSR\)\([xy]\?w\?\)\>" + +" Instructions - All other instructions with optional xyw modifiers +syntax match xywInstruction "\<\(PSH\|POP\|CLR\|LDB\|LDW\|STB\|STW\|INC\|DEC\|SHL\|SHR\|ADD\|SUB\|MUL\|DIV\|EQU\|NEQ\|GTH\|LTH\|AND\|IOR\|XOR\|NOT\|SWP\|DUP\)\([xyw]*\)\>" + +" Define highlight groups +highlight default link xywComment Comment +highlight default link xywDirective PreProc +highlight default link xywLabelDef Function +highlight default link xywMacroDef Function +highlight default link xywString String +highlight default link xywEscape SpecialChar +highlight default link xywHexNumber Number +highlight default link xywBinNumber Number +highlight default link xywInstruction Statement +highlight default link xywDeviceId Type +highlight default link xywIdentifier Identifier + +let b:current_syntax = "xyw"