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

Incorrect grammar for BlockExpression #1230

Closed
eggyal opened this issue Jun 15, 2022 · 1 comment
Closed

Incorrect grammar for BlockExpression #1230

eggyal opened this issue Jun 15, 2022 · 1 comment

Comments

@eggyal
Copy link

eggyal commented Jun 15, 2022

The grammar for BlockExpression is currently given as:

BlockExpression :
   {
      InnerAttribute*
      Statements?
   }

Statements :
      Statement+
   | Statement+ ExpressionWithoutBlock
   | ExpressionWithoutBlock

According to this grammar, the final operand of a BlockExpression (if present) can only be an ExpressionWithoutBlock. But surely this is not correct: it can be any Expression—i.e. including an ExpressionWithBlock.

For example, using the documented grammar to parse {{ 0 }} as a BlockExpression would result in the inner { 0 } block being a Statement within the outer block rather than its final operand; a consequence of this would be that such a statement must have unit type per the documentation of Expression statements; and even if a different type was permitted, its value would not be that of the outer block per the documentation of BlockExpression.

@ehuss
Copy link
Contributor

ehuss commented Jun 22, 2022

Thanks for the report! Yea, the grammar isn't quite capturing what the "final operand" is, as answering that is a little complicated. I believe this is a duplicate of #762, so closing in favor of that.

@ehuss ehuss closed this as not planned Won't fix, can't repro, duplicate, stale Jun 22, 2022
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