remove old regexy lax_parse

This commit is contained in:
Isha
2014-02-28 20:07:21 +00:00
parent 111f24aad1
commit a119e86fd0

View File

@@ -18,75 +18,6 @@ static VALUE rb_variable_allocate(VALUE klass)
return obj;
}
// static void rb_variable_lax_parse(VALUE self, VALUE markup)
// {
// struct liquid_variable *variable;
// variable->markup = RSTRING_PTR(markup);
// variable->markup_len = RSTRING_LEN(markup);
// regex_t regex, regex_f_args;
// int reti;
// regmatch_t match[3], f_match[5], f_arg_match[5];
// regcomp(&regex, "\\s*(((\"[^\"]*\"|'[^']*')|([^\\s,\\|'\"]|(\"[^\"]*\"|'[^']*'))+))(.*)", REG_EXTENDED | REG_ICASE);
// // regcomp(&regex, "\\s*((?:(?:\"[^\"]*\"|'[^']*')|(?:[^\\s,\\|'\"]|(?:\"[^\"]*\"|'[^']*'))+))(.*)", REG_ICASE | REG_ECMASCRIPT;
// reti = regexec(&regex, variable->markup, 3, match, 0);
// if( !reti ){
// /* Extract name */
// // printf("\nWith the whole expression, a matched substring %.*s is found at position %d to %d. "
// // " and rest at %.*s is found at position %d to %d.\n",
// // match[1].rm_eo - match[1].rm_so, &variable->markup[match[1].rm_so], match[1].rm_so, match[1].rm_eo,
// // match[2].rm_eo - match[2].rm_so, &variable->markup[match[2].rm_so], match[2].rm_so, match[2].rm_eo);
// variable->name = &variable->markup[match[1].rm_so];
// variable->name_len = match[1].rm_eo - match[1].rm_so;
// rb_iv_set(self, "@name", rb_str_new(variable->name, variable->name_len));
// /* Extract filters */
// char * cursor = &variable->markup[match[2].rm_so]; int size = match[2].rm_eo - match[2].rm_so;
// while (cursor++ < &variable->markup[match[2].rm_eo]) {
// if (*cursor == ' ' || *cursor == '\n' || *cursor == '\f' || *cursor == '\t' || *cursor == '\r' || *cursor == '\v') continue;
// else if (*cursor == '|') {
// while (cursor++ < &variable->markup[match[2].rm_eo])
// if (*cursor == ' ' || *cursor == '\n' || *cursor == '\f' || *cursor == '\t' || *cursor == '\r' || *cursor == '\v') continue;
// else goto filters_present;
// } else return;
// }
// filters_present:
// if (cursor < &variable->markup[match[2].rm_eo]) {
// regcomp(&regex, "((|)|(\\s*(((\"[^\"]*\"|'[^']*')|([^\\s,\\|'\"]|(\"[^\"]*\"|'[^']*'))+)|(,))\\s*)+)", REG_EXTENDED | REG_ICASE);
// reti = regexec(&regex, cursor, 5, f_match, 0);
// regcomp(&regex_f_args, "((:)|(,))\\s*((\\w+\\s*\\:\\s*)?((\"[^\"]*\"|'[^']*')|([^\\s,\\|'\"]|(\"[^\"]*\"|'[^']*'))+))", REG_EXTENDED | REG_ICASE);
// if ( !reti ) {
// VALUE filters_array = rb_ary_new();
// int i = 1;
// while(i < 5) {
// // VALUE filter_data = rb_ary_new();
// char * filter = f_match[i].rm_so;
// // get filtername
// // get filter args into an array
// // regexec(&regex, filter, 3, f_arg_match, 0);
// rb_ary_push(filters_array, ID2SYM(rb_intern(filter)));
// // rb_ary_push(filters_array, filter_data);
// i++;
// }
// rb_iv_set(self, "@filters", filters_array);
// }
// }
// }
// }
static int skip_whitespace(char * str, int len)
{
int i = 0; char * ptr = str;