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
cue/parser: allow if as a label for a required field
The field `if!: 123` resulted in a parse error because
the token `if` followed by `!` was understood as the start of
a comprehension with a negated expression, like:
if !boolexpr { ... }
To differentiate the two cases, we need to check if the following
token is ':', meaning that we are declaring a required field.
Teach the parser how to peek one token past the current one.
As a reminder, the CUE language allows using keywords as labels.
All other keywords already worked and had tests, including for
required fields; only `if` was broken for the reason outlined above.
Change-Id: I1ea9f3b82499b9c9b5e896c1d3857be86d7ca2b8
Signed-off-by: haoqixu <[email protected]>
Co-authored-by: Daniel Martí <[email protected]>
Signed-off-by: Daniel Martí <[email protected]>
Reviewed-on: https://review.gerrithub.io/c/cue-lang/cue/+/1209287
TryBot-Result: CUEcueckoo <[email protected]>
Reviewed-by: Paul Jolly <[email protected]>
Unity-Result: CUE porcuepine <[email protected]>
0 commit comments