fn extract_para_type_str(args: &str) -> anyhow::Result<(Vec<(SolidityType, bool)>, usize)> {
        let args_trim = args.trim();
        let mut indexed_count = 1;
        if args_trim.is_empty() {
            return Ok((vec![], indexed_count));
        }
        let mut ret_vec = vec![];
        let paras = args_trim.split(',').collect_vec();
        for para in paras {
            let para_trim = para.trim();
            if para_trim.is_empty() {
                return Err(anyhow!(PARSE_ERR_MSG));
            }
            let mut index_flag = false;
            let mut para_type_str = para_trim;
            if let Some(stripped_indexed) = para_trim.strip_suffix("indexed") {
                let stripped_trimmed = stripped_indexed.trim();
                if stripped_trimmed.ends_with(']')
                    || stripped_trimmed.len() < stripped_indexed.len()
                {
                    index_flag = true;
                    indexed_count += 1;
                    para_type_str = stripped_trimmed;
                } else {
                    return Err(anyhow!(PARSE_ERR_MSG));
                }
            }
            let ty = SolidityType::parse(para_type_str)?;
            ret_vec.push((ty, index_flag));
        }
        Ok((ret_vec, indexed_count))
    }
/// Generate pairs of solidity type and location and the number of indexed parameters
Generate pairs of solidity type and location and the number of indexed parameters
Generate pairs of solidity type and location and the number of indexed parameters
fn extract_para_type_str(args: &str) -> anyhow::Result<(Vec<(SolidityType, bool)>, usize)> {
        let args_trim = args.trim();
        let mut indexed_count = 1;
        if args_trim.is_empty() {
            return Ok((vec![], indexed_count));
        }
        let mut ret_vec = vec![];
        let paras = args_trim.split(',').collect_vec();
        for para in paras {
            let para_trim = para.trim();
            if para_trim.is_empty() {
                return Err(anyhow!(PARSE_ERR_MSG));
            }
            let mut index_flag = false;
            let mut para_type_str = para_trim;
            if let Some(stripped_indexed) = para_trim.strip_suffix("indexed") {
                let stripped_trimmed = stripped_indexed.trim();
                if stripped_trimmed.ends_with(']')
                    || stripped_trimmed.len() < stripped_indexed.len()
                {
                    index_flag = true;
                    indexed_count += 1;
                    para_type_str = stripped_trimmed;
                } else {
                    return Err(anyhow!(PARSE_ERR_MSG));
                }
            }
            let ty = SolidityType::parse(para_type_str)?;
            ret_vec.push((ty, index_flag));
        }
        Ok((ret_vec, indexed_count))
    }
fn extract_para_type_str ( args : & str ) -> anyhow :: Result < ( Vec < ( SolidityType , bool ) > , usize ) > { let args_trim = args . trim ( ) ; let mut indexed_count = 1 ; if args_trim . is_empty ( ) { return Ok ( ( vec ! [ ] , indexed_count ) ) ; } let mut ret_vec = vec ! [ ] ; let paras = args_trim . split ( ',' ) . collect_vec ( ) ; for para in paras { let para_trim = para . trim ( ) ; if para_trim . is_empty ( ) { return Err ( anyhow ! ( PARSE_ERR_MSG ) ) ; } let mut index_flag = false ; let mut para_type_str = para_trim ; if let Some ( stripped_indexed ) = para_trim . strip_suffix ( " " ) { let stripped_trimmed = stripped_indexed . trim ( ) ; if stripped_trimmed . ends_with ( ']' ) || stripped_trimmed . len ( ) < stripped_indexed . len ( ) { index_flag = true ; indexed_count += 1 ; para_type_str = stripped_trimmed ; } else { return Err ( anyhow ! ( PARSE_ERR_MSG ) ) ; } } let ty = SolidityType :: parse ( para_type_str ) ? ; ret_vec . push ( ( ty , index_flag ) ) ; } Ok ( ( ret_vec , indexed_count ) ) }
Generate pairs of solidity type and location and the number of indexed parameters
Generate pairs of solidity type and location and the number of indexed parameters
args
&str