I'm implementing a language that has the identical implementation of the C #define directive, and I want to implement something like that in my plugin but find it pretty difficult. So basically what I want is simply to replace all variables that were defined in a #define definition with their value and only then do all the processing (lexing, parsing, highlighting, etc).
I tried to update the content of the file in ParserDefinition#createFile(), but it's not very happy with. I also tried to play with the lexer position to always "go back" and read from the directive definition, this also didn't help.
I'm not sure that's the best approach. If you have a better idea of how to implement C directive (specifically #define), that would be awesome.