You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This restriction has the consequences in the following examples:
// This is parsed as `S` as the condition, followed by the consequent block, followed by an empty block.// Fails because `S` is a type, not a bool value.ifS{}{}// This is parsed as `x==S` as the condition, followed by the consequent block, followed by an empty block.// Fails because `S` is a type, not a value.if x == S{}{}// This fails to parse because colons are not valid syntax in a block.ifS{field1:i32}{}
Need to double check that the existing parts are covered correctly and completely.
Make it clearer how this is a "sticky" state, and that this state gets reset or removed in various places.
One particularly odd part is parse_expr_opt which drops all restrictions.
Where this restriction "ends" probably hasn't been done intentionally (or at least with broad awareness), so we'll need to decide what should be documented.
It would be good to link the _except_ grammar suffixes to expr.struct.brace-restricted-positions.
It might be good for expr.struct.brace-restricted-positions to have a note explaining why the restriction exists, and to show an example.
I do not think it is practical to encode this in the grammar, though others may disagree. Essentially we'd have to duplicate the majority of the Expression grammar with things like ExpressionNoStructLiteral, and duplicate every sub-rule. I'm concerned that would be duplicating a huge amount of the grammar, but also that it is not sustainable since there are other restrictions that would cause an explosion of permutations.
The
Restrictions::NO_STRUCT_LITERAL
restriction could be better documented. Currently we have:_except [StructExpression]_
to show where this limitation goes into effect.expr.struct.brace-restricted-positions
briefly touches on it.This restriction has the consequences in the following examples:
This was introduced with RFC 92.
Various things to consider:
parse_expr_opt
which drops all restrictions._except_
grammar suffixes toexpr.struct.brace-restricted-positions
.expr.struct.brace-restricted-positions
to have a note explaining why the restriction exists, and to show an example.I do not think it is practical to encode this in the grammar, though others may disagree. Essentially we'd have to duplicate the majority of the
Expression
grammar with things likeExpressionNoStructLiteral
, and duplicate every sub-rule. I'm concerned that would be duplicating a huge amount of the grammar, but also that it is not sustainable since there are other restrictions that would cause an explosion of permutations.See #569 for the previous issue for this.
The text was updated successfully, but these errors were encountered: