From: Kevin Day Date: Fri, 16 Mar 2012 21:54:24 +0000 (-0500) Subject: Bugfix: process quotes at the start of a basic object X-Git-Tag: 0.3.0~72 X-Git-Url: https://git.kevux.org/?a=commitdiff_plain;h=6f7ddf1634857f8c4b6517360b3801191045040b;p=fll Bugfix: process quotes at the start of a basic object This was overlooked. If the first character is a single quote or a double quote, then it must be delimited. If the first character is a slash, followed by any number of slashes and then followed by a single or double quote, then all slashes and the quote must be delimited. Starting slashed that are not followed by a single or double quote must not be delimited. --- diff --git a/level_1/fl_fss/c/fss_basic.c b/level_1/fl_fss/c/fss_basic.c index d587c98..79fc160 100644 --- a/level_1/fl_fss/c/fss_basic.c +++ b/level_1/fl_fss/c/fss_basic.c @@ -337,6 +337,57 @@ extern "C"{ object_position.start = object->used; object_position.stop = object->used; + if (input.string[input_position.start] == f_fss_delimit_slash) { + f_string_length delimit_slash_count = 0; + + while (input_position.start <= input_position.stop) { + if (input.string[input_position.start] == f_fss_delimit_placeholder) { + input_position.start++; + continue; + } else if (input.string[input_position.start] != f_fss_delimit_slash) { + break; + } + + object->string[object_position.stop] = input.string[input_position.start]; + object_position.stop++; + delimit_slash_count++; + input_position.start++; + } // while + + if (input.string[input_position.start] == f_fss_delimit_single_quote || input.string[input_position.start] == f_fss_delimit_double_quote) { + pre_allocate_size += delimit_slash_count + 1; + + if (pre_allocate_size > object->size) { + f_resize_dynamic_string(status, (*object), pre_allocate_size + f_fss_default_allocation_step); + + if (f_macro_test_for_allocation_errors(status)) return status; + } + + while (delimit_slash_count > 0) { + object->string[object_position.stop] = f_fss_delimit_slash; + object_position.stop++; + delimit_slash_count--; + } // while + + object->string[object_position.stop] = input.string[input_position.start]; + object_position.stop++; + input_position.start++; + } + } else if (input.string[input_position.start] == f_fss_delimit_single_quote || input.string[input_position.start] == f_fss_delimit_double_quote) { + pre_allocate_size++; + + if (pre_allocate_size > object->size) { + f_resize_dynamic_string(status, (*object), pre_allocate_size + f_fss_default_allocation_step); + + if (f_macro_test_for_allocation_errors(status)) return status; + } + + object->string[object_position.stop] = f_fss_delimit_slash; + object->string[object_position.stop + 1] = input.string[input_position.start]; + object_position.stop += 2; + input_position.start++; + } + while (input_position.start <= input_position.stop) { if (input.string[input_position.start] == f_fss_delimit_placeholder) { input_position.start++;