I am trying to implement language support plugin for a basic language. I am following jetbrains's tutorial for simple language support (.properties file support basically) and on the side I have rust plugin for reference. However the complexity gap between them is huge so some questions are hard to find answers to from both sources.
Here is my question: What is the best way to allow spaces between tokens which DO NOT require spaces, however force spacing between tokens which do?
i.e. class Foo{ <- here first space is mandatory, but the second one (before '{' symbol) can be ommited.
That is a task for the Parser, not the Lexer. In fact the Lexer lexes the whitespaces but does not pass them to the Parser. To enforce or not enforce the whitespaces in your example you need to implement a
.bnffile with the Grammar-Kit extension https://github.com/JetBrains/Grammar-Kit.