65816.tmbundle/Syntaxes/MPW Asm IIgs.sublime-syntax

336 lines
7.9 KiB
Plaintext
Raw Normal View History

2017-08-13 18:41:48 +00:00
%YAML 1.2
---
name: MPW Asm IIgs
file_extensions: [aii]
scope: source.asm.65816.mpw
variables:
ws: '[ \t]+'
ident: '[A-Za-z@_~][A-Za-z0-9@_~%$#]*'
contexts:
2017-09-17 19:19:33 +00:00
prototype:
- include: eol
- include: comment
2017-08-13 18:41:48 +00:00
main:
2017-09-17 19:19:33 +00:00
- meta_include_prototype: false
2017-08-13 18:41:48 +00:00
- match: '{{ws}}'
push: opcode
2017-09-17 19:19:33 +00:00
- match: '^({{ident}}){{ws}}((?i)PROC|PROCNAME|FUNC|INIT)\b'
captures:
1: entity.name.function
2018-09-08 20:11:17 +00:00
2: meta.opcode keyword.directive
2017-09-17 19:19:33 +00:00
push: operand-proc
- match: '^({{ident}}){{ws}}((?i)STACKDP)\b'
2017-08-13 18:41:48 +00:00
captures:
1: entity.name.function
2018-09-08 20:11:17 +00:00
2: meta.operand keyword.directive
2017-09-17 19:19:33 +00:00
push: operand-stackdp
2017-08-13 18:41:48 +00:00
- match: '^({{ident}}){{ws}}((?i)RECORD)\b'
captures:
1: entity.name.record
2018-09-08 20:11:17 +00:00
2: meta.operand keyword.directive
2017-09-17 19:19:33 +00:00
push: operand-record
2017-08-13 18:41:48 +00:00
- match: '^{{ident}}'
scope: entity.name.label
- match: '^&{{ident}}'
scope: variable.other
2017-09-17 19:19:33 +00:00
- match: ^[;*]
2017-08-13 18:41:48 +00:00
push:
- meta_scope: comment.line
- match: \n
pop: true
opcode:
2018-09-08 20:11:17 +00:00
- meta_content_scope: meta.opcode
2017-08-13 18:41:48 +00:00
- match: '{{ws}}'
set: operand
2018-09-08 20:11:17 +00:00
2017-09-17 19:19:33 +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
2018-09-08 20:11:17 +00:00
# matches _ for toolbox completion.
2017-08-15 14:18:46 +00:00
- match: \b_[A-Za-z0-9]+\b
scope: support.function.macro.toolbox
2017-08-13 18:41:48 +00:00
2021-07-29 21:59:31 +00:00
- match: \b((?i)DCB|DC|DS)([.](.))?
2017-08-13 18:41:48 +00:00
scope: meta.dc.directive
captures:
1: keyword.directive.data
2: storage.type
- match: \b((?i)CODECHK|DATACHK|LONGA|LONGI|MSB)\b
scope: keyword.directive
2017-09-17 19:19:33 +00:00
set: operand-on-off
2017-08-13 18:41:48 +00:00
- match: \b((?i)STRING)\b
scope: keyword.directive.data
2017-09-17 19:19:33 +00:00
set: operand-string
2017-08-13 18:41:48 +00:00
- match: \b(?i:ENTRY)\b
scope: keyword.directive
2017-09-17 19:19:33 +00:00
set: operand-entry
- match: \b(?i:EXPORT|IMPORT)\b
scope: keyword.directive
set: operand-export
2017-08-13 18:41:48 +00:00
- match: \b(?i:MACHINE)\b
scope: keyword.directive
2017-09-17 19:19:33 +00:00
set: operand-machine
2017-08-13 18:41:48 +00:00
- match: \b(?i:BLANKS)\b
scope: keyword.directive
2017-09-17 19:19:33 +00:00
set: operand-blanks
2017-08-13 18:41:48 +00:00
- match: \b(?i:CASE)\b
scope: keyword.directive
2017-09-17 19:19:33 +00:00
set: operand-case
2017-08-13 18:41:48 +00:00
- match: \b(?i:PRINT)\b
scope: keyword.directive
2017-09-17 19:19:33 +00:00
set: operand-print
2017-08-13 18:41:48 +00:00
2017-09-17 19:19:33 +00:00
- match: \b(?i:PROC|PROCNAME|INIT|FUNC)\b
scope: keyword.directive
set: operand-proc
- match: \b(?i:RECORD)\b
scope: keyword.directive
set: operand-record
- match: \b(?i:STACKDP)\b
scope: keyword.directive
set: operand-stackdp
- match: \b(?i:SEGATTR)\b
scope: keyword.directive
set: operand-segattr
- match: \b(?i:SEG|TITLE)\b
scope: keyword.directive
set: operand-string-expr
- match: \b(?i:LOAD|DUMP|INCLUDE)\b
2017-08-13 18:41:48 +00:00
scope: keyword.control.import
2017-09-17 19:19:33 +00:00
set: operand-string-expr
2017-08-13 18:41:48 +00:00
- match: \b(?i:ALIGN|BLANKS|CASE|CODE|CODECHK|DATACHK|DIRECT|DUMP|EJECT|END|ENDF|ENDFUNC|ENDI|ENDP|ENDPROC|END_PROC|ENDR|ENDSTACK|ENDS|ENDWITH|ENTRY|EQU|EXPORT|FUNC|IMPORT|INCLUDE|INIT|LOAD|LONGA|LONGI|MACHINE|MSB|ORG|PAGESIZE|PRINT|PROC|RECORD|SEG|SEGATTR|SET|SPACE|STACKDP|STRING|TITLE|WITH)\b
scope: keyword.directive
- match: \b(?i:IF|ELSEIF)\b
scope: keyword.control.conditional
2017-09-17 19:19:33 +00:00
set: operand-if
2017-08-13 18:41:48 +00:00
- match: \b(?i:CYCLE|LEAVE|ELSE|ENDIF|ENDWHILE|THEN|WHILE)\b
scope: keyword.control.conditional
- match: \b(?i:ACTR|AERROR|ANOP|CYCLE|ELSE|ELSEIF|ENDIF|ENDM|ENDMACRO|ENDWHILE|EXITM|GOTO|IF|LEAVE|MACRO|MEND|MEXIT|THEN|WHILE|WRITE|WRITELN|SET|SETA|SETC)\b
scope: support.function.macro
- include: macro-functions
# - match: '{{ident}}' # macro?
# scope: keyword.macro
macro-parm:
- match: '&{{ident}}\b'
scope: variable.other
2017-09-17 19:19:33 +00:00
operand-on-off:
2017-08-13 18:41:48 +00:00
- include: macro-parm
- match: \b(?i:ON|OFF)\b
scope: constant.language
2017-09-17 19:19:33 +00:00
set: expect-comment
- include: expect-comment
2017-08-13 18:41:48 +00:00
2017-09-17 19:19:33 +00:00
operand-string:
2017-08-13 18:41:48 +00:00
- include: macro-parm
- match: \b(?i:ASIS|PASCAL|C|GS/OS)\b
scope: constant.language
2017-09-17 19:19:33 +00:00
set: expect-comment
- include: expect-comment
2017-08-13 18:41:48 +00:00
2017-09-17 19:19:33 +00:00
operand-proc:
- match: \b(?i:ENTRY|EXPORT|ALIGN|ORG|NOSKIP|SKIP|TEMPORG)\b
scope: constant.language
- include: operand
operand-record:
- include: operand-proc
- match: \b(?i:IMPORT|INCR|INCREMENT|DECR|DECREMENT)\b
scope: constant.language
operand-segattr:
- match: \b(?i:NORELOAD|RELOAD|NOBANK|BANK|NOSPECIAL|SPECIAL|STATIC|DYNAMIC)\b
scope: constant.language
- include: operand
operand-stackdp:
- match: \b(?i:ENTRY|EXPORT)\b
scope: constant.language
set: expect-comment
- include: expect-comment
operand-machine:
2017-08-13 18:41:48 +00:00
- include: macro-parm
- match: \b(?i:M65816|M6502|M65C02|M65CX02|M740)\b
scope: constant.language
2017-09-17 19:19:33 +00:00
set: expect-comment
- include: expect-comment
2017-08-13 18:41:48 +00:00
2017-09-17 19:19:33 +00:00
operand-case:
2017-08-13 18:41:48 +00:00
- include: macro-parm
- match: \b(?i:ON|OFF|YES|NO|Y|N|OBJECT|OBJ)\b
scope: constant.language
2017-09-17 19:19:33 +00:00
set: expect-comment
- include: expect-comment
2017-08-13 18:41:48 +00:00
2017-09-17 19:19:33 +00:00
operand-blanks:
2017-08-13 18:41:48 +00:00
- include: macro-parm
- match: \b(?i:ON|OFF|YES|NO|Y|N)\b
scope: constant.language
2017-09-17 19:19:33 +00:00
set: expect-comment
- include: expect-comment
2017-08-13 18:41:48 +00:00
2017-09-17 19:19:33 +00:00
operand-print:
2017-08-13 18:41:48 +00:00
- include: macro-parm
- match: ','
2017-08-13 18:41:48 +00:00
- match: \b(?i:ON|OFF|PUSH|POP)\b
scope: constant.language
- match: \b(?i:NO)?(?i:GEN|PAGE|WARN|MCALL|OBJ|DATA|MDIR|HDR|LITS|STAT|SYM)\b
scope: constant.language
2017-09-17 19:19:33 +00:00
- include: expect-comment
2017-08-13 18:41:48 +00:00
2017-09-17 19:19:33 +00:00
operand-entry:
- match: \b(?i:CODE|DATA)\b
scope: constant.language
2017-08-13 18:41:48 +00:00
- match: '\b{{ident}}\b'
scope: entity.name.function
2017-09-17 19:19:33 +00:00
operand-export:
- match: \b(?i:CODE|DATA|EQU)\b
scope: constant.language
- match: '\b{{ident}}\b'
scope: entity.name.function
2017-08-13 18:41:48 +00:00
2017-09-17 19:19:33 +00:00
operand-if:
2017-08-13 18:41:48 +00:00
- match: \b(?i:THEN)\b
scope: keyword.control.conditional
- include: operand
2017-09-17 19:19:33 +00:00
operand-string-expr:
- include: macro-parm
- include: strings
- include: expect-comment
2017-08-13 18:41:48 +00:00
operand:
2018-09-08 20:11:17 +00:00
- meta_content_scope: meta.operand
2017-08-13 18:41:48 +00:00
- include: macro-parm
- include: numbers
- include: strings
- include: macro-functions
- match: \b(?i:NOT|DIV|MOD|AND|OR|XOR|EOR)\b
scope: keyword.operator
macro-functions:
- match: \&(?i:ABS|CHR|CONCAT|DEFAULT|DELSYMTBL|ENTERSYM|EVAL|FINDSYM|GETENV|INTTOSTR|I2S|ISINT|LEN|LEX|LIST|LOWCASE|LC|MAX|MIN|NBR|NEWSYMTBL|ORD|POS|SCANEQ|SCANNE|STRTOINT|S2I|SETTING|SUBSTR|SYSDATE|SYSINDEX|SYSLIST|SYSLST|SYSLOCAL|SYSGLOBAL|SYSMOD|SYSSEG|SYSTIME|SYSTOKEN|SYSTOKSTR|SYSVALUE|SYSFLAGS|TRIM|TYPE|UPCASE|UC)\b
scope: support.function.macro
numbers:
2018-09-08 20:11:17 +00:00
- match: \b\d+\b
2017-08-13 18:41:48 +00:00
scope: constant.numeric
2018-09-08 20:11:17 +00:00
- match: \$[0-9a-fA-F]+\b
2017-08-13 18:41:48 +00:00
scope: constant.numeric.hex
2018-09-08 20:11:17 +00:00
- match: \%[01]+\b
2017-08-13 18:41:48 +00:00
scope: constant.numeric.binary
2018-09-08 20:11:17 +00:00
- match: \@[0-7]+\b
2017-08-13 18:41:48 +00:00
scope: constant.numeric.octal
strings:
- match: "'"
scope: punctuation.definition.string.begin
push:
2017-09-17 19:19:33 +00:00
- meta_include_prototype: false
- meta_scope: string.quoted.single
2017-08-13 18:41:48 +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 19:19:33 +00:00
- meta_include_prototype: false
2017-08-13 18:41:48 +00:00
- match: '"'
scope: punctuation.definition.string.end
pop: true
2017-09-17 19:19:33 +00:00
- meta_scope: string.quoted.double
pop: true
2017-08-13 18:41:48 +00:00
- match: \n
scope: invalid.illegal.newline.asm
pop: true
2017-09-17 19:19:33 +00:00
expect-comment:
- include: comment
- match: \S
scope: invalid.illegal.expect.comment
2017-08-13 18:41:48 +00:00
2017-09-17 19:19:33 +00:00
comment:
- match: ;
push:
- meta_scope: comment.line
- match: \n
pop: true
- include: eol
2017-08-13 18:41:48 +00:00
2017-09-17 19:19:33 +00:00
eol:
- match: '$'
pop: true
2017-08-13 18:41:48 +00:00
mnemonics-65816-alt:
- match: \b(?i:BLT|BGE|CPA|DEA|INA|SWA|TAS|TSA)\b
scope: keyword.mnemonic.65816.alt