Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

False positive "Unresolved BNF References" for <<eof>> if parserUtilClass is set #350

Open
VladRassokhin opened this issue Sep 21, 2023 · 4 comments

Comments

@VladRassokhin
Copy link

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)

@VladRassokhin
Copy link
Author

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.

@VladRassokhin
Copy link
Author

UPD: Turns out bnf was incorrect indeed. It used parserImports=["static com.intellij.lang.parser.GeneratedParserUtilBase.*;"] trick.

@gregsh
Copy link
Collaborator

gregsh commented Sep 21, 2023

I think the static import trick is ok. We need to fix the resolution algo...

@VladRassokhin
Copy link
Author

Will submit MR shortly

VladRassokhin added a commit to VladRassokhin/Grammar-Kit that referenced this issue Sep 21, 2023
…ratedParserUtilBase` if `parserUtilClass` does not inherit it

Fixes JetBrains#350
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants