mirror of
https://github.com/carbon-language/carbon-lang.git
synced 2026-09-28 22:02:37 +01:00
In #3064, code was changed to look at a future token. This is an issue because the parser is set up to enforce that tokens aren't used without being consumed. That's part of #3118; related validation fails. Also, since it's not necessarily the open paren that was consumed, it could be a different opening symbol, which the closing symbol handling doesn't check. Under this approach, it's tracked whether an open paren was consumed, and the open paren is associated with the state. That's more aligned with how the parser expects to be fed information. In paren condition handling for if and while, I'm also adding some special casing for `if {` in particular to not assume the `{` is a struct. I just think that this will come up somewhat often and the resulting output is better this way (an error either way). I'm not doing similar with `for` because there's already some `var` handling there, and I'd need a little more time to think about structure -- whereas right now I'm just trying to fix the crashes (`if {}`, `if []`, etc). Fixes #3118