/// Take lexemes only if the predicate is true, then returns it.
Take lexemes only if the predicate is true, then returns it.
Take lexemes only if the predicate is true then returns it .
pub fn take_if(&mut self, predicate: impl Fn(&Lexeme) -> bool) -> Option<&Lexeme> {
        if self.index < self.lexemes.len() && predicate(&self.lexemes[self.index]) {
            let lexeme = &self.lexemes[self.index];
            self.index.increment();
            return Some(lexeme);
        }
        None
    }
pub fn take_if ( & mut self , predicate : impl Fn ( & Lexeme ) -> bool ) -> Option < & Lexeme > { if self . index < self . lexemes . len ( ) && predicate ( & self . lexemes [ self . index ] ) { let lexeme = & self . lexemes [ self . index ] ; self . index . increment ( ) ; return Some ( lexeme ) ; } None }
Take lexemes only if the predicate is true, then returns it.
Take lexemes only if the predicate is true then returns it .
&mut self
predicate
impl Fn(&Lexeme) -> bool