mirror of
https://github.com/Shopify/liquid.git
synced 2026-09-18 18:30:40 -07:00
remove old regexy lax_parse
This commit is contained in:
@@ -18,75 +18,6 @@ static VALUE rb_variable_allocate(VALUE klass)
|
|||||||
return obj;
|
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(®ex, "\\s*(((\"[^\"]*\"|'[^']*')|([^\\s,\\|'\"]|(\"[^\"]*\"|'[^']*'))+))(.*)", REG_EXTENDED | REG_ICASE);
|
|
||||||
// // regcomp(®ex, "\\s*((?:(?:\"[^\"]*\"|'[^']*')|(?:[^\\s,\\|'\"]|(?:\"[^\"]*\"|'[^']*'))+))(.*)", REG_ICASE | REG_ECMASCRIPT;
|
|
||||||
|
|
||||||
// reti = regexec(®ex, 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(®ex, "((|)|(\\s*(((\"[^\"]*\"|'[^']*')|([^\\s,\\|'\"]|(\"[^\"]*\"|'[^']*'))+)|(,))\\s*)+)", REG_EXTENDED | REG_ICASE);
|
|
||||||
// reti = regexec(®ex, cursor, 5, f_match, 0);
|
|
||||||
// regcomp(®ex_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(®ex, 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)
|
static int skip_whitespace(char * str, int len)
|
||||||
{
|
{
|
||||||
int i = 0; char * ptr = str;
|
int i = 0; char * ptr = str;
|
||||||
|
|||||||
Reference in New Issue
Block a user