language-65asm/grammars/65c02-generic.cson
2018-06-08 02:58:45 +02:00

66 lines
1.5 KiB
Plaintext

# Generic 65C02 grammar with semicolon comments
scopeName: 'source.assembly.6502.65c02-generic'
fileTypes: []
name: '6502 Assembly'
patterns: [
{ include: 'source.65c02-opcodes' } # include 6502 and 65c02 opcodes
{ include: 'source.6502x-opcodes' }
{ include: '#comments' }
{ include: '#symbols' }
]
# Repository starts here ------------------------------------------------------
repository:
# comments
comments:
patterns: [
# semicolon comments
{
match: ';.*$'
name: 'comment.line.semicolon.65c02-generic'
}
]
# symbols
symbols:
patterns: [
{
begin: '"'
beginCaptures:
0:
name: 'punctuation.definition.string.begin.65c02-generic'
end: '"'
endCaptures:
0:
name: 'punctuation.definition.string.end.65c02-generic'
name: 'string.quoted.double.65c02-generic'
}
# absolut address/number
{
match: '\\#(\'.\'|[^\\s\']+)'
name: 'constant.numeric.hex.65c02-generic'
}
# hex, prefixed with ampersand($)
{
match: '-?\\$\\b[A-Fa-f0-9]+\\b'
name: 'constant.numeric.hex.65c02-generic'
}
# hex, suffixed with h(h)
{
match: '-?([a-fA-F0-9]+)h'
name: 'constant.numeric.hex.65c02-generic'
}
# binary
{
match: '%[01]+'
name: 'constant.numeric.binary.65c02-generic'
}
# decimal
{
match: '\\b([0-9]+)\\b'
name: 'constant.numeric.decimal.65c02-generic'
}
]