Open BorderCloud opened 4 years ago
I found this function in the project antlr4 :
protected void reportInputMismatch(Parser recognizer,
InputMismatchException e)
{
String msg = "mismatched input "+getTokenErrorDisplay(e.getOffendingToken())+
" expecting "+e.getExpectedTokens().toString(recognizer.getVocabulary());
recognizer.notifyErrorListeners(e.getOffendingToken(), msg, e);
}
This function builds the description of PsiErrorElement.
Is it possible to add the function getExpectedTokens(offset) somewhere in your project ?
Or a method to read this list of tokens in my CompletionContributor class ?
You could try https://github.com/mike-lischke/antlr4-c3, which has a Java port. I might be possible to plug this library to a CompletionContributor
.
Thanks, it works with https://github.com/mike-lischke/antlr4-c3/blob/master/ports/java/src/main/java/com/vmware/antlr4c3/CodeCompletionCore.java
I will try to implement a basic list of token for the moment.
It's a very good idea to plug this library to a CompletionContributor :100:
I tested... May be I used bad this class but sometimes, there are not responses :(
Hello
I have difficulty to use the functions generated by ANTLR4 for Intellij. I searched in the doc but It's not clear.
What is the name of the function to call to have the possible rules and tokens in function of offset in the file ? I see the error messages with the possible rules and tokens but I didn't found the good function to call.
I don't know if ANTLR4 for Intellij can generate the LL1 tools for my language. Have you examples of CompletionContributor class that use the basic completion tool and the LL1 tool ?
My code:
Thanks