Example #1
0
SRL_STATIC_INLINE void
srl_parse_array(pTHX_ srl_path_t *path, int expr_idx, SV *route)
{
    int range[3];
    const char *loc_str;
    STRLEN loc_len;
    SV *loc;

    assert(route != NULL);
    assert(expr_idx >= 0);
    assert(expr_idx <= av_len(path->expr));
    assert(srl_iterator_stack(aTHX_ path->iter) != NULL);

    loc = *av_fetch(path->expr, expr_idx, 0);
    loc_str = SvPV(loc, loc_len);

    if (is_all(loc_str, loc_len)) {                                                     // *
        srl_parse_array_all(aTHX_ path, expr_idx, route);
    } else if (is_number(loc_str, loc_len)) {                                           // [10]
        srl_parse_array_item(aTHX_ path, expr_idx, route, atoi(loc_str));
    } else if (is_list(loc_str, loc_len)) {                                             // [0,1,2]
        srl_parse_array_list(aTHX_ path, expr_idx, route, loc_str, loc_len);
    } else if (is_range(loc_str, loc_len, (int*) &range)) {                             // [start:stop:step]
        srl_parse_array_range(aTHX_ path, expr_idx, route, (int*) &range);
    }
}
Example #2
0
/**
 * retourne le type du token 
 * @param chaine le token à analyser
 * @return un entier correspondant au type du token
 * 
 */
int get_type(char* chaine) {
    if (is_hexa32(chaine))
        return HEXA32;
    if (is_hexa8(chaine))
        return HEXA8;
    if (is_objet(chaine))
	return OBJET;
    if (is_reg(chaine))
	return REG;
    if (is_range(chaine))
	return RANGE;
    if (is_integer32(chaine))
	return INTEGER32;
    if (is_integer8(chaine))
	return INTEGER8;
    return UNKNOWN;
}
Example #3
0
int * _is_range(const char *str, STRLEN len, int *out) {
    return is_range(str, len, out);
}