mirror of
https://github.com/ksherlock/65816.tmbundle.git
synced 2024-11-29 11:50:47 +00:00
308 lines
6.5 KiB
YAML
308 lines
6.5 KiB
YAML
%YAML 1.2
|
|
---
|
|
name: Merlin Assembler
|
|
file_extensions: [S]
|
|
scope: source.asm.65816.merlin
|
|
|
|
variables:
|
|
ws: '[ \t]+'
|
|
ident: '[:-~][0-~]*'
|
|
|
|
contexts:
|
|
prototype:
|
|
- include: comment
|
|
- include: eol
|
|
main:
|
|
|
|
- meta_include_prototype: false
|
|
|
|
- match: ^[;*]
|
|
push:
|
|
- meta_scope: comment.line
|
|
- match: \n
|
|
pop: true
|
|
|
|
- match: '{{ws}}'
|
|
push: opcode
|
|
|
|
- match: '^({{ident}}){{ws}}((?i)MAC)\b'
|
|
captures:
|
|
1: entity.name.macro
|
|
2: keyword.directive
|
|
push: operand
|
|
|
|
|
|
- match: '^({{ident}}){{ws}}((?i)ENT)\b'
|
|
captures:
|
|
1: entity.name.function
|
|
2: keyword.directive
|
|
push: operand
|
|
|
|
- match: '^({{ident}}){{ws}}((?i)EQU)\b'
|
|
captures:
|
|
1: entity.name.constant
|
|
2: keyword.directive
|
|
push: operand
|
|
|
|
- match: '^({{ident}}){{ws}}(=)'
|
|
captures:
|
|
1: entity.name.constant
|
|
2: keyword.directive
|
|
push: operand
|
|
|
|
|
|
|
|
- match: '^{{ident}}'
|
|
scope: entity.name.label
|
|
|
|
|
|
opcode:
|
|
- match: '{{ws}}'
|
|
set: operand
|
|
- include: comment
|
|
- 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: \~[A-Za-z0-9]+\b
|
|
scope: support.function.smart-macro.toolbox
|
|
|
|
|
|
- match: \b(?i:DFB|DB|DDB|DA|DW|ADR|ADRL|DL|DS)\b
|
|
scope: keyword.directive.data
|
|
|
|
- match: \b(?i:HEX)\b
|
|
scope: keyword.directive.data
|
|
set: operand-hex
|
|
|
|
- match: \b(?i:ASC|DCI|INV|FLS|REV|STR|STRL|FLO)\b
|
|
scope: keyword.directive.data
|
|
set: operand-string
|
|
|
|
- match: \b(?i:LUP)\b
|
|
scope: keyword.control.conditional
|
|
- match: =|<<<|--\^|>>>
|
|
scope: keyword.directive
|
|
|
|
- match: \b(?i:PMC|ORG|REL|TYP|DUM|DEND|END|CHK|DAT|ERR|EXT|EXD|OBJ|VAR|AST|DAT|PAG|SKP|CHK|ERR|KBD|PAU|SW|USR|MAC|EOM)\b
|
|
scope: keyword.directive
|
|
|
|
# IF MX..
|
|
# IF char=]\d
|
|
- match: \b(?i:IF)\b
|
|
scope: keyword.control.conditional
|
|
set: if-operand
|
|
|
|
- match: \b(?i:DO|ELSE|IF|FIN)\b
|
|
scope: keyword.control.conditional
|
|
|
|
- match: \b(?i:USE|PUT|PUTBIN)\b
|
|
scope: keyword.control.import
|
|
set: operand-path
|
|
|
|
- match: \b(?i:DSK|SAV|LNK)\b
|
|
scope: keyword.control.export
|
|
set: operand-path
|
|
|
|
- match: \b(?i:XC)\b
|
|
scope: keyword.directive
|
|
set: operand-off
|
|
|
|
- match: \b(?i:MX)\b
|
|
scope: keyword.directive
|
|
|
|
- match: \b(?i:CAS)\b
|
|
scope: keyword.directive
|
|
set: operand-cas
|
|
|
|
- match: \b(?i:CYC)\b
|
|
scope: keyword.directive
|
|
set: operand-cyc
|
|
|
|
- match: \b(?i:EXP)\b
|
|
scope: keyword.directive
|
|
set: operand-exp
|
|
|
|
|
|
- match: \b(?i:LST)\b
|
|
scope: keyword.directive
|
|
set: operand-lst
|
|
|
|
- match: \b(?i:LSTDO)\b
|
|
scope: keyword.directive
|
|
set: operand-off
|
|
|
|
- match: \b(?i:TTL)\b
|
|
scope: keyword.directive
|
|
set: operand-string
|
|
|
|
- match: \b(?i:TR)\b
|
|
scope: keyword.directive
|
|
set: operand-tr
|
|
|
|
|
|
|
|
operand:
|
|
- include: numbers
|
|
- include: strings
|
|
- match: ']\d+'
|
|
scope: variable.other
|
|
#- include: macro-parm
|
|
|
|
if-operand:
|
|
|
|
- match: \b(?i:MX)\b
|
|
scope: constant.language
|
|
- match: '(.)[,=](]\d+)'
|
|
captures:
|
|
1: string.unquoted
|
|
2: variable.other
|
|
|
|
- include: numbers
|
|
|
|
|
|
operand-hex:
|
|
- match: '[0-9A-Fa-f]{2}'
|
|
scope: constant.numeric.hex
|
|
- match: ','
|
|
- include: expect-comment
|
|
|
|
|
|
operand-path:
|
|
- match: \S+
|
|
scope: string.unquoted
|
|
set: expect-comment
|
|
- include: expect-comment
|
|
|
|
operand-string:
|
|
- include: strings
|
|
- match: '[0-9A-Fa-f]{2}'
|
|
scope: constant.numeric.hex
|
|
- match: ','
|
|
- match: ']\d+'
|
|
scope: variable.other
|
|
- include: expect-comment
|
|
|
|
|
|
|
|
operand-off:
|
|
- match: \b(?i:OFF)\b
|
|
scope: constant.language
|
|
set: expect-comment
|
|
- include: expect-comment
|
|
|
|
operand-cas:
|
|
# cas se / cas in
|
|
- match: \b(?i:SE|IN)\b
|
|
scope: constant.language
|
|
set: expect-comment
|
|
- include: expect-comment
|
|
|
|
operand-cyc:
|
|
# cyc off | ave | flags
|
|
- match: \b(?i:OFF|AVE|FLAGS)\b
|
|
scope: constant.language
|
|
set: expect-comment
|
|
- include: expect-comment
|
|
|
|
|
|
operand-exp:
|
|
# exp on | off | only
|
|
- match: \b(?i:ON|OFF|ONLY)\b
|
|
scope: constant.language
|
|
set: expect-comment
|
|
- include: expect-comment
|
|
|
|
operand-lst:
|
|
# lst | lst ON | OFF | RTN | FILE,path...
|
|
- match: \b(?i:ON|OFF|RTN)\b
|
|
scope: constant.language
|
|
set: expect-comment
|
|
|
|
- match: \b(?i:FILE){{ws}}*,
|
|
scope: constant.language
|
|
set: operand-path
|
|
|
|
- include: expect-comment
|
|
|
|
|
|
operand-tr:
|
|
# tr on | off | adr
|
|
- match: \b(?i:ON|OFF|ADR)\b
|
|
scope: constant.language
|
|
set: expect-comment
|
|
- include: expect-comment
|
|
|
|
expect-comment:
|
|
- include: comment
|
|
- match: \S
|
|
scope: invalid.illegal.expect.comment
|
|
|
|
comment:
|
|
- match: (?<=[\t ]);
|
|
push:
|
|
- meta_scope: comment.line
|
|
- match: \n
|
|
pop: true
|
|
- include: eol
|
|
|
|
|
|
mnemonics-65816-alt:
|
|
- match: \b(?i:TAS|TSA|SWA|TAD|TDA|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
|
|
|
|
strings:
|
|
# special case for ''' and """
|
|
- match: "(')'(')"
|
|
captures:
|
|
0: string.quoted.single
|
|
1: punctuation.definition.string.begin
|
|
2: punctuation.definition.string.end
|
|
|
|
- match: '(")"(")'
|
|
captures:
|
|
0: string.quoted.double
|
|
1: punctuation.definition.string.begin
|
|
2: punctuation.definition.string.end
|
|
|
|
- match: "'"
|
|
scope: punctuation.definition.string.begin
|
|
push:
|
|
- meta_include_prototype: false
|
|
- meta_scope: string.quoted.single
|
|
- match: "'"
|
|
scope: punctuation.definition.string.end
|
|
pop: true
|
|
- match: \n
|
|
scope: invalid.illegal.newline.asm
|
|
pop: true
|
|
- 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
|
|
|
|
eol:
|
|
- match: '$'
|
|
pop: true
|
|
|