aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAleksey Kladov <[email protected]>2018-07-31 15:43:44 +0100
committerAleksey Kladov <[email protected]>2018-07-31 15:43:44 +0100
commitedf2b17a572b56371cfc29bbc3a686edcb12782c (patch)
tree44f07e4a5bbbc9f3de23e87a35b56b0b61a4dfda /src
parent9f87c9a3f927d3b7a3cbb92818c45c979ece693b (diff)
allow items inside blocks
Diffstat (limited to 'src')
-rw-r--r--src/parser/grammar/items/mod.rs21
1 files changed, 12 insertions, 9 deletions
diff --git a/src/parser/grammar/items/mod.rs b/src/parser/grammar/items/mod.rs
index 9147df87d..12bcf7924 100644
--- a/src/parser/grammar/items/mod.rs
+++ b/src/parser/grammar/items/mod.rs
@@ -248,16 +248,19 @@ fn fn_item(p: &mut Parser) {
248 while !p.at(EOF) && !p.at(R_CURLY) { 248 while !p.at(EOF) && !p.at(R_CURLY) {
249 match p.current() { 249 match p.current() {
250 LET_KW => let_stmt(p), 250 LET_KW => let_stmt(p),
251 _ => { 251 c => {
252 let expr_stmt = p.start(); 252 // test block_items
253 expressions::expr(p); 253 // fn a() { fn b() {} }
254 if p.eat(SEMI) { 254 if ITEM_FIRST.contains(c) {
255 expr_stmt.complete(p, EXPR_STMT); 255 item(p)
256 if p.at(R_CURLY) {
257 break;
258 }
259 } else { 256 } else {
260 expr_stmt.abandon(p); 257 let expr_stmt = p.start();
258 expressions::expr(p);
259 if p.eat(SEMI) {
260 expr_stmt.complete(p, EXPR_STMT);
261 } else {
262 expr_stmt.abandon(p);
263 }
261 } 264 }
262 } 265 }
263 } 266 }