language-65asm/grammars/acme.cson
2018-06-21 10:39:19 -07:00

136 lines
3.5 KiB
Plaintext

# Syntax Highlighting for the acme directives
scopeName: 'source.assembly.6502.acme'
name: 'ACME Crossassembler'
filetypes: [
'a'
'asm'
]
patterns: [
{ include: 'source.6502-opcodes' }
{ include: 'source.6502x-opcodes' }
{ include: '#comments' }
# directives
{ include: '#directives' }
# symbols, constants, numbers
{ include: '#symbols' }
]
# Repository starts here ------------------------------------------------------
repository:
# comments
comments:
patterns: [
# semicolon comments
{
match: ';.*$'
name: 'comment.line.semicolon.acme'
}
]
# symbols
symbols:
patterns: [
# Labels (at beginning of a line)
{
match: '^[A-Za-z\\._][A-Za-z0-9_:]*'
name: 'entity.name.function.acme'
}
# this section hilights labels as variables: results in pretty colorful listings, maybe you like it
# Labels inline
# {
# match: '\\b[A-Za-z][A-Za-z0-9_:]*\\b'
# name: 'variable.language'
# }
# Register A (like in ASL A)
{
match: '\\b[aA]\\b'
name: 'variable.language.register.acme'
}
# Registers X and Y (like in LDA $1000,X or LDA ($30),Y )
{
match: '(?<=,)([xXyY])\\b'
name: 'variable.language.register.acme'
}
# strings
{
begin: '"'
end: '"'
endCaptures:
0:
name: 'punctuation.definition.string.end.acme'
name: 'string.quoted.double.acme'
}
{
begin: '\''
end: '\''
name: 'string.quoted.single.assembly.acme'
}
# absolut addressing/numbering (including lo/hibyte by < or >)
{
match: '\\#(\\>?\\<?\\(?\\$?\\w*\\)?|[^\\s]\\h?*)'
name: 'constant.numeric.hex.acme'
}
# hex, prefixed with dollar ($) or 0x
{
match: '\\$\\h+|0x\\h+'
name: 'constant.numeric.hex.acme'
}
# binary prefixed with %
{
match: '%[01]+|%[\\#\\.]+|0b[01]+|0b[\\#\\.]+'
name: 'constant.numeric.binary.acme'
}
# Float
{
match: '\\d*\\.\\d+\\b'
name: 'constant.numeric.float.acme'
}
# Decimal (but not float)
{
match: '\\b\\d+\\b'
name: 'constant.numeric.decimal.acme'
}
# Cctal
{
match: '&([0-7]+)\\b'
name: 'constant.numeric.octal.acme'
}
]
# assembler directives
directives:
patterns: [
# File and Symbol Control (pseudos)
{
match: '\\!(?i:source|src|pseudopc|zn|zone|to|bin(ary)?|symbollist|sl|initmem)\\b'
name: 'support.function.pseudo.acme'
}
# Parsing Control (more pseudos)
{
match: '\\!(?i:macro|cpu|al|as|rl|rs|8|by|byte|le16|be16|16|wo|word|le24|be24|24|le32|be32|32|hex|h|fill|fi|align|skip|ct|convtab|tx|text|pet|scr|scrxor|raw|address|addr)\\b'
name: 'support.function.pseudo.acme'
}
# Conditional Control
{
match: '\\!(?i:if|if(n)?def|for|do|set|warn|error|serious|eof|endoffile)\\b'
name: 'keyword.control.conditional.acme'
}
{
match: '(?i:while|until|else)\\b'
name: 'keyword.control.conditional.acme'
}
# Operators
{
match: '\\!|\\+|\\-|\\/|\\*|<<|>>|&|\\||\\^|=|<|>|\\:|\\|\\|'
name: 'keyword.operator'
}
# Operators II
{
match: '\\b(?i:and|not|mod|sh[lr]|x?or|eq|u?[gl]t)\\b'
name: 'keyword.operator.acme'
}
]