65816.tmbundle/Syntaxes/Macross.sublime-syntax

175 lines
4.5 KiB
Plaintext
Raw Normal View History

2017-08-21 19:37:45 +00:00
%YAML 1.2
---
name: MACROSS Assembler
file_extensions: []
scope: source.asm.6502.macross
variables:
ws: '[ \t]'
ident: '[A-Za-z_][A-Za-z_0-9]*'
contexts:
2017-09-17 04:26:24 +00:00
prototype:
- include: comments
2017-08-21 19:37:45 +00:00
main:
- match: '\b(?i:include)\b'
scope: keyword.control.import
- match: '\b(macro){{ws}}+({{ident}})\b'
captures:
1: keyword.control.import
2: entitity.name.macro
push:
- match: '{'
set: block
- match: '\b{{ident}}\b'
scope: variable.parameter
- match: '\b(function){{ws}}+({{ident}})\b'
captures:
1: keyword.control.import
2: entitity.name.function
push:
- match: '{'
set: block
- match: '\b{{ident}}\b'
scope: variable.parameter
- match: \bstruct(?=\s*{)
scope: keyword
set: [name_after_struct, block]
- include: block
- include: block-content
name_after_struct:
# - match: \n
# scope: invalid.illegal
# pop: true
- match: '{{ident}}'
scope: entitity.name.struct
pop: true
- match: '[^ \t]+'
scope: invalid.illegal
pop: true
while_after_mdo:
# - match: \n
# scope: invalid.illegal
# pop: true
- match: '\b(?i:while|until)\b'
scope: keyword.control.import
pop: true
- match: '[^ \t]+'
scope: invalid.illegal
pop: true
block:
- match: \{
scope: invalid.illegal
meta_content_scope: meta.block
push: block
- match: \}
pop: true
- include: block-content
block-content:
- include: string
2017-09-17 04:26:24 +00:00
- include: scope:source.asm.65816#mnemonics-6502
- include: scope:source.asm.65816#mnemonics-65c02
2017-08-21 19:37:45 +00:00
- include: numbers
- match: '({{ident}}):'
captures:
1: entitity.name.label
- match: '\b[AaXxYy]\b'
scope: constant.language.register
- match: '\b(?i:TRUE|FALSE|NULL|here)\b'
scope: constant.language
# data statement
- match: \b(?i:block|align|word|long|dbyte|byte|string|struct)\b
scope: storage.type
# macro statements
# c++ #if uses keyword.control.import
- match: \b(?i:mdefine|mif|melse|melseif|mwhile|freturn|mfor|mswitch|mcase|mdefault|define|variable|undefine|function|macro)\b
scope: keyword.control.import
# mdo { block } while | until
- match: \b(?i:mdo)
scope: keyword.control.import
set: [while_after_mdo, block]
- match: '\b(?i:assert|constrain|define|do|else|elseif|extern|freturn|function|if|include|macro|mcase|mdefault|mdefine|mdo|melse|melseif|mfor|mif|mswitch|muntil|mvariable|mwhile|org|rel|start|target|undefine|until|variable|while|word)\b'
scope: keyword
- match: '\b(?i:always|carry|equal|geq|greater|gt|leq|less|lt|minus|negative|neq|never|not_carry|not_equal|not_overflow|not_zero|overflow|plus|positive|sgeq|sgt|sleq|slt|sneq|zero)\b'
scope: keyword.condition
- match: '\b(?i:addressMode|apply|arrayLength|atascii|atasciiColor|debugModeOff|debugModeOn|emitModeOff|emitModeOn|isAbsoluteValue|isARegister|isBlock|isBuiltInFunction|isConditionCode|isDefined|isDirectMode|isExternal|isField|isFunction|isImmediateMode|isIndexedMode|isIndirectMode|isPostIndexedMode|isPreIndexedMode|isRelocatableValue|isString|isStruct|isSymbol|isXIndexedMode|isXRegister|isYIndexedMode|isYRegister|listingOff|listingOn|makeArray|nthChar|printf|strcat|strcmp|strcmplc|strlen|substr|symbolDefine|symbolLookup|symbolName|symbolUsage|valueType)\b'
scope: keyword
string:
- match: '"'
2017-09-17 19:32:25 +00:00
scope: punctuation.definition.string.begin
2017-08-21 19:37:45 +00:00
push:
2017-09-17 04:26:24 +00:00
- meta_include_prototype: false
2017-09-17 19:32:25 +00:00
- meta_scope: string.quoted.double
2017-08-21 19:37:45 +00:00
- match: '\n'
pop: true
scope: invalid.illegal.newline
- match: '[^"\n]|\\.'
- match: '"'
2017-09-17 19:32:25 +00:00
scope: punctuation.definition.string.end
2017-08-21 19:37:45 +00:00
pop: true
comments:
- match: ';'
push:
- meta_scope: comment.line
- match: '$'
pop: true
- match: '/\*'
push:
- meta_scope: comment.line
- match: '\*/'
pop: true
numbers:
2018-09-08 20:11:17 +00:00
- match: \b0[0-7]+\b
2017-08-21 19:37:45 +00:00
scope: constant.numeric.octal
2018-09-08 20:11:17 +00:00
- match: \b0[xX][0-9A-Fa-f]+\b
2017-08-21 19:37:45 +00:00
scope: constant.numeric.hexadecimal
2018-09-08 20:11:17 +00:00
- match: \b0[qQ][0-3]+\b
2017-08-21 19:37:45 +00:00
scope: constant.numeric.quarters
2018-09-08 20:11:17 +00:00
- match: \b0[bB][01]+\b
2017-08-21 19:37:45 +00:00
scope: constant.numeric
2018-09-08 20:11:17 +00:00
- match: \b\d+\b
2017-08-21 19:37:45 +00:00
scope: constant.numeric
- match: \'([^'\n]|\\.)\'
scope: constant.character
- match: \'.*$
scope: invalid.illegal.constant.character