language-65asm/grammars/dasm.cson

117 lines
2.9 KiB
Plaintext

# Syntax Highlighting for 6502 programming with DASM
# Improvements: absolut addresses/numbers, equ, seg, ds, word
# Not working: labels
scopeName: 'source.assembly.6502.dasm-6502' # Prevents conflicts with other architectures supported by dasm
name: '6502 Assembly (DASM)' # Name shown in Atom Editor grammar selection'fileTypes': []
foldingStartMarker: '/\\*\\*|\\{\\s*$'
foldingStopMarker: '\\*\\*/|^\\s*\\}'
# File extensions associated with this grammar
fileTypes: []
# include all opcodes and directives the toolchain supports
patterns: [
{ include: 'source.6502-opcodes' } # include basic 6502 instruction set
{ include: '#comments' }
{ include: '#directives' }
{ include: '#symbols' }
]
# Repository starts here ------------------------------------------------------
repository:
# comments
comments:
patterns: [
# semicolon comments
{
# captures:
# 1:
# name: 'punctuation.definition.comment'
match: '(;).*$\\n?'
name: 'comment.line.semicolon.dasm-6502'
}
]
# symbols
symbols:
patterns: [
# strings
{
begin: '"'
end: '"'
name: 'string.quoted.double.untitled.dasm-6502'
patterns: [
{
match: '\\\\.'
name: 'constant.character.escape.untitled.dasm-6502'
}
]
}
# labels
{
match: '^[A-Za-z_][A-Za-z0-9_]*'
name: 'entity.name.label.dasm-6502'
}
# local labels
{
match: '^\\.[A-Za-z_][A-Za-z0-9_]*'
name: 'entity.name.label.local.dasm-6502'
}
# absolut address/number
{
match: '\\#(\'.\'|[^\\s\']+)'
name: 'constant.numeric.hex.cc65-directives'
}
# binary numbers
{
match: '%[01]+'
name: 'constant.numeric.binary.dasm-6502'
}
# decimal numbers
{
match: '\\b([0-9]+)\\b'
name: 'constant.numeric.decimal.dasm-6502'
}
# hex numbers
{
match: '\\$[0-9a-fA-F]+'
name: 'constant.numeric.hex.dasm-6502'
}
# macro parameters
{
match: '{[0-9]+}'
name: 'variable.parameter.macro.dasm-6502'
}
]
#
# assembler directives
directives:
patterns: [
# data directives
{
match: '\\b(?i:SET|WORD|.?BYTE|HEX|DS|.?WORD)\\b'
name: 'storage.type.dasm-6502'
}
# linker directives
{
match: '\\b(?i:ALIGN)\\b'
name: 'storage.modifier.dasm-6502'
}
# subroutines and macros
{
match: '\\b(?i:REPEAT|REPEND|MAC|ENDM|SUBROUTINE|INCLUDE)\\b'
name: 'support.function.dasm-6502'
}
# processor and org
{
match: '\\b(?i:processor|org)\\b'
name: 'constant.language.dasm-6502'
}
# pseudo opcodes
{
match: '\\b(?i:equ|seg(\\.u)?)\\b'
name: 'support.function.pseudo.dasm-6502'
}
]