I’m now developing a grammar package for a typesetting language named SATySFi. SATySFi has several states, two of which are program state and inline state, and transition between states is made by a dedicated syntax. For example, an opening brace {
in a program state starts an inline state and the corresponding }
resumes a program state.
In my Atom package, I want to highlight keywords like let
in program state but not in inline state because let
in inline state is just an English verb. Same can be said for other stuff like integer numerals.
I tried to make a prototype for this context-sensitive feature (see the CSON below). However, this grammar still scopes let
in inline state as keyword.other.satysfi
. I understand the reason but this is not what I want. I’m looking for how to deactivate/exclude the program state grammar in inline state part and is it possible?
scopeName: "source.satysfi"
name: "SATySFi"
fileTypes: [
"saty"
]
patterns: [
{
include: "#programState"
}
{
include: "#inlineState"
}
]
repository:
programState:
patterns: [
{
begin: "\\{"
beginCaptures:
0:
name: "punctuation.transition.program-to-inline.begin.satysfi"
end: "\\}"
endCaptures:
0:
name: "punctuation.transition.program-to-inline.end.satysfi"
patterns: [
include: "#inlineState"
]
}
{
match: "\\blet\\b"
name: "keyword.other.satysfi"
}
]
inlineState:
patterns: [
# grammar for inline state here.
]