]> Kevux Git Server - fll/commitdiff
Bugfix: process quotes at the start of a basic object
authorKevin Day <kevin@kevux.org>
Fri, 16 Mar 2012 21:54:24 +0000 (16:54 -0500)
committerKevin Day <kevin@kevux.org>
Fri, 16 Mar 2012 21:54:24 +0000 (16:54 -0500)
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.

level_1/fl_fss/c/fss_basic.c

index d587c989d334c6d75b1cb6a93cae8c3ea9a0e709..79fc160d3a45e32590b9a9c865edc9f3c938c4eb 100644 (file)
@@ -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++;