diff options
Diffstat (limited to 'src/grammar/expressions.rs')
-rw-r--r-- | src/grammar/expressions.rs | 29 |
1 files changed, 19 insertions, 10 deletions
diff --git a/src/grammar/expressions.rs b/src/grammar/expressions.rs index 423e1a95a..c68419929 100644 --- a/src/grammar/expressions.rs +++ b/src/grammar/expressions.rs | |||
@@ -229,18 +229,27 @@ fn block_expr(p: &mut Parser) -> CompletedMarker { | |||
229 | while !p.at(EOF) && !p.at(R_CURLY) { | 229 | while !p.at(EOF) && !p.at(R_CURLY) { |
230 | match p.current() { | 230 | match p.current() { |
231 | LET_KW => let_stmt(p), | 231 | LET_KW => let_stmt(p), |
232 | c => { | 232 | _ => { |
233 | // test block_items | 233 | // test block_items |
234 | // fn a() { fn b() {} } | 234 | // fn a() { fn b() {} } |
235 | if items::ITEM_FIRST.contains(c) { | 235 | let m = p.start(); |
236 | items::item(p) | 236 | match items::maybe_item(p) { |
237 | } else { | 237 | items::MaybeItem::Item(kind) => { |
238 | let expr_stmt = p.start(); | 238 | m.complete(p, kind); |
239 | expressions::expr(p); | 239 | } |
240 | if p.eat(SEMI) { | 240 | items::MaybeItem::Modifiers => { |
241 | expr_stmt.complete(p, EXPR_STMT); | 241 | m.abandon(p); |
242 | } else { | 242 | p.error("expected an item"); |
243 | expr_stmt.abandon(p); | 243 | } |
244 | // test pub_expr | ||
245 | // fn foo() { pub 92; } //FIXME | ||
246 | items::MaybeItem::None => { | ||
247 | expressions::expr(p); | ||
248 | if p.eat(SEMI) { | ||
249 | m.complete(p, EXPR_STMT); | ||
250 | } else { | ||
251 | m.abandon(p); | ||
252 | } | ||
244 | } | 253 | } |
245 | } | 254 | } |
246 | } | 255 | } |