fn parse_explain(&mut self) -> Result<Statement<Raw>, ParserError> {
        // (TYPED)?
        let typed = self.parse_keyword(TYPED);
        let mut timing = false;

        // options: ( '(' TIMING (true|false) ')' )?
        if let Some(Token::LParen) = self.peek_token() {
            // Check whether a valid option is after the parentheses, since the
            // parentheses may belong to the actual query to be explained.
            match self.peek_nth_token(1) {
                Some(Token::Keyword(TIMING)) => {
                    self.next_token(); // Consume the LParen
                    self.parse_comma_separated(|s| match s.expect_one_of_keywords(&[TIMING])? {
                        TIMING => {
                            timing = s.parse_boolean_value()?;
                            Ok(())
                        }
                        _ => unreachable!(),
                    })?;
                    self.expect_token(&Token::RParen)?;
                }
                _ => {}
            }
        }

        // (RAW | DECORRELATED | OPTIMIZED | PHYSICAL)? PLAN
        let stage =
            match self.parse_one_of_keywords(&[RAW, DECORRELATED, OPTIMIZED, PHYSICAL, PLAN]) {
                Some(RAW) => {
                    self.expect_keywords(&[PLAN, FOR])?;
                    ExplainStage::RawPlan
                }
                Some(DECORRELATED) => {
                    self.expect_keywords(&[PLAN, FOR])?;
                    ExplainStage::DecorrelatedPlan
                }
                Some(OPTIMIZED) => {
                    self.expect_keywords(&[PLAN, FOR])?;
                    ExplainStage::OptimizedPlan
                }
                Some(PLAN) => {
                    self.expect_keyword(FOR)?;
                    ExplainStage::OptimizedPlan
                }
                Some(PHYSICAL) => {
                    self.expect_keywords(&[PLAN, FOR])?;
                    ExplainStage::PhysicalPlan
                }
                None => ExplainStage::OptimizedPlan,
                _ => unreachable!(),
            };

        // VIEW view_name | query
        let explainee = if self.parse_keyword(VIEW) {
            Explainee::View(self.parse_object_name()?)
        } else {
            Explainee::Query(self.parse_query()?)
        };

        let options = ExplainOptions { typed, timing };
        Ok(Statement::Explain(ExplainStatement {
            stage,
            explainee,
            options,
        }))
    }
/// Parse an `EXPLAIN` statement, assuming that the `EXPLAIN` token
/// has already been consumed.
Parse an `EXPLAIN` statement, assuming that the `EXPLAIN` token
has already been consumed.
Parse an ` EXPLAIN ` statement assuming that the ` EXPLAIN ` token has already been consumed .
fn parse_explain(&mut self) -> Result<Statement<Raw>, ParserError> {
        // (TYPED)?
        let typed = self.parse_keyword(TYPED);
        let mut timing = false;
        // options: ( '(' TIMING (true|false) ')' )?
        if let Some(Token::LParen) = self.peek_token() {
            // Check whether a valid option is after the parentheses, since the
            // parentheses may belong to the actual query to be explained.
            match self.peek_nth_token(1) {
                Some(Token::Keyword(TIMING)) => {
                    self.next_token(); // Consume the LParen
                    self.parse_comma_separated(|s| match s.expect_one_of_keywords(&[TIMING])? {
                        TIMING => {
                            timing = s.parse_boolean_value()?;
                            Ok(())
                        }
                        _ => unreachable!(),
                    })?;
                    self.expect_token(&Token::RParen)?;
                }
                _ => {}
            }
        }
        // (RAW | DECORRELATED | OPTIMIZED | PHYSICAL)? PLAN
        let stage =
            match self.parse_one_of_keywords(&[RAW, DECORRELATED, OPTIMIZED, PHYSICAL, PLAN]) {
                Some(RAW) => {
                    self.expect_keywords(&[PLAN, FOR])?;
                    ExplainStage::RawPlan
                }
                Some(DECORRELATED) => {
                    self.expect_keywords(&[PLAN, FOR])?;
                    ExplainStage::DecorrelatedPlan
                }
                Some(OPTIMIZED) => {
                    self.expect_keywords(&[PLAN, FOR])?;
                    ExplainStage::OptimizedPlan
                }
                Some(PLAN) => {
                    self.expect_keyword(FOR)?;
                    ExplainStage::OptimizedPlan
                }
                Some(PHYSICAL) => {
                    self.expect_keywords(&[PLAN, FOR])?;
                    ExplainStage::PhysicalPlan
                }
                None => ExplainStage::OptimizedPlan,
                _ => unreachable!(),
            };
        // VIEW view_name | query
        let explainee = if self.parse_keyword(VIEW) {
            Explainee::View(self.parse_object_name()?)
        } else {
            Explainee::Query(self.parse_query()?)
        };
        let options = ExplainOptions { typed, timing };
        Ok(Statement::Explain(ExplainStatement {
            stage,
            explainee,
            options,
        }))
    }
fn parse_explain ( & mut self ) -> Result < Statement < Raw > , ParserError > { // (TYPED)? let typed = self . parse_keyword ( TYPED ) ; let mut timing = false ; // options: ( '(' TIMING (true|false) ')' )? if let Some ( Token :: LParen ) = self . peek_token ( ) { // Check whether a valid option is after the parentheses, since the // parentheses may belong to the actual query to be explained. match self . peek_nth_token ( 1 ) { Some ( Token :: Keyword ( TIMING ) ) => { self . next_token ( ) ; // Consume the LParen self . parse_comma_separated ( | s | match s . expect_one_of_keywords ( & [ TIMING ] ) ? { TIMING => { timing = s . parse_boolean_value ( ) ? ; Ok ( ( ) ) } _ => unreachable ! ( ) , } ) ? ; self . expect_token ( & Token :: RParen ) ? ; } _ => { } } } // (RAW | DECORRELATED | OPTIMIZED | PHYSICAL)? PLAN let stage = match self . parse_one_of_keywords ( & [ RAW , DECORRELATED , OPTIMIZED , PHYSICAL , PLAN ] ) { Some ( RAW ) => { self . expect_keywords ( & [ PLAN , FOR ] ) ? ; ExplainStage :: RawPlan } Some ( DECORRELATED ) => { self . expect_keywords ( & [ PLAN , FOR ] ) ? ; ExplainStage :: DecorrelatedPlan } Some ( OPTIMIZED ) => { self . expect_keywords ( & [ PLAN , FOR ] ) ? ; ExplainStage :: OptimizedPlan } Some ( PLAN ) => { self . expect_keyword ( FOR ) ? ; ExplainStage :: OptimizedPlan } Some ( PHYSICAL ) => { self . expect_keywords ( & [ PLAN , FOR ] ) ? ; ExplainStage :: PhysicalPlan } None => ExplainStage :: OptimizedPlan , _ => unreachable ! ( ) , } ; // VIEW view_name | query let explainee = if self . parse_keyword ( VIEW ) { Explainee :: View ( self . parse_object_name ( ) ? ) } else { Explainee :: Query ( self . parse_query ( ) ? ) } ; let options = ExplainOptions { typed , timing } ; Ok ( Statement :: Explain ( ExplainStatement { stage , explainee , options , } ) ) }
Parse an `EXPLAIN` statement, assuming that the `EXPLAIN` token
has already been consumed.
Parse an ` EXPLAIN ` statement assuming that the ` EXPLAIN ` token has already been consumed .
&mut self
&mut self