65816.tmbundle/Syntaxes/Merlin.sublime-syntax

271 lines
5.7 KiB
Plaintext
Raw Normal View History

2017-08-13 23:42:53 +00:00
%YAML 1.2
---
name: Merlin Assembler
file_extensions: [S]
scope: source.asm.65816.merlin
variables:
ws: '[ \t]+'
ident: '[:-~][0-~]*'
contexts:
2017-09-17 02:36:09 +00:00
prototype:
- include: comment
- include: eol
2017-08-13 23:42:53 +00:00
main:
2017-09-17 02:36:09 +00:00
- meta_include_prototype: false
- match: ^[;*]
push:
- meta_scope: comment.line
- match: \n
pop: true
2017-08-13 23:42:53 +00:00
- 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
2017-09-17 02:36:09 +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 23:42:53 +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
- match: ~[A-Za-z0-9]+\b
scope: support.function.macro.toolbox
2017-08-13 23:42:53 +00:00
- match: \b(?i:DFB|DB|DDB|DA|DW|ADR|ADRL|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)\b
scope: keyword.directive
- 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: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
2017-08-15 14:18:46 +00:00
- include: strings
2017-08-21 19:39:06 +00:00
#- include: macro-parm
2017-08-13 23:42:53 +00:00
operand-hex:
- match: '[0-9A-Fa-f]{2}'
scope: constant.numeric.hex
- match: '[^ \t,]'
scope: invalid.illegal.operand
operand-path:
2017-09-17 02:36:09 +00:00
- match: \S+
2017-08-13 23:42:53 +00:00
scope: string.unquoted
2017-09-17 02:36:09 +00:00
set: expect-comment
- include: expect-comment
2017-08-13 23:42:53 +00:00
operand-string:
- include: strings
- match: '[0-9A-Fa-f]{2}'
scope: constant.numeric.hex
- match: '[^ \t,]'
scope: invalid.illegal.operand
operand-off:
- match: \b(?i:OFF)\b
scope: constant.language
2017-09-17 02:36:09 +00:00
set: expect-comment
- include: expect-comment
2017-08-13 23:42:53 +00:00
operand-cas:
# cas se / cas in
- match: \b(?i:SE|IN)\b
scope: constant.language
2017-09-17 02:36:09 +00:00
set: expect-comment
- include: expect-comment
2017-08-13 23:42:53 +00:00
operand-cyc:
# cyc off | ave | flags
- match: \b(?i:OFF|AVE|FLAGS)\b
scope: constant.language
2017-09-17 02:36:09 +00:00
set: expect-comment
- include: expect-comment
2017-08-13 23:42:53 +00:00
operand-exp:
# exp on | off | only
- match: \b(?i:ON|OFF|ONLY)\b
scope: constant.language
2017-09-17 02:36:09 +00:00
set: expect-comment
- include: expect-comment
2017-08-13 23:42:53 +00:00
operand-lst:
# lst | lst ON | OFF | RTN | FILE,path...
- match: \b(?i:ON|OFF|RTN)\b
scope: constant.language
2017-09-17 02:36:09 +00:00
set: expect-comment
2017-08-13 23:42:53 +00:00
- match: \b(?i:FILE){{ws}}*,
scope: constant.language
set: operand-path
2017-09-17 02:36:09 +00:00
- include: expect-comment
2017-08-13 23:42:53 +00:00
operand-tr:
# tr on | off | adr
- match: \b(?i:ON|OFF|ADR)\b
scope: constant.language
2017-09-17 02:36:09 +00:00
set: expect-comment
- include: expect-comment
expect-comment:
- include: comment
2017-08-13 23:42:53 +00:00
- match: \S
2017-09-17 02:36:09 +00:00
scope: invalid.illegal.expect.comment
2017-08-13 23:42:53 +00:00
comment:
2017-09-17 02:36:09 +00:00
- match: ;
push:
- meta_scope: comment.line
- match: \n
pop: true
- include: eol
2017-08-13 23:42:53 +00:00
mnemonics-65816-alt:
- match: \b(?i:TAS|TSA|SWA|TAD|TDA|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
strings:
- match: "'"
scope: punctuation.definition.string.begin
push:
2017-09-17 02:36:09 +00:00
- meta_include_prototype: false
- meta_scope: string.quoted.single
2017-08-13 23:42:53 +00:00
- match: "'"
scope: punctuation.definition.string.end
pop: true
- match: \n
scope: invalid.illegal.newline.asm
pop: true
- match: '"'
scope: punctuation.definition.string.begin
push:
2017-09-17 02:36:09 +00:00
- meta_include_prototype: false
- meta_scope: string.quoted.double
2017-08-13 23:42:53 +00:00
- match: '"'
scope: punctuation.definition.string.end
pop: true
- match: \n
scope: invalid.illegal.newline.asm
pop: true
2017-09-17 02:36:09 +00:00
eol:
- match: '$'
pop: true
2017-08-13 23:42:53 +00:00