| 1004 | } |
| 1005 | |
| 1006 | static LIST * apply_subscript( STACK * s ) |
| 1007 | { |
| 1008 | LIST * value = stack_top( s ); |
| 1009 | LIST * indices = stack_at( s, 1 ); |
| 1010 | LIST * result = L0; |
| 1011 | int32_t length = list_length( value ); |
| 1012 | string buf[ 1 ]; |
| 1013 | LISTITER indices_iter = list_begin( indices ); |
| 1014 | LISTITER const indices_end = list_end( indices ); |
| 1015 | string_new( buf ); |
| 1016 | for ( ; indices_iter != indices_end; indices_iter = list_next( indices_iter |
| 1017 | ) ) |
| 1018 | { |
| 1019 | LISTITER iter = list_begin( value ); |
| 1020 | LISTITER end = list_end( value ); |
| 1021 | subscript_t const subscript = parse_subscript( object_str( list_item( |
| 1022 | indices_iter ) ) ); |
| 1023 | get_iters( subscript, &iter, &end, length ); |
| 1024 | for ( ; iter != end; iter = list_next( iter ) ) |
| 1025 | result = list_push_back( result, object_copy( list_item( iter ) ) ); |
| 1026 | } |
| 1027 | string_free( buf ); |
| 1028 | return result; |
| 1029 | } |
| 1030 | |
| 1031 | |
| 1032 | /* |
no test coverage detected