aboutsummaryrefslogtreecommitdiff
path: root/crates/libsyntax2/src/grammar
diff options
context:
space:
mode:
authorAleksey Kladov <[email protected]>2018-08-25 14:04:47 +0100
committerAleksey Kladov <[email protected]>2018-08-25 14:04:47 +0100
commit367e523442520a1ff9050210ee2573ac1abe4b25 (patch)
tree89d535ef0d429747c087bed1b3c1f25676d5c8dc /crates/libsyntax2/src/grammar
parenta80c07bdffc8aa9e1645339c004c12c94e60e402 (diff)
Require semi after exprs
Diffstat (limited to 'crates/libsyntax2/src/grammar')
-rw-r--r--crates/libsyntax2/src/grammar/expressions/mod.rs11
1 files changed, 8 insertions, 3 deletions
diff --git a/crates/libsyntax2/src/grammar/expressions/mod.rs b/crates/libsyntax2/src/grammar/expressions/mod.rs
index 922d9f871..fb702a398 100644
--- a/crates/libsyntax2/src/grammar/expressions/mod.rs
+++ b/crates/libsyntax2/src/grammar/expressions/mod.rs
@@ -51,10 +51,15 @@ pub(crate) fn block(p: &mut Parser) {
51 // fn foo() { pub 92; } //FIXME 51 // fn foo() { pub 92; } //FIXME
52 items::MaybeItem::None => { 52 items::MaybeItem::None => {
53 let is_blocklike = expressions::expr_stmt(p) == BlockLike::Block; 53 let is_blocklike = expressions::expr_stmt(p) == BlockLike::Block;
54 if p.eat(SEMI) || (is_blocklike && !p.at(R_CURLY)) { 54 if p.at(R_CURLY) {
55 m.complete(p, EXPR_STMT);
56 } else {
57 m.abandon(p); 55 m.abandon(p);
56 } else {
57 if is_blocklike {
58 p.eat(SEMI);
59 } else {
60 p.expect(SEMI);
61 }
62 m.complete(p, EXPR_STMT);
58 } 63 }
59 } 64 }
60 } 65 }