fn parse_list_while(
        &mut self,
        parse_item: &Fn(&mut Self) -> S::R,
        predicate: &Fn(&Self) -> bool,
    ) -> S::R {
        let mut items = vec![];
        loop {
            if self.peek_token_kind() == TokenKind::EndOfFile || !predicate(self) {
                break;
            };

            let lexer_before = self.lexer().clone();
            let result = parse_item(self);
            // ERROR RECOVERY: If the item is was parsed as 'missing', then it means
            // the parser bailed out of that scope. So, pass on whatever's been
            // accumulated so far, but with a 'Missing' SyntaxNode prepended.
            if result.is_missing() {
                items.push(result);
                break;
            } else
            // INFINITE LOOP PREVENTION: If parse_item does not actually make
            // progress, just bail
            if lexer_before.start() == self.lexer().start()
                && lexer_before.offset() == self.lexer().offset()
            {
                items.push(result);
                break;
            } else
            // Or if nothing's wrong, continue.
            {
                items.push(result)
            }
        }
        S!(make_list, self, Box::new(items), self.pos())
    }
// Parse with parse_item while a condition is met.
Parse with parse_item while a condition is met.
Parse with parse_item while a condition is met .
fn parse_list_while(
        &mut self,
        parse_item: &Fn(&mut Self) -> S::R,
        predicate: &Fn(&Self) -> bool,
    ) -> S::R {
        let mut items = vec![];
        loop {
            if self.peek_token_kind() == TokenKind::EndOfFile || !predicate(self) {
                break;
            };
            let lexer_before = self.lexer().clone();
            let result = parse_item(self);
            // ERROR RECOVERY: If the item is was parsed as 'missing', then it means
            // the parser bailed out of that scope. So, pass on whatever's been
            // accumulated so far, but with a 'Missing' SyntaxNode prepended.
            if result.is_missing() {
                items.push(result);
                break;
            } else
            // INFINITE LOOP PREVENTION: If parse_item does not actually make
            // progress, just bail
            if lexer_before.start() == self.lexer().start()
                && lexer_before.offset() == self.lexer().offset()
            {
                items.push(result);
                break;
            } else
            // Or if nothing's wrong, continue.
            {
                items.push(result)
            }
        }
        S!(make_list, self, Box::new(items), self.pos())
    }
fn parse_list_while ( & mut self , parse_item : & Fn ( & mut Self ) -> S :: R , predicate : & Fn ( & Self ) -> bool , ) -> S :: R { let mut items = vec ! [ ] ; loop { if self . peek_token_kind ( ) == TokenKind :: EndOfFile || ! predicate ( self ) { break ; } ; let lexer_before = self . lexer ( ) . clone ( ) ; let result = parse_item ( self ) ; // ERROR RECOVERY: If the item is was parsed as 'missing', then it means // the parser bailed out of that scope. So, pass on whatever's been // accumulated so far, but with a 'Missing' SyntaxNode prepended. if result . is_missing ( ) { items . push ( result ) ; break ; } else // INFINITE LOOP PREVENTION: If parse_item does not actually make // progress, just bail if lexer_before . start ( ) == self . lexer ( ) . start ( ) && lexer_before . offset ( ) == self . lexer ( ) . offset ( ) { items . push ( result ) ; break ; } else // Or if nothing's wrong, continue. { items . push ( result ) } } S ! ( make_list self Box new ( items ) self pos ( ) ) }
Parse with parse_item while a condition is met.
Parse with parse_item while a condition is met .
&mut self
parse_item
&Fn(&mut Self) -> S::R
predicate
&Fn(&Self) -> bool
&mut self
parse_item
&Fn(&mut Self) -> S::R
predicate
&Fn(&Self) -> bool