65816.tmbundle/Syntaxes/ORCA-M.sublime-syntax

344 lines
7.5 KiB
Plaintext
Raw Permalink Normal View History

2017-08-21 19:37:14 +00:00
%YAML 1.2
---
name: ORCA/M Assembler
file_extensions: [src, s]
scope: source.asm.65816.orcam
variables:
ws: '[ \t]+'
ident: '[_~A-Za-z][_~A-Za-z0-9]*'
contexts:
2017-09-17 00:59:13 +00:00
2017-09-17 04:26:33 +00:00
prototype:
- include: comment
- include: eol
2017-08-21 19:37:14 +00:00
main:
- meta_include_prototype: false
- match: '{{ws}}'
2017-09-17 04:26:33 +00:00
push: opcode
2017-08-21 19:37:14 +00:00
- match: '^({{ident}}){{ws}}((?i)START|PRIVATE|DATA|PRIVDATA)\b'
captures:
1: entity.name.function
2: keyword.directive
2017-09-17 04:26:33 +00:00
push: operand-segname
2017-08-21 19:37:14 +00:00
- match: '^({{ident}}){{ws}}((?i)GEQU)\b'
captures:
1: entity.name.constant
2: keyword.directive
push: operand
2017-08-21 19:37:14 +00:00
- match: '^{{ident}}'
scope: entity.name.label
2017-09-17 04:26:33 +00:00
- match: ^[*;!.]
push:
- meta_scope: comment.line
- match: \n
pop: true
2017-08-21 19:37:14 +00:00
opcode:
2017-09-17 00:59:13 +00:00
- include: scope:source.asm.65816#mnemonics-6502
- include: scope:source.asm.65816#mnemonics-65c02
- include: scope:source.asm.65816#mnemonics-65816
2017-08-21 19:37:14 +00:00
- include: mnemonics-65816-alt
2017-09-17 04:26:33 +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.smart-macro.toolbox
2017-09-17 04:26:33 +00:00
2017-08-21 19:37:14 +00:00
- match: \b(?i:DC)\b
scope: keyword.directive
set: operand-dc
2017-11-25 15:01:02 +00:00
- match: \b(?i:APPEND|COPY|KEEP|MCOPY|MLOAD|MDROP)\b
2017-08-21 19:37:14 +00:00
scope: keyword.control.import
set: operand-path
- match: \b(?i:ABSADDR|CASE|CODECHK|DATACHECK|DYNCHK|ERR|EXPAND|IEEE|INSTIME|LIST|LONGA|LONGI|MSB|NUMSEX|OBJCASE|PRINTER|SYMBOL|65C02|65816)\b
scope: keyword.directive
set: operand-on-off
2017-09-17 00:59:13 +00:00
- match: \b(?i:DIRECT)\b
scope: keyword.directive
set: operand-or-off
- match: \b(?i:ALIGN|DS|EQU|GEQU|KIND|MERR|ORG|RENAME|SETCOM)\b
scope: keyword.directive
set: operand
# using label
- match: \b(?i:USING)\b
scope: keyword.directive
set: operand-label
- match: \b(?i:ANOP|EJECT|END|ENTRY|OBJEND)\b
scope: keyword.directive
set: expect-comment
- match: \b(?i:START|PRIVATE|DATA|PRIVDATA)\b
scope: keyword.directive
set: operand-segname
- match: \b(?i:TITLE)\b
scope: keyword.directive
set: operand-title
2017-08-21 19:37:14 +00:00
2017-09-17 00:59:13 +00:00
- match: \b(?i:MEM)\b
scope: invalid.deprecated
set: operand
2017-08-21 19:37:14 +00:00
- match: '{{ws}}'
set: operand
operand:
- include: numbers
- include: strings
2017-09-17 00:59:13 +00:00
operand-label:
- match: '\b{{ident}}\b'
set: expect-comment
- include: need-operand
need-operand:
- match: '\n'
scope: invalid.illegal.operand
set: main
- match: '\S'
scope: invalid.illegal.operand
operand-or-off:
- match: \b(?i:OFF)\b
scope: constant.language
set: expect-comment
- include: operand
# optional label.
operand-segname:
- match: '\b{{ident}}\b'
set: expect-comment
- include: expect-comment
operand-title:
- match: "'"
scope: punctuation.definition.string.begin
set:
- meta_include_prototype: false
- meta_scope: string.quoted.single
- match: "'"
scope: punctuation.definition.string.end
set: expect-comment
- match: \n
scope: invalid.illegal.newline.asm
set: main
- match: '([^ \t\n;]+)'
scope: string.unquoted
set: expect-comment
2017-08-21 19:37:14 +00:00
operand-on-off:
- match: \b(?i:ON|OFF)\b
scope: constant.language
set: expect-comment
- match: \S
scope: invalid.illegal.operand
operand-path:
- match: '([^ \t\n;]+)'
scope: string.unquoted
set: expect-comment
operand-dc:
# dc nB
# dc nH
# dc nX
- match: \d+
scope: constant.numeric
set: operand-dc-format
- include: operand-dc-format
operand-dc-format:
- match: ([bB])
scope: storage.type
set: operand-dc-b
- match: ([cC])
scope: storage.type
set: operand-dc-c
- match: ([hH])
scope: storage.type
set: operand-dc-h
- match: ((?i)[ABCDEFHIRS])(\d+)?
captures:
1: storage.type
2: constant.numeric
set: operand-dc-other
- match: '[^ \t,]'
scope: invalid.illegal.operand
set: operand-dc-other
operand-dc-b:
# '[01]+'
- match: "'"
scope: punctuation.definition.string.begin
set:
- meta_include_prototype: false
- meta_scope: string.quoted.single
- match: "'"
scope: punctuation.definition.string.end
set: operand-dc
- match: \n
scope: invalid.illegal.newline
pop: true
- match: '[^01]'
scope: invalid.illegal
operand-dc-h:
# '[A-Fa-f0-9]+'
- match: "'"
scope: punctuation.definition.string.begin
set:
- meta_include_prototype: false
- meta_scope: string.quoted.single
- match: "'"
scope: punctuation.definition.string.end
set: operand-dc
- match: \n
scope: invalid.illegal.newline
pop: true
- match: '[^A-Fa-f0-9\t ]'
scope: invalid.illegal
operand-dc-c:
- match: "'"
scope: punctuation.definition.string.begin
set:
- meta_include_prototype: false
- meta_scope: string.quoted.single
2017-09-17 01:15:30 +00:00
- match: \''|[^'\n] # '' to escape
2017-08-21 19:37:14 +00:00
- match: "'"
scope: punctuation.definition.string.end
set: operand-dc
- match: \n
scope: invalid.illegal.newline
pop: true
operand-dc-other:
- match: "'"
scope: punctuation.definition.string.begin
set:
- meta_include_prototype: false
- meta_scope: string.quoted.single
- include: numbers
- match: "'"
scope: punctuation.definition.string.end
set: operand-dc
- match: \n
scope: invalid.illegal.newline.asm
pop: true
expect-comment:
2017-09-17 00:59:13 +00:00
- include: comment
2017-08-21 19:37:14 +00:00
- match: \S
scope: invalid.illegal.expect.comment
comment:
2017-09-17 04:26:33 +00:00
- match: ;
push:
- meta_scope: comment.line
- match: \n
pop: true
- include: eol
eol:
2017-09-17 00:59:13 +00:00
- match: '$'
2017-09-17 04:26:33 +00:00
pop: true
2017-08-21 19:37:14 +00:00
numbers:
2018-09-08 20:11:17 +00:00
- match: \b\d+\b
2017-08-21 19:37:14 +00:00
scope: constant.numeric
2018-09-08 20:11:17 +00:00
- match: \$[0-9a-fA-F]+\b
2017-08-21 19:37:14 +00:00
scope: constant.numeric.hex
2018-09-08 20:11:17 +00:00
- match: \%[01]+\b
2017-08-21 19:37:14 +00:00
scope: constant.numeric.binary
2018-09-08 20:11:17 +00:00
- match: \@[0-7]+\b
2017-08-21 19:37:14 +00:00
scope: constant.numeric.octal
strings:
2017-09-17 00:59:13 +00:00
- match: "'"
scope: punctuation.definition.string.begin
push:
- meta_include_prototype: false
- meta_scope: string.quoted.single
2017-09-17 01:15:30 +00:00
- match: \''|[^'\n] # '' to escape
2017-09-17 00:59:13 +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:
- meta_include_prototype: false
- meta_scope: string.quoted.double
2017-09-17 01:15:30 +00:00
- match: \""|[^"\n] # '' to escape
2017-09-17 00:59:13 +00:00
- match: '"'
scope: punctuation.definition.string.end
pop: true
- match: \n
scope: invalid.illegal.newline.asm
pop: true
string:
- match: "'"
scope: punctuation.definition.string.begin
push:
- meta_include_prototype: false
- meta_scope: string.quoted.single
2017-09-17 01:15:30 +00:00
- match: \''|[^'\n] # '' to escape
2017-09-17 00:59:13 +00:00
- match: "'"
scope: punctuation.definition.string.end
pop: true
- match: \n
scope: invalid.illegal.newline.asm
pop: true
2017-08-21 19:37:14 +00:00
mnemonics-65816-alt:
- match: \b(?i:BLT|BGE|CPA)\b
scope: keyword.mnemonic.65816.alt