As a self-exercise, I developed a simple assembler-like language. I'd like to add syntax highlighting for this in Atom. I have command, comments, and literals highlighting correctly, but for some reason my variables don't highlight.
Here is an example of the language:
# comment
cmd $v 1234 # comment
mov $ $v
Where $v
and $
are variables, and cmd
and mov
are commands.
Here is my .cson
for the highlighting:
'fileTypes': [
'yasa'
]
'scopeName': 'source.yasa'
'name': 'yasa'
'patterns': [
{
'comment':'command'
'match':'^[a-z]{3}'
'name':'support.function.builtin.yasa'
}
{
'comment':'variable'
'match':'\$[a-z]?'
'name':'variable.other.normal.yasa'
}
{
'comment':'literal'
'match':'[ 0-9]+'
'name':'constant.numeric.yasa'
}
{
'comment':'comment'
'match': '#.*'
'name':'comment.line.number-sign.yasa'
}
]
Everything works fine except the \$[a-z]?
in variable
. As I understand it, this should match the character $
literally, followed by 0 or 1 of any letter from a
to z
, which is what I need. Unfortunately there is not highlighting on the variables.