I'm writing a language service with MPF, and I already have basic syntax highlighting working, but I'd like to also add semantic highlighting.
C# does this for type names, for example. The color of an identifier is different when it's naming a type; even the same word in the same statement may be highlighted differently based on context.
The language I'm supporting has very complex rules for contextual keywords, so I'd like to rely on something higher-level than a tokenizer to distinguish between identifiers and keywords. Right now my scanner is just marking every possible keyword as a keyword, even though they may be identifiers in context.
How can I achieve this? Is there any example source code from another language service that does this?