language-65asm/grammars/acme.cson

136 lines
3.5 KiB
Plaintext
Raw Normal View History

# 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' }
2018-06-12 18:38:16 +00:00
# symbols, constants, numbers
{ include: '#symbols' }
]
# Repository starts here ------------------------------------------------------
repository:
# comments
comments:
patterns: [
# semicolon comments
{
match: ';.*$'
name: 'comment.line.semicolon.acme'
}
]
# symbols
symbols:
patterns: [
2018-06-12 18:38:16 +00:00
# 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'
2018-06-07 16:24:53 +00:00
name: 'string.quoted.double.acme'
}
{
2018-06-12 18:38:16 +00:00
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'
}
2018-06-12 18:38:16 +00:00
# hex, prefixed with dollar ($) or 0x
{
2018-06-12 18:38:16 +00:00
match: '\\$\\h+|0x\\h+'
name: 'constant.numeric.hex.acme'
}
# binary prefixed with %
{
2018-06-12 18:38:16 +00:00
match: '%[01]+|%[\\#\\.]+|0b[01]+|0b[\\#\\.]+'
name: 'constant.numeric.binary.acme'
}
2018-06-12 18:38:16 +00:00
# Float
{
2018-06-12 18:38:16 +00:00
match: '\\d*\\.\\d+\\b'
name: 'constant.numeric.float.acme'
}
# Decimal (but not float)
{
match: '\\b\\d+\\b'
name: 'constant.numeric.decimal.acme'
}
2018-06-12 18:38:16 +00:00
# Cctal
{
match: '&([0-7]+)\\b'
name: 'constant.numeric.octal.acme'
}
]
# assembler directives
directives:
patterns: [
2018-06-12 18:38:16 +00:00
# File and Symbol Control (pseudos)
{
2018-06-12 18:38:16 +00:00
match: '\\!(?i:source|src|pseudopc|zn|zone|to|bin(ary)?|symbollist|sl|initmem)\\b'
name: 'support.function.pseudo.acme'
}
2018-06-12 18:38:16 +00:00
# Parsing Control (more pseudos)
{
2018-06-12 18:38:16 +00:00
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'
}
2018-06-12 18:38:16 +00:00
# Conditional Control
{
2018-06-12 18:38:16 +00:00
match: '\\!(?i:if|if(n)?def|for|do|set|warn|error|serious|eof|endoffile)\\b'
2018-06-03 00:58:07 +00:00
name: 'keyword.control.conditional.acme'
}
{
2018-06-12 18:38:16 +00:00
match: '(?i:while|until|else)\\b'
name: 'keyword.control.conditional.acme'
}
# Operators
{
2018-06-12 18:38:16 +00:00
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'
}
]