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

Creates parser that uses wrong fieldname when referencing field causing CS1001 #4538

Open
4 tasks done
mrt181 opened this issue Feb 23, 2024 · 1 comment
Open
4 tasks done

Comments

@mrt181
Copy link

mrt181 commented Feb 23, 2024

  • I have reproduced my issue using the latest version of ANTLR
  • I have asked at github
  • Responses from the above seem to indicate that my issue could be an ANTLR bug
  • I have done a search of the existing issues to make sure I'm not sending in a duplicate

I am using this file (had to add .txt to it to upload it here):
SqlBase.g4.txt

This creates the SqlBaseParser with Error CS1001 : Identifier expected on line 7895.

	((DereferenceContext)_localctx).base = _prevctx;

The field that should be referenced is on line 7097

	public PrimaryExpressionContext @base;

Updating line 7895 to @base fixes the compile error.
Updating the grammer file to use base_ instead of base fixes the compile error. (kaby76/Antlr4BuildTasks#81)

@ericvergnaud
Copy link
Contributor

Hi, thanks for this.
I prefer the latter because it's simpler, but it does end up increasing the set of forbidden keywords, notably when targeting multiple languages.

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