pub fn consume_token(&mut self, expected: &Token) -> Result<bool, ParserError> {
        match self.peek_token() {
            Some(ref t) => {
                if *t == *expected {
                    self.next_token();
                    Ok(true)
                } else {
                    Ok(false)
                }
            }
            other => parser_err!(format!("expected token {:?} but was {:?}", expected, other,)),
        }
    }
/// Consume the next token if it matches the expected token, otherwise return an error
Consume the next token if it matches the expected token, otherwise return an error
Consume the next token if it matches the expected token otherwise return an error
pub fn consume_token(&mut self, expected: &Token) -> Result<bool, ParserError> {
        match self.peek_token() {
            Some(ref t) => {
                if *t == *expected {
                    self.next_token();
                    Ok(true)
                } else {
                    Ok(false)
                }
            }
            other => parser_err!(format!("expected token {:?} but was {:?}", expected, other,)),
        }
    }
pub fn consume_token ( & mut self , expected : & Token ) -> Result < bool , ParserError > { match self . peek_token ( ) { Some ( ref t ) => { if * t == * expected { self . next_token ( ) ; Ok ( true ) } else { Ok ( false ) } } other => parser_err ! ( format ( " " expected other ) ) , } }
Consume the next token if it matches the expected token, otherwise return an error
Consume the next token if it matches the expected token otherwise return an error
&mut self
expected
&Token
&mut self
expected
&Token