File tree Expand file tree Collapse file tree 2 files changed +19
-23
lines changed
Expand file tree Collapse file tree 2 files changed +19
-23
lines changed Original file line number Diff line number Diff line change @@ -197,10 +197,10 @@ fn parse_source(state: &mut ParserState<'_>) -> eyre::Result<Source<Pos>> {
197197fn parse_where_clause ( state : & mut ParserState < ' _ > ) -> eyre:: Result < Option < Where < Pos > > > {
198198 state. skip_whitespace ( ) ?;
199199
200- if let Some ( sym) = state. look_ahead ( ) ? {
201- if sym != & Sym :: Keyword ( Keyword :: Where ) {
202- return Ok ( None ) ;
203- }
200+ if let Some ( sym) = state. look_ahead ( ) ?
201+ && sym != & Sym :: Keyword ( Keyword :: Where )
202+ {
203+ return Ok ( None ) ;
204204 }
205205
206206 let pos = state. pos ( ) ;
@@ -290,17 +290,17 @@ fn parse_expr_single(state: &mut ParserState<'_>) -> eyre::Result<Expr<Pos>> {
290290
291291 let mut params = Vec :: new ( ) ;
292292
293- if let Some ( sym) = state. look_ahead ( ) ? {
294- if sym != & Sym :: RParens {
293+ if let Some ( sym) = state. look_ahead ( ) ?
294+ && sym != & Sym :: RParens
295+ {
296+ params. push ( parse_expr_single ( state) ?) ;
297+ state. skip_whitespace ( ) ?;
298+
299+ while let Some ( Sym :: Comma ) = state. look_ahead ( ) ? {
300+ state. shift ( ) ?;
301+ state. skip_whitespace ( ) ?;
295302 params. push ( parse_expr_single ( state) ?) ;
296303 state. skip_whitespace ( ) ?;
297-
298- while let Some ( Sym :: Comma ) = state. look_ahead ( ) ? {
299- state. shift ( ) ?;
300- state. skip_whitespace ( ) ?;
301- params. push ( parse_expr_single ( state) ?) ;
302- state. skip_whitespace ( ) ?;
303- }
304304 }
305305 }
306306
Original file line number Diff line number Diff line change @@ -35,11 +35,9 @@ impl<'a> Lexer<'a> {
3535 _ if c. is_ascii_whitespace ( ) => {
3636 self . text . shift ( ) ;
3737
38- while let Some ( c) = self . text . look_ahead ( ) {
39- if !c. is_ascii_whitespace ( ) {
40- break ;
41- }
42-
38+ while let Some ( c) = self . text . look_ahead ( )
39+ && c. is_ascii_whitespace ( )
40+ {
4341 self . text . shift ( ) ;
4442 }
4543
@@ -115,11 +113,9 @@ impl<'a> Lexer<'a> {
115113 ident. push ( c) ;
116114 self . text . shift ( ) ;
117115
118- while let Some ( c) = self . text . look_ahead ( ) {
119- if !c. is_ascii_alphanumeric ( ) && c != '_' {
120- break ;
121- }
122-
116+ while let Some ( c) = self . text . look_ahead ( )
117+ && ( c. is_ascii_alphanumeric ( ) || c == '_' )
118+ {
123119 ident. push ( c) ;
124120 self . text . shift ( ) ;
125121 }
You can’t perform that action at this time.
0 commit comments