For the plugin I am working on I would like to be able to throw very specific parse errors.
For example, lets say an if statement in my programming language looks like this:
if (1 < 2) do
If someone were to write the if statement like this:
if (1 < 2)
SonarQube will trigger a generic parse error which shows the line where the parsing has failed.
I would like to be able to say in this parse error that the programmer has forgotten the keyword “do”.
Is there any way to do this? Can I, for example, look at how far the tree has currently been generated and determine based on existing nodes which node is missing?