rust-lang / wg-grammar

Where the work of WG-grammar, aiming to provide a canonical grammar for Rust, resides
Apache License 2.0
99 stars 20 forks source link

Proper handling of `;` between statements. #55

Open ehuss opened 5 years ago

ehuss commented 5 years ago

For example, it currently allows multiple expressions without ; separators which is not correct. It will need to handle the difference of expressions with/without blocks needing ;, etc.

Also consider if Stmt should include macro invocation. Currently it is inherited via expression. Why does rustc parse statement macros separately from expressions (parse_stmt_without_recovery)?

petrochenkov commented 5 years ago

This is an open question, especially when macros are involved. I'll try to finish https://github.com/rust-lang/rust/issues/61733 and come up with some consistent/improved rules.

petrochenkov commented 5 years ago

Tentatively, ; should be a part of the statement syntax and free ;s should be (empty) statements as well.