Skip to content

Instantly share code, notes, and snippets.

@porglezomp
Last active Sep 28, 2020
Embed
What would you like to do?
A vim syntax definition for HOVALAAG
" Vim syntax file
" Language: HOVALAAG Assembly
" Maintainer: Cassie Jones
" Latest Revision: 20 September 2020
" See the game at http://silverspaceship.com/hovalaag/
" Get updates at https://gist.github.com/porglezomp/690bb0f75883dc69350174b576ad643f
syntax case ignore
syn match vasmOperator "[+->|&^~]"
syn match Number "-\?\([0-9]\+\|\$[0-9A-F]\+\)"
syn match vasmIdentifier "\<\([ABCDFW]\|IN[12]\|OUT[12]\)\>"
syn match vasmDestination "\<\([ABCDFW]\|IN[12]\|OUT[12]\)\>=\@="
syn match vasmFunction "\<\(ZERO\|NEG\|POS\|DEC\)\>"
syn match vasmOperator "\<DEC\>"
syn match vasmOperator "\<\(JMP[TF]\?\|DECNZ\)\>" skipwhite nextgroup=vasmLabelExpr
syn match vasmLabelExpr "[a-z_][a-z0-9_]*" contained
syn match vasmLabel "^[^[:space:]]\+:\@="
syn match vasmError "^[^[:space:]][^:]*$"
syn match vasmError "D=[^A][^,]*"
syn match vasmError "[AC]=A([^-+&|^>]|$)"
syn match vasmPortError "\(\(IN\|OUT\)1\)\([^;]*\(IN\|OUT\)2\)\@="
syn match vasmPortError "\(\(IN\|OUT\)2\)\([^;]*\(IN\|OUT\)1\)\@="
syn match vasmPortError "\(\(IN\|OUT\)1[^;]*\)\@<=\(\(IN\|OUT\)2\)"
syn match vasmPortError "\(\(IN\|OUT\)2[^;]*\)\@<=\(\(IN\|OUT\)1\)"
syn match vasmNumberError "\([BW]=\)\@<!-\?\([0-9]\+\|\$[0-9A-F]\+\)"
syn match Number "\(>>\)\@<=1"
syn match Number "0"
syn match Comment ";.*$"
hi def link vasmIdentifier Identifier
hi def link vasmDestination Type
hi def link vasmKeyword Keyword
hi def link vasmOperator Operator
hi def link vasmFunction Function
hi def link vasmLabelExpr Special
hi def link vasmLabel Special
hi def link vasmPortError Error
hi def link vasmError Error
hi def link vasmNumberError Error
@superjer
Copy link

superjer commented Sep 28, 2020

Thanks for making this!

Error on [AC]=A seems too strict. You can do C=A+B for example right? I changed it to this:
syn match vasmError "[AC]=A([^-+&|^>]|$)"

@porglezomp
Copy link
Author

porglezomp commented Sep 28, 2020

Thanks, I'll incorporate that change.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment