Use a better way of skipping SEMIs

This commit is contained in:
DJMcNab 2018-12-20 18:39:38 +00:00
parent dc1c64f5b9
commit 1d1950336f

View file

@ -42,14 +42,15 @@ pub(crate) fn block(p: &mut Parser) {
} }
let m = p.start(); let m = p.start();
p.bump(); p.bump();
while !p.at(EOF) && !p.at(R_CURLY) {
match p.current() {
LET_KW => let_stmt(p),
// test nocontentexpr // test nocontentexpr
// fn foo(){ // fn foo(){
// ;;;some_expr();;;;{;;;};;;;Ok(()) // ;;;some_expr();;;;{;;;};;;;Ok(())
// } // }
while p.eat(SEMI) {} SEMI => p.bump(),
while !p.at(EOF) && !p.at(R_CURLY) {
match p.current() {
LET_KW => let_stmt(p),
_ => { _ => {
// test block_items // test block_items
// fn a() { fn b() {} } // fn a() { fn b() {} }
@ -94,7 +95,6 @@ pub(crate) fn block(p: &mut Parser) {
} }
} }
} }
while p.eat(SEMI) {}
} }
p.expect(R_CURLY); p.expect(R_CURLY);
m.complete(p, BLOCK); m.complete(p, BLOCK);