@@ -71,17 +71,14 @@ impl Parser {
7171 } else {
7272 self . parse_simple_statement ( )
7373 } ;
74- if stmt. is_ok ( ) {
75- body. push ( stmt. unwrap ( ) ) ;
76- } else {
77- self . errors . push ( stmt . err ( ) . unwrap ( ) ) ;
78- self . bump_any ( ) ;
74+ match stmt {
75+ Ok ( stmt ) => body. push ( stmt) ,
76+ Err ( err ) => {
77+ self . errors . push ( err) ;
78+ }
7979 }
8080 }
8181
82- for err in & self . errors {
83- println ! ( "{:#?}" , err) ;
84- }
8582
8683 Module {
8784 node : self . finish_node ( node) ,
@@ -234,6 +231,7 @@ impl Parser {
234231 Ok ( ( ) )
235232 }
236233
234+ // deprecated
237235 fn unepxted_token ( & mut self , node : Node , kind : Kind ) -> Result < ( ) , ParsingError > {
238236 self . bump_any ( ) ;
239237 let range = self . finish_node ( node) ;
@@ -249,7 +247,6 @@ impl Parser {
249247 Err ( err)
250248 }
251249
252- // write this like the expect function
253250 fn unexpected_token_new ( & mut self , node : Node , kinds : Vec < Kind > , advice : & str ) -> ParsingError {
254251 let curr_kind = self . cur_kind ( ) ;
255252 self . bump_any ( ) ;
@@ -1543,7 +1540,7 @@ impl Parser {
15431540 } else {
15441541 return Err ( self . unexpected_token_new (
15451542 import_node,
1546- vec ! [ Kind :: Identifier , Kind :: Mul ] ,
1543+ vec ! [ Kind :: Identifier , Kind :: Mul , Kind :: LeftParen ] ,
15471544 "Use * for importing everthing or use () to specify names to import or specify the name you want to import"
15481545 ) ) ;
15491546 }
0 commit comments