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

partial implementation of object field access leaves valid method invocations on non-primary expressions marked as ERROR #28

Open
janw4ld opened this issue Jan 13, 2025 · 0 comments · May be fixed by #32

Comments

@janw4ld
Copy link
Contributor

janw4ld commented Jan 13, 2025

This issue is marginally related to parenthesized_expressions, the grammar you've defined separates expression kinds into

  • _prefix_expression which are expressions with fields accessible by . on them, and
  • _expression which are the general / complex expression that evaluate to simpler values

and defines a dotted_identifier lexeme that consists of _prefix_expression followed by '.' then identifier.

Note

the distinction between simple and complex expressions is more formally known as "expressions" for the general case vs "primary expressions" for the grammar's atoms

this definition results in the following parser shortcomings

  • field access on complex expressions parsing as an ERROR despite being valid groovy code
    image

  • no support for parsing field access with a runtime evaluated string subscript -only identifier, so although the code below is a valid groovy expr that subscripts the range 1..3 with each normally, after i've implemented field access on general _expressions, the code is parsed as a function call with a null identifier and ("ea"+"ch") as its argument list.
    image

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

Successfully merging a pull request may close this issue.

1 participant