How to make same token type syntax hightlight with different styles?


I've defind two statements in bnf grammar file. and I want to syntax highlight IDENTIFIER with two different style, but I have no idea how to do this, please help…

more detail here:

NamespaceDefinition ::= 'namespace' IDENTIFIER
IncludeDefinition ::= 'include' IDENTIFIER

But how to map each token to distinct TextAttributesKey? As IElementType is returned by the jflex lexer, which means that I have to return different token type in my flex file, the only way I know is to use the lexer states:

  {IDENTIFIER} {return TYPE1;}

But you told me not to use it if only for highlight purpose?

Sorry I didn't find the way to do so at:


Please sign in to leave a comment.