language-65asm/grammars/wdc-directives.cson

115 lines
3.4 KiB
Plaintext
Raw Normal View History

2018-03-22 21:03:41 +00:00
# Syntax Highlighting for the Western Design Center toolchain directives
scopeName: 'source.wdc-directives'
patterns: [
2018-06-03 02:12:44 +00:00
{ include: '#comments' }
{ include: '#symbols' } # symbols, constants, numbers
{ include: '#directives' }
2018-03-22 21:03:41 +00:00
]
# Repository starts here ------------------------------------------------------
repository:
# comments
comments:
patterns: [
# semicolon comments
{
match: ';.*$'
name: 'comment.line.semicolon.wdc-toolchain'
}
]
# symbols
symbols:
patterns: [
# strings
{
begin: '"'
beginCaptures:
0:
name: 'punctuation.definition.string.begin.wdc-toolchain'
end: '"'
endCaptures:
0:
name: 'punctuation.definition.string.end.wdc-toolchain'
2018-06-07 16:24:53 +00:00
name: 'string.quoted.double.wdc-toolchain'
2018-03-22 21:03:41 +00:00
}
2018-06-07 15:15:47 +00:00
# absolut addressing/numbers
2018-03-22 21:03:41 +00:00
{
match: '\\#(\'.\'|[^\\s\']+)'
name: 'constant.numeric.hex.wdc-toolchain'
}
2018-06-07 15:15:47 +00:00
# hex, prefixed with dollar sign($)
2018-03-22 21:03:41 +00:00
{
2018-06-07 16:24:53 +00:00
match: '-?\\$\\b[a-fA-F0-9]+\\b'
2018-03-22 21:03:41 +00:00
name: 'constant.numeric.hex.wdc-toolchain'
}
# hex, suffixed with h(h)
{
2018-06-07 15:15:47 +00:00
match: '-?\\b([a-fA-F0-9]+)h'
2018-03-22 21:03:41 +00:00
name: 'constant.numeric.hex.wdc-toolchain'
}
# binary prefixed with %
{
match: '%[01]+'
name: 'constant.numeric.binary.wdc-toolchain'
}
# binary suffixed with B
{
match: '[01]+(?i:b)'
name: 'constant.numeric.binary.wdc-toolchain'
}
# octal and decimal
{
2018-06-07 15:15:47 +00:00
match: '\\b([0-9]+[doq]?)\\b'
2018-03-22 21:03:41 +00:00
name: 'constant.numeric.decimal.wdc-toolchain'
}
]
# assembler directives
directives:
patterns: [
# File and Symbol control
{
2018-06-07 15:15:47 +00:00
match: '\\b(?i:append|include|insert|end(s|mod)?|exit|module|section|ref_only|org|origin|equ(al)?|gequ|defl|set|var|extern(al|s)?|xref|globals?|public|xdef|message|messg|efunc|incdebug)\\b'
2018-03-22 21:03:41 +00:00
name: 'support.function.pseudo.wdc-toolchain'
}
# Parsing control
{
match: '\\b(?i:case|chip|chkimmed|comment|dbreg|dpage|long[ai]|radix|spaces|llchar|bit7|mask|squote|twochar|asc(ii)?|fcc|date|da|d?byte|d(ef)?b|fcb|string|dc|d(ef)?w|fdb|l?word|dl|longw?|blk[blw]|defs|ds(a|b|l|w)?|rmb|apwdc|float|double)\\b'
name: 'support.function.pseudo.wdc-toolchain'
}
# Macro control
{
match: '\\b(?i:macro|endm|macend|argchk|macfirst|macdelim|macexit|ifma|ifnma|rept|endr)\\b'
name: 'support.function.pseudo.wdc-toolchain'
}
# Conditional control
{
match: '\\b(?i:end(c|if)?|cond|ifn?(false|true|z|abs|rel|def|diff|same|ext|page0)?|if(long|short)[ai]|ifmatch|else)\\b'
name: 'keyword.control.conditional.wdc-toolchain'
}
# Listing control
{
match: '\\b(?i:pl|pw|top|heading|nam|title|s?ttl|subtitle|subttl|eject|page?|(no?)?list|(inc|asc|cond|m(ac)?|mn)list|pass1)\\b'
name: 'support.function.pseudo.wdc-toolchain'
}
# Pre-defined sections
{
match: '\\b(?i:page0|code|(k|u)?data)\\b'
name: 'constant.other.wdc-toolchain'
}
# Operators
{
match: '!|\\+|\\-|\\/|\\*|<<|>>|&|\\||\\^|=|<|>|\\:|\\|\\|'
name: 'keyword.operator.wdc-toolchain'
}
# Operators II
{
2018-06-07 15:15:47 +00:00
match: '\\.\\b(?i:and|not|mod|sh[lr]|x?or|eq|u?[gl]t)\\b\\.'
2018-03-22 21:03:41 +00:00
name: 'keyword.operator.wdc-toolchain'
}
]