65816.tmbundle/Syntaxes/EDAsm.sublime-syntax

153 lines
3.4 KiB
YAML

%YAML 1.2
---
name: EDAsm
file_extensions: []
scope: source.asm.65816.edasm
variables:
ws: '[ \t]+'
ident: '[A-Za-z][A-Za-z0-9.]*'
contexts:
prototype:
- include: comment
- include: registers
- include: eol
main:
- meta_include_prototype: false
- match: '{{ws}}'
push: opcode
- 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
- match: \b((?i)ASC|STR|DCI|CHR)\b
scope: keyword.directive
set: operand-string
- match: \b((?i)CHN|INCLUDE)\b
scope: keyword.control.import
set: operand-path
- match: \b(?i:MSB)\b
scope: keyword.directive
set: operand-on-off
- match: \b(?i:LST)\b
scope: keyword.directive
set: operand-lst
- match: \b(?i:ASC|CHN|CHR|DATE|DB|DCI|DDB|DEF|DFB|DS|DSECT|DW|ENTRY|EQU|EXTRN|FAIL|FIN|IBUFSIZ|IDNUM|INCLUDE|INTERP|LST|MACLIB|MSB|OBJ|ORG|PAGE|REF|REL|REP|SBTL|SBUFSIZ|SKP|STR|SYS|TIME|ZDEF|ZREF|X6502|PAUSE|INBUFSIZ|SBUFSIZ)\b
scope: keyword.directive
- match: \b(?i:DO|ELSE|FIN|IFEQ|IFGE|IFGT|IFNE|IFLE|IFLT)\b
scope: keyword.control.conditional
operand:
# #'x doesn't need a closing quote.
- match: (#)(')([^'\n])('?)
captures:
2: string.quoted.single punctuation.definition.string.begin
3: string.quoted.single
4: string.quoted.single punctuation.definition.string.end
set: expect-comment
- include: strings
- include: numbers
operand-string:
- include: strings
operand-on-off:
- match: \b(?i:ON|OFF)\b
scope: constant.language
set: expect-comment
- include: expect-comment
operand-lst:
- match: \b(?i:ON|OFF)\b
scope: constant.language
- match: \b(?i:NO)?(?i:CYC|GEN|WARN|UNASM|ASYM|VSYM|SIXUP|EXP)\b
scope: constant.language
- match: ','
- include: expect-comment
operand-path:
- match: ([^; \n\t]+)
scope: string.unquoted
registers:
- match: \b(?i:A|X|Y)\b
scope: variable.language.register
expect-comment:
- include: comment
- match: \S
scope: invalid.illegal
comment:
- match: ;
push:
- meta_scope: comment.line
- match: \n
pop: true
- include: eol
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
- match: \@[0-7]+\b
scope: constant.numeric.octal
strings:
- 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