fn split_symbol_components(varname: &str) -> Vec<&str> {
    let mut components: Vec<&str> = Vec::new();

    for component in varname.split('.') {
        if let Some(idx) = component.find('[') {
            // "array_field[5][6]" -> "array_field", "[5][6]"
            let (name, indexstring) = component.split_at(idx);
            components.push(name);
            components.extend(indexstring.split_inclusive(']'));
        } else {
            components.push(component);
        }
    }

    components
}
// split the symbol into components
// e.g. "my_struct.array_field[5][6]" -> [ "my_struct", "array_field", "[5]", "[6]" ]
split the symbol into components
e.g.
split the symbol into components e . g .
fn split_symbol_components(varname: &str) -> Vec<&str> {
    let mut components: Vec<&str> = Vec::new();
    for component in varname.split('.') {
        if let Some(idx) = component.find('[') {
            // "array_field[5][6]" -> "array_field", "[5][6]"
            let (name, indexstring) = component.split_at(idx);
            components.push(name);
            components.extend(indexstring.split_inclusive(']'));
        } else {
            components.push(component);
        }
    }
    components
}
fn split_symbol_components ( varname : & str ) -> Vec < & str > { let mut components : Vec < & str > = Vec :: new ( ) ; for component in varname . split ( '.' ) { if let Some ( idx ) = component . find ( '[' ) { // "array_field[5][6]" -> "array_field", "[5][6]" let ( name , indexstring ) = component . split_at ( idx ) ; components . push ( name ) ; components . extend ( indexstring . split_inclusive ( ']' ) ) ; } else { components . push ( component ) ; } } components }
split the symbol into components
e.g.
split the symbol into components e . g .
varname
&str