fn parse_func_param_declaration(&mut self) -> Result<SymbolTableEntry, Box<dyn Error>> {
        let (data_type, comp_symbol_entry) = self.parse_type()?;

        if data_type == DataType::VOID {
            return Err("Unable to define function parameters with void type.".into());
        }

        let ident = self.match_token(TokenType::IDENT)?;

        let mut sym = SymbolTableEntry::new(
            // TODO: Parse datatype
            data_type,
            0,
            ident.lexeme.clone(),
            0,
            SymType::VARIABLE,
            SymClass::PARAM,
        );
        sym.type_sym = comp_symbol_entry;

        match &self.current_token {
            Some(token) => {
                match token.token_type {
                    TokenType::RPAREN => {
                        // Let caller consume the RPAREN
                    }
                    TokenType::COMMA => {
                        // If there are more declarations to parse, keep going
                        self.consume()?;
                        let next_sym = self.parse_func_param_declaration()?;
                        sym.add_to_list(next_sym);
                    }
                    _ => return Err("Missing ',' or ';' after declaration".into()),
                }
            }
            None => return Err("Missing ',' or ';' after declaration".into()),
        }

        Ok(sym)
    }
// Parse param list in function
// We require these parameters as these tokens should have
// been scanned prior to invocation of this function
Parse param list in function
We require these parameters as these tokens should have
been scanned prior to invocation of this function
Parse param list in function We require these parameters as these tokens should have been scanned prior to invocation of this function
fn parse_func_param_declaration(&mut self) -> Result<SymbolTableEntry, Box<dyn Error>> {
        let (data_type, comp_symbol_entry) = self.parse_type()?;
        if data_type == DataType::VOID {
            return Err("Unable to define function parameters with void type.".into());
        }
        let ident = self.match_token(TokenType::IDENT)?;
        let mut sym = SymbolTableEntry::new(
            // TODO: Parse datatype
            data_type,
            0,
            ident.lexeme.clone(),
            0,
            SymType::VARIABLE,
            SymClass::PARAM,
        );
        sym.type_sym = comp_symbol_entry;
        match &self.current_token {
            Some(token) => {
                match token.token_type {
                    TokenType::RPAREN => {
                        // Let caller consume the RPAREN
                    }
                    TokenType::COMMA => {
                        // If there are more declarations to parse, keep going
                        self.consume()?;
                        let next_sym = self.parse_func_param_declaration()?;
                        sym.add_to_list(next_sym);
                    }
                    _ => return Err("Missing ',' or ';' after declaration".into()),
                }
            }
            None => return Err("Missing ',' or ';' after declaration".into()),
        }
        Ok(sym)
    }
fn parse_func_param_declaration ( & mut self ) -> Result < SymbolTableEntry , Box < dyn Error > > { let ( data_type , comp_symbol_entry ) = self . parse_type ( ) ? ; if data_type == DataType :: VOID { return Err ( " " . into ( ) ) ; } let ident = self . match_token ( TokenType :: IDENT ) ? ; let mut sym = SymbolTableEntry :: new ( // TODO: Parse datatype data_type , 0 , ident . lexeme . clone ( ) , 0 , SymType :: VARIABLE , SymClass :: PARAM , ) ; sym . type_sym = comp_symbol_entry ; match & self . current_token { Some ( token ) => { match token . token_type { TokenType :: RPAREN => { // Let caller consume the RPAREN } TokenType :: COMMA => { // If there are more declarations to parse, keep going self . consume ( ) ? ; let next_sym = self . parse_func_param_declaration ( ) ? ; sym . add_to_list ( next_sym ) ; } _ => return Err ( " " . into ( ) ) , } } None => return Err ( " " . into ( ) ) , } Ok ( sym ) }
Parse param list in function
We require these parameters as these tokens should have
been scanned prior to invocation of this function
Parse param list in function We require these parameters as these tokens should have been scanned prior to invocation of this function
&mut self