Grammar-Kit
Grammar-Kit copied to clipboard
False positive "Unresolved BNF References" for `<<eof>>` if `parserUtilClass` is set
Example: https://github.com/ant-druha/intellij-powershell/blob/7d804d118095392cc7d7f8d97bb0c3135285ca3c/src/main/resources/PowerShell.bnf#L156
Given
parserUtilClass="com.intellij.plugin.powershell.lang.parser.PowerShellGeneratedParserUtil"
Inspection reports at e.g. line:
private configuration_block_recover ::= !(statement_terminators? ('configuration' | <<eof>> | SQBR_L| statement_stop_tokens))
It seems inspection resolves from parserUtilClass only, without looking up in com.intellij.lang.parser.GeneratedParserUtilBase.
Versions: Build #IU-233.7784, built on September 21, 2023 org.jetbrains.idea.grammar (2022.3.2)
That could be workaround by PowerShellGeneratedParserUtil extends GeneratedParserUtilBase, but given that parser generator works fine without that, it would be nice to fix inspection as well.
UPD: Turns out bnf was incorrect indeed. It used parserImports=["static com.intellij.lang.parser.GeneratedParserUtilBase.*;"] trick.
I think the static import trick is ok. We need to fix the resolution algo...
Will submit MR shortly