2017-08-13 18:41:48 +00:00
|
|
|
%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:
|
2017-09-17 01:39:56 +00:00
|
|
|
prototype:
|
|
|
|
- include: comment
|
|
|
|
- include: eol
|
2017-08-13 18:41:48 +00:00
|
|
|
|
2017-09-17 01:39:56 +00:00
|
|
|
main:
|
|
|
|
- meta_include_prototype: false
|
2017-08-13 18:41:48 +00:00
|
|
|
|
|
|
|
- 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
|
|
|
|
|
2017-09-17 19:32:25 +00:00
|
|
|
- match: ^[*;]
|
2017-08-13 18:41:48 +00:00
|
|
|
push:
|
|
|
|
- meta_scope: comment.line
|
|
|
|
- match: \n
|
|
|
|
pop: true
|
|
|
|
|
|
|
|
opcode:
|
|
|
|
- match: '{{ws}}'
|
|
|
|
set: operand
|
2017-09-17 01:39:56 +00:00
|
|
|
- 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
|
2017-08-13 18:41:48 +00:00
|
|
|
- include: mnemonics-65816-alt
|
|
|
|
|
2017-08-15 14:18:46 +00:00
|
|
|
# toolbox macros
|
|
|
|
- match: \b_[A-Za-z0-9]+\b
|
|
|
|
scope: support.function.macro.toolbox
|
|
|
|
|
2017-08-13 18:41:48 +00:00
|
|
|
- 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
|
2017-09-17 19:32:25 +00:00
|
|
|
- include: expect-comment
|
2017-08-13 18:41:48 +00:00
|
|
|
|
|
|
|
|
|
|
|
operand-hex:
|
|
|
|
- match: '[0-9A-Fa-f]{1,2}'
|
|
|
|
scope: constant.numeric.hex
|
2017-09-17 19:32:25 +00:00
|
|
|
set: expect-comment
|
|
|
|
- include: expect-comment
|
|
|
|
|
2017-08-13 18:41:48 +00:00
|
|
|
|
|
|
|
operand-on-off:
|
|
|
|
- match: \b(?i:ON|OFF)\b
|
|
|
|
scope: constant.language
|
2017-09-17 19:32:25 +00:00
|
|
|
set: expect-comment
|
|
|
|
- include: expect-comment
|
2017-08-13 18:41:48 +00:00
|
|
|
|
|
|
|
|
2017-09-17 19:32:25 +00:00
|
|
|
expect-comment:
|
|
|
|
- include: comment
|
|
|
|
- match: \S
|
|
|
|
scope: invalid.illegal.expect.comment
|
|
|
|
|
2017-08-13 18:41:48 +00:00
|
|
|
comment:
|
2017-09-17 19:32:25 +00:00
|
|
|
- match: ;
|
|
|
|
push:
|
|
|
|
- meta_scope: comment.line
|
|
|
|
- match: \n
|
|
|
|
pop: true
|
|
|
|
- include: eol
|
|
|
|
|
|
|
|
eol:
|
|
|
|
- match: '$'
|
2017-08-13 18:41:48 +00:00
|
|
|
pop: true
|
|
|
|
|
|
|
|
|
2017-09-17 19:32:25 +00:00
|
|
|
|
2017-08-13 18:41:48 +00:00
|
|
|
mnemonics-65816-alt:
|
|
|
|
- match: \b(?i:BLT|BGE)\b
|
|
|
|
scope: keyword.mnemonic.65816.alt
|
|
|
|
|
|
|
|
|
|
|
|
numbers:
|
|
|
|
- match: \d+
|
|
|
|
scope: constant.numeric
|
|
|
|
- match: \$[0-9a-fA-F]+
|
|
|
|
scope: constant.numeric.hex
|
|
|
|
- match: \%[01]+
|
|
|
|
scope: constant.numeric.binary
|
|
|
|
|
|
|
|
macro-parm:
|
|
|
|
- match: '&\d'
|
|
|
|
scope: variable.other
|
|
|
|
|
|
|
|
strings:
|
|
|
|
- match: '"'
|
|
|
|
scope: punctuation.definition.string.begin
|
|
|
|
push:
|
2017-09-17 01:39:56 +00:00
|
|
|
- meta_include_prototype: false
|
|
|
|
- meta_scope: string.quoted.double
|
2017-08-13 18:41:48 +00:00
|
|
|
- match: '"'
|
|
|
|
scope: punctuation.definition.string.end
|
|
|
|
pop: true
|
2017-09-17 01:39:56 +00:00
|
|
|
- match: '\n'
|
2017-08-13 18:41:48 +00:00
|
|
|
scope: invalid.illegal.newline.asm
|
|
|
|
pop: true
|