mirror of
https://github.com/ksherlock/65816.tmbundle.git
synced 2024-12-22 10:30:19 +00:00
148 lines
3.0 KiB
YAML
148 lines
3.0 KiB
YAML
%YAML 1.2
|
|
---
|
|
name: NinjaForce Assembler
|
|
file_extensions: [s]
|
|
scope: source.asm.65816.ninjaforce
|
|
|
|
variables:
|
|
ws: '[ \t]+'
|
|
ident: '[A-Za-z_][A-Za-z0-9_]*'
|
|
|
|
contexts:
|
|
prototype:
|
|
- include: comment
|
|
- include: eol
|
|
|
|
main:
|
|
- meta_include_prototype: false
|
|
|
|
- match: '{{ws}}'
|
|
push: opcode
|
|
|
|
- match: '^({{ident}}){{ws}}((?i)MAC)\b'
|
|
captures:
|
|
1: entity.name.macro
|
|
2: keyword.directive
|
|
push: operand
|
|
|
|
- match: '^]?{{ident}}'
|
|
scope: entity.name.label
|
|
|
|
- match: ^[*;]
|
|
push:
|
|
- meta_scope: comment.line
|
|
- match: \n
|
|
pop: true
|
|
|
|
opcode:
|
|
- match: '{{ws}}'
|
|
set: operand
|
|
- include: scope:source.asm.65816#mnemonics-6502
|
|
- include: scope:source.asm.65816#mnemonics-65c02
|
|
- include: scope:source.asm.65816#mnemonics-65816
|
|
- include: scope:source.asm.65816#mnemonics-65816-long
|
|
- include: mnemonics-65816-alt
|
|
|
|
# toolbox macros
|
|
- match: \b_[A-Za-z0-9]+\b
|
|
scope: support.function.macro.toolbox
|
|
|
|
- match: \b(?i:IMP|INS)\b
|
|
scope: keyword.control.import
|
|
set: operand-string
|
|
- match: \b(?i:ORG|EQU|COD|TYP|LNK|SHT|LNG|M08|M16|X08|X16|LST|LOP)\b
|
|
scope: keyword.directive
|
|
- match: =
|
|
scope: keyword.directive
|
|
- match: \b(?i:ASC|STR)\b
|
|
scope: keyword.directive.data
|
|
set: operand-string
|
|
- match: \b(?i:DLW|DW|DFB)\b
|
|
scope: keyword.directive.data
|
|
|
|
- match: \b(?i:HEX)\b
|
|
scope: keyword.directive.data
|
|
set: operand-hex
|
|
|
|
- match: \b(?i:MSB)\b
|
|
scope: keyword.directive
|
|
set: operand-on-off
|
|
|
|
- match: \^\^\^|<<<
|
|
scope: keyword.directive
|
|
|
|
|
|
|
|
operand:
|
|
- include: numbers
|
|
- include: strings
|
|
- include: macro-parm
|
|
|
|
operand-string:
|
|
- include: strings
|
|
- include: expect-comment
|
|
|
|
|
|
operand-hex:
|
|
- match: '[0-9A-Fa-f]{1,2}'
|
|
scope: constant.numeric.hex
|
|
set: expect-comment
|
|
- include: expect-comment
|
|
|
|
|
|
operand-on-off:
|
|
- match: \b(?i:ON|OFF)\b
|
|
scope: constant.language
|
|
set: expect-comment
|
|
- include: expect-comment
|
|
|
|
|
|
expect-comment:
|
|
- include: comment
|
|
- match: \S
|
|
scope: invalid.illegal.expect.comment
|
|
|
|
comment:
|
|
- match: ;
|
|
push:
|
|
- meta_scope: comment.line
|
|
- match: \n
|
|
pop: true
|
|
- include: eol
|
|
|
|
eol:
|
|
- match: '$'
|
|
pop: true
|
|
|
|
|
|
|
|
mnemonics-65816-alt:
|
|
- match: \b(?i:BLT|BGE)\b
|
|
scope: keyword.mnemonic.65816.alt
|
|
|
|
|
|
numbers:
|
|
- match: \b\d+\b
|
|
scope: constant.numeric
|
|
- match: \$[0-9a-fA-F]+\b
|
|
scope: constant.numeric.hex
|
|
- match: \%[01]+\b
|
|
scope: constant.numeric.binary
|
|
|
|
macro-parm:
|
|
- match: '&\d\b'
|
|
scope: variable.other
|
|
|
|
strings:
|
|
- match: '"'
|
|
scope: punctuation.definition.string.begin
|
|
push:
|
|
- meta_include_prototype: false
|
|
- meta_scope: string.quoted.double
|
|
- match: '"'
|
|
scope: punctuation.definition.string.end
|
|
pop: true
|
|
- match: '\n'
|
|
scope: invalid.illegal.newline.asm
|
|
pop: true
|