Skip to content

Syntax Highlighting generation with antlr? #272

Closed Answered by mike-lischke
sschneider-ihre-pvs asked this question in Q&A
Discussion options

You must be logged in to vote

The answer heavily depends on the IDE for which syntax highlighting is to be implemented. In fact each IDE has its own rules. VS Code for example uses a declarative approach in the standard highlighter (Monarch) that is driven by a JSON file with regex patterns. So, ANTLR or any of its grammars aren't involved at all there.

But there's also semantic highlighting on top of syntax highlighting, which can make use of an ANTLR based lexer (to know the token types). But still this is not something that can be done in a generic way, unless all lexer would return the same token types (which might be possible for some standard types like strings, comments and identifiers), but usually a language …

Replies: 1 comment 2 replies

Comment options

You must be logged in to vote
2 replies
@sschneider-ihre-pvs
Comment options

@mike-lischke
Comment options

Answer selected by mike-lischke
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
2 participants