language-65asm/grammars/6502 Assembly (DASM).cson

113 lines
2.7 KiB
Plaintext
Raw Normal View History

2018-06-07 16:24:53 +00:00
# Syntax highlighting for the DASM macro assembler
scopeName: 'source.assembly.6502.dasm'
fileTypes: []
name: '6502 Assembly (DASM)'
patterns: [
{ include: 'source.6502-opcodes' }
{ include: '#comments' }
{ include: '#symbols' }
2018-06-07 18:54:11 +00:00
{ include: '#directives' }
2018-06-07 16:24:53 +00:00
]
# Repository starts here ------------------------------------------------------
repository:
# comments
comments:
patterns: [
# semicolon comments
2014-03-02 03:05:28 +00:00
{
2018-06-07 16:24:53 +00:00
match: ';.*$'
name: 'comment.line.semicolon.dasm'
2014-03-02 03:05:28 +00:00
}
]
2018-06-07 16:24:53 +00:00
# symbols
symbols:
patterns: [
# strings
{
begin: '"'
beginCaptures:
0:
name: 'punctuation.definition.string.begin.dasm'
end: '"'
endCaptures:
0:
name: 'punctuation.definition.string.end.dasm'
name: 'string.quoted.double.dasm'
}
2018-06-07 18:54:11 +00:00
# global labels
{
captures:
1:
name: 'entity.name.function.label.dasm'
match: '\\b([A-Za-z0-9_]+):'
name: 'meta.function.label.dasm'
}
# local labels
{
captures:
1:
name: 'entity.name.function.label.dasm'
match: '\\.\\b([A-Za-z0-9_]+):'
name: 'meta.function.label.dasm'
}
2018-06-07 16:24:53 +00:00
# absolut addressing/numbers
2018-06-07 18:54:11 +00:00
{
match: '\\#(\'.\'|[^\\s\']+)'
name: 'constant.numeric.hex.dasm'
}
2018-06-07 16:24:53 +00:00
# hex, prefixed with dollar sign($)
{
2018-06-07 18:54:11 +00:00
match: '-?\\$\\b[a-fA-F0-9]+\\b'
2018-06-07 16:24:53 +00:00
name: 'constant.numeric.hex.dasm'
}
# octal, prefixed with zero(0)
{
2018-06-07 18:54:11 +00:00
match: '-?\\b0[1-7]+\\b'
2018-06-07 16:24:53 +00:00
name: 'constant.numeric.octal.dasm'
}
# binary
{
2018-06-07 18:54:11 +00:00
match: '%[01]+'
2018-06-07 16:24:53 +00:00
name: 'constant.numeric.binary.65816-generic'
}
# decimal
{
2018-06-07 18:54:11 +00:00
match: '\\b([0-9]+)\\b'
2018-06-07 16:24:53 +00:00
name: 'constant.numeric.decimal.65816-generic'
}
]
# directives
directives:
patterns: [
# file and symbol control
{
2018-06-07 18:54:11 +00:00
match: '\\b(?i:seg(\\.u)?|include|incbin|incdir|hex|err|r?org|processor|echo|rend|align|subroutine)\\b'
2018-06-07 16:24:53 +00:00
name: 'support.function.pseudo.dasm'
}
# data control
2018-06-07 18:54:11 +00:00
{
match: '\\b(?i:d[csv](.bwl)?|hex|eq[um]|set|list\\s(on|off))\\b'
name: 'support.function.pseudo.dasm'
}
# data control II
{
match: '\\.\\b(?i:byte|word)\\b'
name: 'support.function.pseudo.dasm'
}
2018-06-07 16:24:53 +00:00
# Macro control
2018-06-07 18:54:11 +00:00
{
match: '\\b(?i:mac|endm|mexit)\\b'
name: 'support.function.pseudo.acme'
}
2018-06-07 16:24:53 +00:00
# Conditional control
2018-06-07 18:54:11 +00:00
{
match: '\\b(?i:ifn?const|if|else|e(nd)?if|repeat|repend)\\b'
name: 'keyword.control.conditional.acme'
}
2018-06-07 16:24:53 +00:00
]