mirror of
https://github.com/ksherlock/65816.tmbundle.git
synced 2024-11-22 11:34:35 +00:00
247 lines
5.9 KiB
YAML
247 lines
5.9 KiB
YAML
%YAML 1.2
|
|
---
|
|
name: WDC Assembler
|
|
scope: source.asm.65816.wdc
|
|
|
|
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)SECTION)\b'
|
|
captures:
|
|
1: entity.name.function
|
|
2: keyword.directive
|
|
push: operand
|
|
|
|
- match: '^({{ident}}){{ws}}((?i)MACRO)\b'
|
|
captures:
|
|
1: entity.name.function
|
|
2: keyword.directive
|
|
push: operand-macro
|
|
|
|
|
|
|
|
- match: '^{{ident}}'
|
|
scope: entity.name.label
|
|
|
|
- include: comment
|
|
|
|
|
|
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-65c02s
|
|
- include: scope:source.asm.65816#mnemonics-65816
|
|
- include: mnemonics-65816-alt
|
|
|
|
- match: \b(?i:EXTERNS|GLOBALS|INCDEBUG|CASE|CHKIMMED|LONGA|LONGI|SPACES|BIT7|SQUOTES|TWOCHAR|ARGCHK|MACFIRST|INCLIST|CONDLIST|MACLIST|PASS1)\b
|
|
scope: keyword.directive
|
|
set: operand-on-off
|
|
|
|
- match: \b(?i:PL|PW|TOP|HEADING|NAM|TITLE|TTL|STTL|SUBTITLE|SUBTTL|EJECT|PAG|PAGE|LIST|(N|NO|INC|ASC|COND|MAC|M|MN)LIST|PASS1)\b
|
|
scope: keyword.directive.listing
|
|
|
|
- match: \b(?i:MODULE)\b
|
|
scope: keyword.directive
|
|
set: operand-module
|
|
|
|
- match: \b(?i:CHIP)\b
|
|
scope: keyword.directive
|
|
set: operand-chip
|
|
|
|
- match: \b(?i:MESSAGE|EXIT|HEADING|NAM|TITLE|TTL|STTL|SUBTITLE|SUBTTL)\b
|
|
scope: keyword.directive
|
|
set: operand-title
|
|
|
|
- match: \b(?i:APPEND|INCLUDE|INSERT)\b
|
|
scope: keyword.control.import
|
|
set: operand-import
|
|
|
|
- match: \b(?i:ASCII|ASC)\b
|
|
scope: keyword.directive
|
|
set: operand-ascii
|
|
|
|
- match: \b(?i:FCC)\b
|
|
scope: keyword.directive
|
|
set: operand-fcc
|
|
|
|
- match: \b(?i:COMMENT)\b
|
|
scope: keyword.directive
|
|
set: operand-comment
|
|
|
|
- match: \b(?i:APPEND|INCLUDE|INSERT|END|EXIT|MODULE|ENDMOD|SECTION|PAGE0|CODE|KDATA|DATA|UDATA|ENDS|ORG|ORIGIN|EQU|EQUAL|GEQU|DEFL|SET|VAR|EXTERN|EXTERNAL|XREF|EXTERNS|GLOBAL|PUBLIC|XDEF|GLOBALS|MESSAGE|MESSG|EFUNC|INCDEBUG)\b
|
|
scope: keyword.directive
|
|
set: operand
|
|
|
|
- match: \b(?i:CASE|CHIP|CHKIMMED|COMMENT|DBREG|DPAGE|LONGA|LONGI|RADIX|SPACES)\b
|
|
scope: keyword.directive
|
|
set: operand
|
|
|
|
- match: \b(?i:BIT7|MASK|SQUOTE|TWOCHAR|ASCII|ASC|FCC|DATE|DA|BYTE|DB|DEFB|FCB|STRING|DC|DEFW|DW|FDB|WORD|DBYTE|DL|LONG|LONGW|LWORD|BLKB|BLKW|BLKL|DEFS|DS|RMB|DSA|DSB|DSL|DSW|APWDC|FLOAT|DOUBLE)\b
|
|
scope: keyword.directive
|
|
set: operand
|
|
|
|
- match: \b(?i:MACRO|END|MACEND|ARGCHK|MACFIRST|MACDELIM|MACEXIT|IFMA|IFNMA|REPT|ENDR)\b
|
|
scope: keyword.directive
|
|
set: operand
|
|
|
|
- match: \b(?i:ENDC|ENDIF|COND|IF|IFN?(FALSE|TRUE|Z|ABS|REL|DEF|DIFF|SAME|EXT|PAGE0)|ELSE|IF(LONG|SHORT)[AI]|IFMATCH)\b
|
|
scope: keyword.control.conditional
|
|
set: operand
|
|
|
|
|
|
|
|
operand:
|
|
- include: numbers
|
|
- include: strings
|
|
|
|
operand-module:
|
|
- match: '\b{{ident}}\b'
|
|
scope: entity.name.function
|
|
set: expect-comment
|
|
- include: expect-comment
|
|
|
|
operand-on-off:
|
|
- match: \b(?i:ON|OFF)\b
|
|
scope: constant.language
|
|
set: expect-comment
|
|
- include: expect-comment
|
|
|
|
operand-chip:
|
|
- match: \b(?i:65816|65C02|W65C02S)\b
|
|
scope: constant.language
|
|
set: expect-comment
|
|
- include: expect-comment
|
|
|
|
operand-title:
|
|
- meta_include_prototype: false
|
|
- match: \n
|
|
pop: true
|
|
- match: '[ \t]{,2}([^\n]*)'
|
|
captures:
|
|
1: string.unquoted
|
|
|
|
operand-import:
|
|
- match: ([^; \n\t]+)
|
|
scope: string.unquoted
|
|
|
|
operand-ascii:
|
|
- meta_include_prototype: false
|
|
- match: '{{ws}}'
|
|
- match: '([^\r\n|]+)'
|
|
scope: string.unquoted
|
|
- match: \|
|
|
set: comment
|
|
- include: eol
|
|
|
|
operand-fcc:
|
|
- match: (\S)
|
|
scope: punctuation.definition.string.begin
|
|
push:
|
|
- meta_include_prototype: false
|
|
- meta_scope: string.quoted
|
|
- match: \1
|
|
scope: punctuation.definition.string.end
|
|
pop: true
|
|
- match: \n
|
|
scope: invalid.illegal
|
|
pop: true
|
|
|
|
|
|
operand-macro:
|
|
- match: '\b{{ident}}\b'
|
|
scope: variable.parameter
|
|
|
|
# comment char
|
|
# ...
|
|
# char
|
|
operand-comment:
|
|
- meta_include_prototype: false
|
|
|
|
- match: (\S)
|
|
scope: punctuation.definition.comment.begin.asm
|
|
set: [comment, comment-block]
|
|
|
|
- match: \n
|
|
scope: invalid.illegal.newline.asm
|
|
pop: true
|
|
|
|
comment-block:
|
|
- meta_include_prototype: false
|
|
- meta_scope: comment.block
|
|
- match: \1
|
|
scope: punctuation.definition.comment.end.asm
|
|
pop: true # pops to comment.
|
|
|
|
|
|
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:
|
|
- 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
|
|
|
|
expect-comment:
|
|
- include: comment
|
|
- match: \S
|
|
scope: invalid.illegal.expect.comment
|
|
|
|
comment:
|
|
- match: ;
|
|
push:
|
|
- meta_scope: comment.line.partial
|
|
- match: \n
|
|
pop: true
|
|
- include: eol
|
|
|
|
|
|
mnemonics-65816-alt:
|
|
- match: \b(?i:BLT|BGE|CPA|DEA|INA|RET|SWA|TAD|TAS|TDA|TSA|XOR)\b
|
|
scope: keyword.mnemonic.65816.alt
|
|
|
|
|
|
eol:
|
|
- match: '$'
|
|
pop: true
|