mirror of
https://github.com/MatthewCallis/language-65asm.git
synced 2024-11-25 07:32:18 +00:00
218 lines
5.7 KiB
Plaintext
218 lines
5.7 KiB
Plaintext
scopeName: 'source.assembly.65816.merlin'
|
|
fileTypes: []
|
|
name: 'Merlin'
|
|
patterns: [
|
|
{ include: 'source.65c02-opcodes' }
|
|
{ include: 'source.65816-opcodes' }
|
|
{ include: 'source.65816l-opcodes' }
|
|
{ include: 'source.65816alt-opcodes' }
|
|
{ include: '#comments' }
|
|
{ include: '#symbols' }
|
|
{ include: '#directives' }
|
|
# registers
|
|
# TODO: fix registers
|
|
# {
|
|
# 'match': '(?<=,)([xXyYsS])\\b'
|
|
# 'name': 'variable.language.register'
|
|
# }
|
|
]
|
|
|
|
|
|
repository:
|
|
|
|
# comments
|
|
comments:
|
|
patterns: [
|
|
# asterisk line comment
|
|
{
|
|
match: '^[*].*'
|
|
name: 'comment.line.asterisk.merlin'
|
|
}
|
|
# semicolon line comment
|
|
{
|
|
match: ';.*$'
|
|
name: 'comment.line.semicolon.merlin'
|
|
}
|
|
]
|
|
|
|
# symbols
|
|
symbols:
|
|
patterns: [
|
|
# delimited strings
|
|
{
|
|
begin: '[\'"]'
|
|
beginCaptures:
|
|
0: name: 'punctuation.definition.string.begin.merlin'
|
|
end: '[\'"]'
|
|
endCaptures:
|
|
0: name: 'punctuation.definition.string.end.merlin'
|
|
name: 'string.quoted.double.assembly.merlin'
|
|
}
|
|
# TODO: highlight strings with all valid delimiters
|
|
# {
|
|
# captures:
|
|
# 1: name: 'string.delimited.begin.merlin'
|
|
# 2: name: 'string.delimited.merlin'
|
|
# 3: name: 'string.delimited.end.merlin'
|
|
# match: '\\b(\\S)(.*?)(\\1)\\b'
|
|
# }
|
|
# TODO: fix label scopes
|
|
# Variables
|
|
{
|
|
match: '^][:-~][0-~]+'
|
|
# name: 'variable.named.merlin'
|
|
name: 'entity.name.function.label.merlin'
|
|
}
|
|
# Local labels
|
|
{
|
|
match: '^:[:-~][0-~]+'
|
|
name: 'entity.name.function.label.merlin'
|
|
}
|
|
# Global labels
|
|
{
|
|
match: '^[:-~][0-~]+'
|
|
name: 'entity.name.function.merlin'
|
|
}
|
|
# absolut address/number
|
|
{
|
|
match: '\\#(\'.\'|[^\\s\']+)'
|
|
name: 'constant.numeric.hex.merlin'
|
|
}
|
|
# hex, prefixed with ampersand($)
|
|
{
|
|
match: '-?\\$[A-Fa-f0-9]+'
|
|
name: 'constant.numeric.hex.merlin'
|
|
}
|
|
# octal, prefixed with @
|
|
{
|
|
match: '@([0-7]+)\\b'
|
|
name: 'constant.numeric.octal.merlin'
|
|
}
|
|
# binary
|
|
{
|
|
match: '%[01]+'
|
|
name: 'constant.numeric.binary.merlin'
|
|
}
|
|
# decimal
|
|
{
|
|
match: '\\b([0-9]+)\\b'
|
|
name: 'constant.numeric.decimal.merlin'
|
|
}
|
|
]
|
|
|
|
# assembler directives
|
|
directives:
|
|
patterns: [
|
|
# file control
|
|
{
|
|
match: '\\b(?i:equ|ext|ent|org|rel|obj|var|typ|end|dum|dend|ast|dat|lstdo|pag|ttl|skp|chk|err|kbd|lup|--\\^|mx|pau|sw|usr|xc)\\b'
|
|
name: 'keyword.directive.merlin'
|
|
}
|
|
# data control
|
|
{
|
|
match: '\\b(?i:da|dw|ddb|db|dfb|adr|adrl|ds)\\b'
|
|
name: 'support.function.pseudo.merlin'
|
|
}
|
|
# conditional control
|
|
{
|
|
match: '\\b(?i:do|else|if|fin)\\b'
|
|
name: 'keyword.control.conditional.merlin'
|
|
}
|
|
# macro control
|
|
{
|
|
match: '\\b(?i:mac)\\b|<<<'
|
|
name: 'support.function.pseudo.merlin'
|
|
# name: 'keyword.directive.macro.merlin'
|
|
}
|
|
# operators
|
|
{
|
|
match: '[-+/*^><|#\\[\\](),=.!&]'
|
|
name: 'keyword.operator.merlin'
|
|
}
|
|
# disk commands
|
|
{
|
|
captures:
|
|
1: name: 'support.function.pseudo.merlin'
|
|
2: name: 'string.quoted.other.path.merlin'
|
|
match: '\\b((?i:dsk|put|use|sav))\\s+(\\S*)'
|
|
name: 'meta.disk.directive.merlin'
|
|
}
|
|
# cycle count
|
|
{
|
|
captures:
|
|
1: name: 'support.function.pseudo.merlin'
|
|
2: name: 'constant.language.merlin'
|
|
match: '\\b((?i:cyc))\\s+((?i:on|off|ave))\\b'
|
|
name: 'meta.cyc.directive.merlin'
|
|
}
|
|
# expand control
|
|
{
|
|
captures:
|
|
1: name: 'support.function.pseudo.merlin'
|
|
2: name: 'constant.language.merlin'
|
|
match: '\\b((?i:exp))\\s+((?i:on|off|only))\\b'
|
|
name: 'meta.exp.directive.merlin'
|
|
}
|
|
# list control
|
|
{
|
|
captures:
|
|
1: name: 'support.function.pseudo.merlin'
|
|
2: name: 'constant.language.merlin'
|
|
match: '\\b((?i:lst))\\s+((?i:off))\\b'
|
|
name: 'meta.exp.directive.merlin'
|
|
}
|
|
# truncation control
|
|
{
|
|
captures:
|
|
1: name: 'support.function.pseudo.merlin'
|
|
2: name: 'constant.language.merlin'
|
|
match: '\\b((?i:tr))\\s+((?i:on|off|adr))\\b'
|
|
name: 'meta.tr.directive.merlin'
|
|
}
|
|
# string command
|
|
{
|
|
captures:
|
|
1: name: 'support.function.pseudo.merlin'
|
|
2: name: 'string.delimited.begin.merlin'
|
|
3: name: 'string.delimited.merlin'
|
|
4: name: 'string.delimited.end.merlin'
|
|
5: name: 'constant.numeric.hex.merlin'
|
|
match: '\\b((?i:asc|dci|inv|fls|str))\\s+(\\S)(.*?)(\\2|\\S),([a-fA-F0-9]+)?'
|
|
}
|
|
# reverse command
|
|
{
|
|
captures:
|
|
1: name: 'support.function.pseudo.merlin'
|
|
2: name: 'string.delimited.begin.merlin'
|
|
3: name: 'string.delimited.merlin'
|
|
4: name: 'string.delimited.end.merlin'
|
|
match: '\\b((?i:rev))\\s+(\\S)(.*?)(\\2|$)'
|
|
}
|
|
# hex command
|
|
{
|
|
begin: '\\b((?i:hex))\\b'
|
|
captures:
|
|
1:
|
|
name: 'support.function.pseudo.merlin'
|
|
end: '$'
|
|
name: 'meta.hex.directive.merlin'
|
|
patterns: [
|
|
# hex without $
|
|
{
|
|
match: '\\b[a-fA-F0-9]{1,2}\\b'
|
|
name: 'constant.numeric.hex.merlin'
|
|
}
|
|
# semicolon comments
|
|
{
|
|
match: ';.*'
|
|
name: 'comment.line.semicolon.merlin'
|
|
}
|
|
# number check
|
|
{
|
|
match: '(?!,)\\S'
|
|
name: 'invalid.illegal.merlin'
|
|
}
|
|
]
|
|
}
|
|
]
|