You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
If I follow the tutorial, I get something like the following error message.
MyTokenType.; or MyTokenType.or expected, got 'bad'
I think this is strange to read. In contrast to the tutorial, most plugins I looked at don't override toString(). As a result, we get the following error message.
';' or or expected, got 'bad'
This would look much better if the keyword or had been quoted. GeneratedParserUtilBase.ErrorState.appendExpected(…) does not quote or because it starts like a valid Java identifier (which seems a little arbitrary to me).
I'm currently not aware of any possibility to put or in quotation marks? Do I miss something? If not, I would suggest extending the API to allow to override the text used for a token in error messages. As a positive side effect, this would also allow to decouple the error message from the token name in the PSI structure (where the prefix from the tutorial is actually helpful). What do you think about that?
EDIT: I already thought about prefixing keywords with "\u2060" (Word Joiner) in toString() as a workaround. However, I am not sure if this is appropriate or might cause other problems.
The text was updated successfully, but these errors were encountered:
Let's consider the following grammar.
And the following input.
If I follow the tutorial, I get something like the following error message.
I think this is strange to read. In contrast to the tutorial, most plugins I looked at don't override
toString()
. As a result, we get the following error message.This would look much better if the keyword
or
had been quoted.GeneratedParserUtilBase.ErrorState.appendExpected(…)
does not quoteor
because it starts like a valid Java identifier (which seems a little arbitrary to me).I'm currently not aware of any possibility to put
or
in quotation marks? Do I miss something? If not, I would suggest extending the API to allow to override the text used for a token in error messages. As a positive side effect, this would also allow to decouple the error message from the token name in the PSI structure (where the prefix from the tutorial is actually helpful). What do you think about that?EDIT: I already thought about prefixing keywords with
"\u2060"
(Word Joiner) intoString()
as a workaround. However, I am not sure if this is appropriate or might cause other problems.The text was updated successfully, but these errors were encountered: