From d564d2ad46f6d25d814c22f28c344f3adf418e12 Mon Sep 17 00:00:00 2001 From: compudj Date: Wed, 14 Jun 2006 13:25:20 +0000 Subject: [PATCH] quotes for filter git-svn-id: http://ltt.polymtl.ca/svn@1931 04897980-b3bd-0310-b5e0-8ef037075253 --- ltt/branches/poly/lttv/lttv/filter.c | 38 +++++++++++++++++++++++----- 1 file changed, 32 insertions(+), 6 deletions(-) diff --git a/ltt/branches/poly/lttv/lttv/filter.c b/ltt/branches/poly/lttv/lttv/filter.c index 6b42249e..e1066eee 100644 --- a/ltt/branches/poly/lttv/lttv/filter.c +++ b/ltt/branches/poly/lttv/lttv/filter.c @@ -1279,6 +1279,8 @@ lttv_filter_update(LttvFilter* filter) { /* simple expression buffer */ LttvSimpleExpression* a_simple_expression = lttv_simple_expression_new(); + + gint nest_quotes = 0; /* * Parse entire expression and construct @@ -1320,7 +1322,28 @@ lttv_filter_update(LttvFilter* filter) { for(i=0;iexpression);i++) { // debug // g_print("%c\n ",filter->expression[i]); - + if(nest_quotes) { + switch(filter->expression[i]) { + case '\\' : + if(filter->expression[i+1] == '\"') { + i++; + } + break; + case '\"': + nest_quotes = 0; + i++; + break; + } + if(a_string_spaces->len != 0) { + a_field_component = g_string_append( + a_field_component, a_string_spaces->str); + a_string_spaces = g_string_set_size(a_string_spaces, 0); + } + a_field_component = g_string_append_c(a_field_component, + filter->expression[i]); + continue; + } + switch(filter->expression[i]) { /* * logical operators @@ -1563,21 +1586,24 @@ lttv_filter_update(LttvFilter* filter) { } break; case ' ': /* keep spaces that are within a field component */ - if(a_field_component->len == 0) break; /* ignore */ + if(a_field_component->len == 0) break; /* ignore */ else a_string_spaces = g_string_append_c(a_string_spaces, filter->expression[i]); case '\n': /* ignore */ break; + case '\"': + nest_quotes?(nest_quotes=0):(nest_quotes=1); + break; default: /* concatening current string */ - if(a_string_spaces->len != 0) { + if(a_string_spaces->len != 0) { a_field_component = g_string_append( a_field_component, a_string_spaces->str); a_string_spaces = g_string_set_size(a_string_spaces, 0); - } - a_field_component = g_string_append_c(a_field_component, - filter->expression[i]); + } + a_field_component = g_string_append_c(a_field_component, + filter->expression[i]); } } -- 2.34.1