]> Kevux Git Server - fll/commitdiff
Bugfix: Get the FSS Embedded List Read working as expected based on runtime tests.
authorKevin Day <Kevin@kevux.org>
Sat, 7 Sep 2024 00:09:52 +0000 (19:09 -0500)
committerKevin Day <Kevin@kevux.org>
Sat, 7 Sep 2024 06:14:35 +0000 (01:14 -0500)
A good portion of clean ups and design changes to address special cases or anything overlooked.
The runtime tests now pass as expected.

There are still some situations that need to be fixed.

25 files changed:
level_1/fl_fss/c/fss/embedded_list.c
level_1/fl_fss/c/private-fss.c
level_2/fll_fss/c/fss/embedded_list.c
level_3/fss_embedded_list_read/c/private-print.c
level_3/fss_embedded_list_read/c/private-print.h
level_3/fss_embedded_list_read/c/private-read.c
level_3/fss_embedded_list_read/tests/runtime/fss_0008/expect/test-0003-object_space-content-select-0.expect
level_3/fss_embedded_list_read/tests/runtime/fss_0008/expect/test-0003-object_space-content-trim.expect
level_3/fss_embedded_list_read/tests/runtime/fss_0008/expect/test-0003-object_space-content.expect
level_3/fss_embedded_list_read/tests/runtime/fss_0008/expect/test-0003-object_space-object_and_content-at-0.expect
level_3/fss_embedded_list_read/tests/runtime/fss_0008/expect/test-0003-object_space-object_and_content-at-1.expect
level_3/fss_embedded_list_read/tests/runtime/fss_0008/expect/test-0003-object_space-object_and_content-line-6.expect
level_3/fss_embedded_list_read/tests/runtime/fss_0008/expect/test-0003-object_space-object_and_content-name--select-0.expect
level_3/fss_embedded_list_read/tests/runtime/fss_0008/expect/test-0003-object_space-object_and_content-name-.expect
level_3/fss_embedded_list_read/tests/runtime/fss_0008/expect/test-0003-object_space-object_and_content-name-a-original-empty.expect
level_3/fss_embedded_list_read/tests/runtime/fss_0008/expect/test-0003-object_space-object_and_content-name-a-original.expect
level_3/fss_embedded_list_read/tests/runtime/fss_0008/expect/test-0003-object_space-object_and_content-name-a-select-0.expect
level_3/fss_embedded_list_read/tests/runtime/fss_0008/expect/test-0003-object_space-object_and_content-name-a.expect
level_3/fss_embedded_list_read/tests/runtime/fss_0008/expect/test-0003-object_space-object_and_content-name-привет_has_space-select-0.expect
level_3/fss_embedded_list_read/tests/runtime/fss_0008/expect/test-0003-object_space-object_and_content-original.expect
level_3/fss_embedded_list_read/tests/runtime/fss_0008/expect/test-0003-object_space-object_and_content-select-0-original.expect
level_3/fss_embedded_list_read/tests/runtime/fss_0008/expect/test-0003-object_space-object_and_content-select-0.expect
level_3/fss_embedded_list_read/tests/runtime/fss_0008/expect/test-0003-object_space-object_and_content-trim.expect
level_3/fss_embedded_list_read/tests/runtime/fss_0008/expect/test-0003-object_space-object_and_content.expect
level_3/fss_extended_list_read/c/private-print.c

index 48c7293af49ce7370e8339606687d3ba97fbe344..2c667ef8fc180a9645f509fdb04449209ac76e04 100644 (file)
@@ -60,11 +60,8 @@ extern "C" {
     f_array_length_t slash_last = 0;
     f_array_length_t before_list_open = position_previous;
 
-    // Designate that this is the first graph character.
-    // 0x0 = false, 0x1 = true, 0x2 = false, but there is a delimited comment, comment_delimit is set.
-    uint8_t graph_first = 0x1;
-    uint8_t is_open = F_false;
-    uint8_t is_object = F_false;
+    // 0x0 = is false for all, 0x1 = is first graph, 0x2 = is delimited comment, 0x4 = is open, 0x8 = is object, 0x10 = is delimited close.
+    uint8_t is_state = 0x1;
 
     // Initialize depth 1 start position.
     // Positions_start.used is used as a max depth (such that positions_start.used == max depth + 1).
@@ -87,33 +84,20 @@ extern "C" {
       }
 
       if (buffer.string[range->start] == f_fss_eol_s.string[0]) {
-        if (graph_first == 0x2) {
+        if (is_state & 0x2) {
           status = f_array_lengths_increase(state.step_small, delimits);
           if (F_status_is_error(status)) break;
 
           delimits->array[delimits->used++] = comment_delimit;
         }
 
-        newline_last = range->start;
-        position_previous = range->start++;
-        graph_first = 0x1;
+        newline_last = position_previous = range->start++;
         line_start = range->start;
-
-        if (depth) {
-          private_macro_fl_fss_nest_return_on_overflow((buffer), (*range), (*found), (*delimits), delimits_used, (*comments), comments_used, positions_start, objects, slashes, F_end_not_nest_eos, F_end_not_nest_stop);
-        }
-        else {
-          private_macro_fl_fss_nest_return_on_overflow_delimited((buffer), (*range), (*found), positions_start, objects, slashes, F_none_eos, F_none_stop);
-        }
-
-        continue;
+        is_state = 0x1;
       }
-
-      if (buffer.string[range->start] == f_fss_delimit_slash_s.string[0]) {
-        slash_first = range->start;
-        slash_last = range->start;
+      else if (buffer.string[range->start] == f_fss_delimit_slash_s.string[0] && (is_state & 0x1)) {
+        slash_first = slash_last = position_previous = range->start++;
         slashes.array[depth] = 1;
-        position_previous = range->start++;
 
         for (; range->start <= range->stop && range->start < buffer.used && (buffer.string[range->start] == f_fss_delimit_placeholder_s.string[0] || buffer.string[range->start] == f_fss_delimit_slash_s.string[0]); ++range->start) {
 
@@ -135,14 +119,7 @@ extern "C" {
           }
         } // for
 
-        if (F_status_is_error(status)) break;
-
-        if (depth) {
-          private_macro_fl_fss_nest_return_on_overflow((buffer), (*range), (*found), (*delimits), delimits_used, (*comments), comments_used, positions_start, objects, slashes, F_end_not_nest_eos, F_end_not_nest_stop);
-        }
-        else {
-          private_macro_fl_fss_nest_return_on_overflow((buffer), (*range), (*found), (*delimits), delimits_used, (*comments), comments_used, positions_start, objects, slashes, F_data_not_eos, F_data_not_stop);
-        }
+        if (F_status_is_error(status) || range->start >= buffer.used || range->start > range->stop) break;
 
         // All slashes for an open are delimited (because it could represent a slash in the object name).
         // For example 'object {' = valid open, name 'object', 'object \{' represents 'object {', 'object \\{' = valid open, name 'object \', 'object \\\{' represents 'object \{', etc..
@@ -150,25 +127,23 @@ extern "C" {
         // For example '}' = valid close, '\}' represents '}', '\\}' represents '\}', '\\\}' represents '\\}', '\\\\}' represents '\\\}', and so on..
         // When slash is odd and a (delimited) valid open/close is found, then save delimited positions and continue.
         if (buffer.string[range->start] == f_fss_eol_s.string[0]) {
-          if (graph_first == 0x2) {
+          if (is_state & 0x2) {
             status = f_array_lengths_increase(state.step_small, delimits);
             if (F_status_is_error(status)) break;
 
             delimits->array[delimits->used++] = comment_delimit;
           }
 
-          newline_last = range->start;
-          position_previous = range->start++;
+          newline_last = position_previous = range->start++;
           line_start = range->start;
-          graph_first = 0x1;
+          is_state = 0x1;
         }
         else if (buffer.string[range->start] == f_fss_embedded_list_open_s.string[0] || buffer.string[range->start] == f_fss_embedded_list_close_s.string[0]) {
           before_list_open = position_previous;
-          is_open = F_false;
-          graph_first = 0x0;
+          is_state &= ~0x15;
 
           if (buffer.string[range->start] == f_fss_embedded_list_open_s.string[0]) {
-            is_open = F_true;
+            is_state |= 0x4;
           }
 
           position_previous = range->start++;
@@ -185,20 +160,7 @@ extern "C" {
               }
             }
 
-            if (buffer.string[range->start] == f_fss_eol_s.string[0]) {
-              if (graph_first == 0x2) {
-                status = f_array_lengths_increase(state.step_small, delimits);
-                if (F_status_is_error(status)) break;
-
-                delimits->array[delimits->used++] = comment_delimit;
-              }
-
-              newline_last = range->start;
-              line_start = range->start + 1;
-              graph_first = 0x1;
-
-              break;
-            }
+            if (buffer.string[range->start] == f_fss_eol_s.string[0]) break;
 
             if (buffer.string[range->start] != f_fss_delimit_placeholder_s.string[0]) {
               status = f_fss_is_space(state, buffer, *range);
@@ -211,23 +173,21 @@ extern "C" {
             if (F_status_is_error(status)) break;
           } // while
 
-          if (F_status_is_error(status)) break;
-
-          if (depth) {
-            private_macro_fl_fss_nest_return_on_overflow((buffer), (*range), (*found), (*delimits), delimits_used, (*comments), comments_used, positions_start, objects, slashes, F_end_not_nest_eos, F_end_not_nest_stop);
-          }
-          else {
-            private_macro_fl_fss_nest_return_on_overflow((buffer), (*range), (*found), (*delimits), delimits_used, (*comments), comments_used, positions_start, objects, slashes, F_data_not_eos, F_data_not_stop);
-          }
+          if (F_status_is_error(status) || range->start >= buffer.used || range->start > range->stop) break;
 
           // This is a valid object open/close that has been delimited, save the slash delimit positions.
           if (buffer.string[range->start] == f_fss_eol_s.string[0]) {
             newline_last = range->start;
-            line_start = range->start + 1;
-            graph_first = 0x1;
+            line_start = newline_last + 1;
+
+            if (is_state & 0x4) {
+              if (slashes.array[depth] % 2 == 0) {
+                is_state |= 0x8;
+              }
+              else {
+                is_state &= ~0x8;
+              }
 
-            if (is_open) {
-              is_object = slashes.array[depth] % 2 == 0 ? F_true : F_false;
               range->start = slash_first;
 
               status = f_array_lengths_increase_by((slashes.array[depth] / 2) + 1, delimits);
@@ -249,22 +209,25 @@ extern "C" {
               } // while
 
               // When slashes are even, the object is valid and needs to be processed.
-              if (is_object) {
+              if (is_state & 0x8) {
                 if (++depth >= objects.size) {
                   status = f_string_ranges_resize(depth + 2, &objects);
-                  if (F_status_is_error(status)) break;
                 }
 
                 if (depth >= positions_start.size) {
-                  status = f_array_lengths_resize(depth + 2, &positions_start);
-                  if (F_status_is_error(status)) break;
+                  if (F_status_is_error_not(status)) {
+                    status = f_array_lengths_resize(depth + 2, &positions_start);
+                  }
                 }
 
                 if (depth >= slashes.size) {
-                  status = f_array_lengths_resize(depth + 2, &slashes);
-                  if (F_status_is_error(status)) break;
+                  if (F_status_is_error_not(status)) {
+                    status = f_array_lengths_resize(depth + 2, &slashes);
+                  }
                 }
 
+                if (F_status_is_error(status)) break;
+
                 objects.array[depth].start = line_start;
                 objects.array[depth].stop = before_list_open;
                 positions_start.array[depth] = newline_last + 1;
@@ -284,25 +247,31 @@ extern "C" {
               }
             }
             else {
+              is_state |= 0x10;
+            }
+
+            if (is_state & 0x12) {
               status = f_array_lengths_increase(state.step_small, delimits);
               if (F_status_is_error(status)) break;
 
               delimits->array[delimits->used++] = slash_last;
             }
 
-            range->start = newline_last;
+            range->start = line_start;
+            is_state = 0x1;
           }
         }
-        else if (graph_first == 0x1 && buffer.string[range->start] == f_fss_comment_s.string[0]) {
-          graph_first = 0x2;
+        else if (buffer.string[range->start] == f_fss_comment_s.string[0] && (is_state & 0x1)) {
+          is_state |= 0x2;
+          is_state &= ~0x1;
           comment_delimit = slash_first;
         }
         else {
-          graph_first = 0x0;
+          is_state &= ~0x1;
         }
       }
       else if (buffer.string[range->start] == f_fss_embedded_list_open_s.string[0]) {
-        graph_first = 0x0;
+        is_state &= ~0x1;
         before_list_open = position_previous;
         position_previous = range->start;
 
@@ -334,14 +303,7 @@ extern "C" {
           if (F_status_is_error(status)) break;
         } // while
 
-        if (F_status_is_error(status)) break;
-
-        if (depth) {
-          private_macro_fl_fss_nest_return_on_overflow((buffer), (*range), (*found), (*delimits), delimits_used, (*comments), comments_used, positions_start, objects, slashes, F_end_not_nest_eos, F_end_not_nest_stop);
-        }
-        else {
-          private_macro_fl_fss_nest_return_on_overflow((buffer), (*range), (*found), (*delimits), delimits_used, (*comments), comments_used, positions_start, objects, slashes, F_data_not_eos, F_data_not_stop);
-        }
+        if (F_status_is_error(status) || range->start >= buffer.used || range->start > range->stop) break;
 
         if (buffer.string[range->start] == f_fss_eol_s.string[0]) {
           if (++depth >= objects.size) {
@@ -350,15 +312,19 @@ extern "C" {
           }
 
           if (depth >= positions_start.size) {
-            status = f_array_lengths_resize(depth + 2, &positions_start);
-            if (F_status_is_error(status)) break;
+            if (F_status_is_error_not(status)) {
+              status = f_array_lengths_resize(depth + 2, &positions_start);
+            }
           }
 
           if (depth >= slashes.size) {
-            status = f_array_lengths_resize(depth + 2, &slashes);
-            if (F_status_is_error(status)) break;
+            if (F_status_is_error_not(status)) {
+              status = f_array_lengths_resize(depth + 2, &slashes);
+            }
           }
 
+          if (F_status_is_error(status)) break;
+
           objects.array[depth].start = line_start;
           objects.array[depth].stop = before_list_open;
           positions_start.array[depth] = range->start + 1;
@@ -376,7 +342,7 @@ extern "C" {
             slashes.used = depth + 1;
           }
 
-          if (graph_first == 0x2) {
+          if (is_state & 0x2) {
             status = f_array_lengths_increase(state.step_small, delimits);
             if (F_status_is_error(status)) break;
 
@@ -384,8 +350,8 @@ extern "C" {
           }
 
           newline_last = range->start;
-          line_start = range->start + 1;
-          graph_first = 0x1;
+          line_start = newline_last + 1;
+          is_state = 0x1;
         }
         else {
 
@@ -393,7 +359,7 @@ extern "C" {
           status = f_fss_seek_to_eol(state, buffer, range);
           if (F_status_is_error(status)) break;
 
-          if (graph_first == 0x2) {
+          if (is_state & 0x2) {
             status = f_array_lengths_increase(state.step_small, delimits);
             if (F_status_is_error(status)) break;
 
@@ -401,46 +367,11 @@ extern "C" {
           }
 
           newline_last = range->start;
-          line_start = range->start + 1;
-          graph_first = 0x1;
-
-          while (range->start <= range->stop && range->start < buffer.used) {
-
-            if (state.interrupt) {
-              status = state.interrupt((void *) &state, 0);
-
-              if (F_status_set_fine(status) == F_interrupt) {
-                status = F_status_set_error(F_interrupt);
-
-                break;
-              }
-            }
-
-            if (buffer.string[range->start] == f_fss_eol_s.string[0]) {
-              newline_last = range->start;
-              line_start = range->start + 1;
-              graph_first = 0x1;
-
-              break;
-            }
-
-            position_previous = range->start;
-
-            status = f_utf_buffer_increment(buffer, range, 1);
-            if (F_status_is_error(status)) break;
-          } // while
-
-          if (F_status_is_error(status)) break;
-
-          if (depth) {
-            private_macro_fl_fss_nest_return_on_overflow((buffer), (*range), (*found), (*delimits), delimits_used, (*comments), comments_used, positions_start, objects, slashes, F_end_not_nest_eos, F_end_not_nest_stop);
-          }
-          else {
-            private_macro_fl_fss_nest_return_on_overflow((buffer), (*range), (*found), (*delimits), delimits_used, (*comments), comments_used, positions_start, objects, slashes, F_data_not_eos, F_data_not_stop);
-          }
+          line_start = newline_last + 1;
+          is_state = 0x1;
         }
       }
-      else if (buffer.string[range->start] == f_fss_embedded_list_close_s.string[0]) {
+      else if (buffer.string[range->start] == f_fss_embedded_list_close_s.string[0] && (is_state & 0x1)) {
         while (range->start <= range->stop && range->start < buffer.used) {
 
           if (state.interrupt) {
@@ -456,9 +387,7 @@ extern "C" {
           position_previous = range->start;
 
           status = f_utf_buffer_increment(buffer, range, 1);
-
-          if (F_status_is_error(status)) break;
-          if (buffer.string[range->start] == f_fss_eol_s.string[0]) break;
+          if (F_status_is_error(status) || buffer.string[range->start] == f_fss_eol_s.string[0]) break;
 
           if (buffer.string[range->start] != f_fss_delimit_placeholder_s.string[0]) {
             status = f_fss_is_space(state, buffer, *range);
@@ -466,33 +395,29 @@ extern "C" {
           }
         } // while
 
-        if (F_status_is_error(status)) break;
-
-        if (depth) {
-          private_macro_fl_fss_nest_return_on_overflow((buffer), (*range), (*found), (*delimits), delimits_used, (*comments), comments_used, positions_start, objects, slashes, F_end_not_nest_eos, F_end_not_nest_stop);
-        }
-        else {
-          private_macro_fl_fss_nest_return_on_overflow((buffer), (*range), (*found), (*delimits), delimits_used, (*comments), comments_used, positions_start, objects, slashes, F_data_not_eos, F_data_not_stop);
-        }
+        if (F_status_is_error(status) || range->start >= buffer.used || range->start > range->stop) break;
 
         if (buffer.string[range->start] == f_fss_eol_s.string[0]) {
           if (depth >= found->used) {
             status = f_fss_nest_resize(depth + 2, found);
-            if (F_status_is_error(status)) break;
           }
 
           if (found->depth[depth].used >= found->depth[depth].size) {
-            status = f_fss_items_increase(state.step_small, &found->depth[depth]);
-            if (F_status_is_error(status)) break;
+            if (F_status_is_error_not(status)) {
+              status = f_fss_items_increase(state.step_small, &found->depth[depth]);
+            }
           }
 
           position = found->depth[depth].used;
 
           if (found->depth[depth].array[position].content.size != 1) {
-            status = f_string_ranges_resize(1, &found->depth[depth].array[position].content);
-            if (F_status_is_error(status)) break;
+            if (F_status_is_error_not(status)) {
+              status = f_string_ranges_resize(1, &found->depth[depth].array[position].content);
+            }
           }
 
+          if (F_status_is_error(status)) break;
+
           if (depth) {
             found->depth[depth].array[position].parent = found->depth[depth - 1].used;
 
@@ -521,7 +446,7 @@ extern "C" {
             found->used = depth + 1;
           }
 
-          if (graph_first == 0x2) {
+          if (is_state & 0x2) {
             status = f_array_lengths_increase(state.step_small, delimits);
             if (F_status_is_error(status)) break;
 
@@ -529,8 +454,8 @@ extern "C" {
           }
 
           newline_last = range->start;
-          line_start = range->start + 1;
-          graph_first = 0x1;
+          line_start = newline_last + 1;
+          is_state = 0x1;
 
           if (!depth) {
             status = f_utf_buffer_increment(buffer, range, 1);
@@ -563,7 +488,7 @@ extern "C" {
             }
 
             if (buffer.string[range->start] == f_fss_eol_s.string[0]) {
-              if (graph_first == 0x2) {
+              if (is_state & 0x2) {
                 status = f_array_lengths_increase(state.step_small, delimits);
                 if (F_status_is_error(status)) break;
 
@@ -571,8 +496,8 @@ extern "C" {
               }
 
               newline_last = range->start;
-              line_start = range->start + 1;
-              graph_first = 0x1;
+              line_start = newline_last + 1;
+              is_state = 0x1;
 
               break;
             }
@@ -583,17 +508,10 @@ extern "C" {
             if (F_status_is_error(status)) break;
           } // while
 
-          if (F_status_is_error(status)) break;
-
-          if (depth) {
-            private_macro_fl_fss_nest_return_on_overflow((buffer), (*range), (*found), (*delimits), delimits_used, (*comments), comments_used, positions_start, objects, slashes, F_end_not_nest_eos, F_end_not_nest_stop)
-          }
-          else {
-            private_macro_fl_fss_nest_return_on_overflow((buffer), (*range), (*found), (*delimits), delimits_used, (*comments), comments_used, positions_start, objects, slashes, F_data_not_eos, F_data_not_stop)
-          }
+          if (F_status_is_error(status) || range->start >= buffer.used || range->start > range->stop) break;
         }
       }
-      else if (buffer.string[range->start] == f_fss_comment_s.string[0] && (graph_first == 0x1 || graph_first == 0x2)) {
+      else if (buffer.string[range->start] == f_fss_comment_s.string[0] && (is_state & 0x1)) {
 
         // The newline_last is initialized to the range->start, which may not actually be a new line.
         position = (buffer.string[newline_last] == f_string_eol_s.string[0]) ? newline_last + 1 : newline_last;
@@ -605,7 +523,7 @@ extern "C" {
           --range->start;
         }
         else {
-          if (graph_first == 0x2) {
+          if (is_state & 0x2) {
             status = f_array_lengths_increase(state.step_small, delimits);
             if (F_status_is_error(status)) break;
 
@@ -613,7 +531,8 @@ extern "C" {
           }
 
           newline_last = range->start;
-          graph_first = 0x1;
+          line_start = newline_last + 1;
+          is_state = 0x1;
         }
 
         status = f_string_ranges_increase(state.step_small, comments);
@@ -621,33 +540,24 @@ extern "C" {
 
         comments->array[comments->used].start = position;
         comments->array[comments->used++].stop = range->start++;
-
-        continue;
       }
       else if (buffer.string[range->start] != f_fss_eol_s.string[0]) {
         position_previous = range->start;
 
-        if (graph_first == 0x1) {
+        if (is_state & 0x1) {
           status = f_fss_is_space(state, buffer, *range);
-          if (F_status_is_error(status)) break;
 
           if (status == F_false) {
-            graph_first = 0x0;
+            is_state &= ~0x1;
           }
         }
 
-        status = f_utf_buffer_increment(buffer, range, 1);
-        if (F_status_is_error(status)) break;
-
-        if (range->start >= buffer.used || range->start > range->stop) break;
+        if (F_status_is_error_not(status)) {
+          status = f_utf_buffer_increment(buffer, range, 1);
+        }
 
-        continue;
+        if (F_status_is_error(status)) break;
       }
-
-      position_previous = range->start;
-
-      status = f_utf_buffer_increment(buffer, range, 1);
-      if (F_status_is_error(status)) break;
     } // while
 
     f_array_lengths_resize(0, &positions_start);
index 025d6b81204d6b2ef375b36536163b4f4ba186cd..89792e8f49df08b51efa69fda39dab4f25575c76 100644 (file)
@@ -199,7 +199,8 @@ extern "C" {
 
         continue;
       }
-      else if (buffer.string[range->start] == list_open.string[0]) {
+
+      if (buffer.string[range->start] == list_open.string[0]) {
         ++range->start;
 
         while (range->start <= range->stop && range->start < buffer.used) {
@@ -251,23 +252,22 @@ extern "C" {
 
         continue;
       }
-      else {
-        status = f_fss_is_space(state, buffer, *range);
 
-        if (F_status_is_error(status)) {
-          delimits->used = delimits_used;
+      status = f_fss_is_space(state, buffer, *range);
 
-          return status;
-        }
+      if (F_status_is_error(status)) {
+        delimits->used = delimits_used;
 
-        if (status == F_false) {
-          if (graph_first) {
-            graph_first = F_false;
-            start = range->start;
-          }
+        return status;
+      }
 
-          stop = range->start;
+      if (status == F_false) {
+        if (graph_first) {
+          graph_first = F_false;
+          start = range->start;
         }
+
+        stop = range->start;
       }
 
       status = f_utf_buffer_increment(buffer, range, 1);
index 3b9e70b41d9cb87e9075b6d9b0fc304dcf61bbc2..e5d747198e34715daaaa67b0fbc88b0d91443ffc 100644 (file)
@@ -16,7 +16,7 @@ extern "C" {
     f_status_t status = F_none;
     f_array_length_t initial_used = 0;
 
-    bool found_data = F_false;
+    uint8_t found_data = F_false;
 
     if (!nest->used) {
       status = f_fss_nest_resize(state.step_small, nest);
@@ -28,7 +28,7 @@ extern "C" {
 
     do {
       do {
-        status = f_fss_items_resize(state.step_small, &nest->depth[0]);
+        status = f_fss_items_increase(state.step_small, &nest->depth[0]);
         if (F_status_is_error(status)) return status;
 
         nest->depth[nest->used].used = 0;
@@ -43,6 +43,8 @@ extern "C" {
             return F_fss_found_object_content_not;
           }
 
+          if (status == F_data_not) return status;
+
           if (found_data) {
             if (range->start >= buffer.used) return F_none_eos;
 
index 9a55445c34c4f084e4807e96a4822d7c2a3746c7..25a805e3b8547a6e372e6f4168312494eb843774 100644 (file)
@@ -13,7 +13,10 @@ extern "C" {
 
     if (contents.used && contents.array[0].start <= contents.array[0].stop) {
       if (contents.array[0].stop + 1 < data->buffer.used) {
-        before.start = contents.array[0].stop;
+        before.start = contents.array[0].stop + 1;
+
+        // Seek past any NULLs.
+        while (before.start < data->buffer.used && !data->buffer.string[before.start]) ++before.start;
       }
       else {
         return before;
@@ -24,12 +27,21 @@ extern "C" {
     }
     else {
       before.start = object.stop;
-    }
 
-    while (before.start < data->buffer.used && data->buffer.string[before.start] != f_fss_eol_s.string[0]) ++before.start;
+      while (before.start < data->buffer.used && data->buffer.string[before.start] != f_fss_eol_s.string[0]) ++before.start;
 
-    if (before.start + 1 < data->buffer.used && data->buffer.string[before.start] == f_fss_eol_s.string[0]) {
-      before.stop = ++before.start;
+      if (before.start >= data->buffer.used || data->buffer.string[before.start] != f_fss_eol_s.string[0]) {
+        before.start = 1;
+        before.stop = 0;
+
+        return before;
+      }
+
+      ++before.start;
+    }
+
+    if (before.start < data->buffer.used) {
+      before.stop = before.start;
 
       while (before.stop < data->buffer.used && data->buffer.string[before.stop] != f_fss_embedded_list_close_s.string[0]) ++before.stop;
 
@@ -64,7 +76,7 @@ extern "C" {
 
     if (!data->buffer.used) return;
 
-    if (data->main->parameters.array[fss_embedded_list_read_parameter_content_e].result == f_console_result_found_e && (data->main->parameters.array[fss_embedded_list_read_parameter_original_e].result != f_console_result_found_e || data->main->parameters.array[fss_embedded_list_read_parameter_trim_e].result == f_console_result_found_e)) {
+    if (data->main->parameters.array[fss_embedded_list_read_parameter_content_e].result == f_console_result_found_e) {
       const f_string_range_t before = fss_embedded_list_read_print_at_determine_begin(data, object, contents);
 
       if (before.start <= before.stop) {
@@ -132,13 +144,19 @@ extern "C" {
 #endif // _di_fss_embedded_list_read_print_object_end_
 
 #ifndef _di_fss_embedded_list_read_print_set_end_
-  void fss_embedded_list_read_print_set_end(fss_embedded_list_read_data_t * const data) {
+  void fss_embedded_list_read_print_set_end(fss_embedded_list_read_data_t * const data, f_fss_items_t * const items, const f_array_length_t at, const f_fss_delimits_t objects_delimits) {
 
     if (data->main->parameters.array[fss_embedded_list_read_parameter_pipe_e].result == f_console_result_found_e) {
       f_print_dynamic_raw(fss_embedded_list_read_pipe_content_end_s, data->main->output.to.stream);
     }
     else {
       if (data->main->parameters.array[fss_embedded_list_read_parameter_object_e].result == f_console_result_found_e && data->main->parameters.array[fss_embedded_list_read_parameter_content_e].result == f_console_result_found_e) {
+        const f_string_range_t before = fss_embedded_list_read_print_at_determine_begin(data, items->array[at].object, items->array[at].content);
+
+        if (before.start <= before.stop) {
+          f_print_except_dynamic_partial(data->buffer, before, objects_delimits, data->main->output.to.stream);
+        }
+
         f_print_dynamic_raw(f_fss_embedded_list_close_s, data->main->output.to.stream);
         f_print_dynamic_raw(f_fss_embedded_list_close_end_s, data->main->output.to.stream);
       }
index 4ebe6af9238e6846d24199a4dfe2c0c1b7657700..e23ad2d0a4b3b4de2a06a53616272981d11f02a9 100644 (file)
@@ -78,9 +78,15 @@ extern "C" {
  *
  * @param data
  *   The program data.
+ * @param items
+ *   The items set to process.
+ * @param at
+ *   The position within the Object and Contents array to print.
+ * @param objects_delimits
+ *   The Object delimits array.
  */
 #ifndef _di_fss_embedded_list_read_print_set_end_
-  extern void fss_embedded_list_read_print_set_end(fss_embedded_list_read_data_t * const data) F_attribute_visibility_internal_d;
+  extern void fss_embedded_list_read_print_set_end(fss_embedded_list_read_data_t * const data, f_fss_items_t * const items, const f_array_length_t at, const f_fss_delimits_t objects_delimits) F_attribute_visibility_internal_d;
 #endif // _di_fss_embedded_list_read_print_set_end_
 
 #ifdef __cplusplus
index b1cd777649ff6872f8081cd5f4a02388ec878ee8..655c918a7cb50f5cdd8942c3807ba7510ff6525d 100644 (file)
@@ -272,18 +272,9 @@ extern "C" {
         return status;
       }
 
-      f_array_length_t i = 0;
-      f_array_length_t j = 0;
-
-      // Comments are not to be part of the file, so remove them.
-      for (; i < comments->used; ++i) {
-
-        for (j = comments->array[i].start; j <= comments->array[i].stop; ++j) {
-
-          if (j < data->buffer.used) {
-            data->buffer.string[j] = f_fss_delimit_placeholder_s.string[0];
-          }
-        } // for
+      // Comments are not to be part of the file, so remove them.ed);
+      for (f_array_length_t i = 0; i < comments->used; ++i) {
+        memset(data->buffer.string + comments->array[i].start, f_fss_delimit_placeholder_s.string[0], (comments->array[i].stop - comments->array[i].start) + 1);
       } // for
     }
 
@@ -598,7 +589,7 @@ extern "C" {
 
                 // If the matched line is after the stop, then this matches the end of Object line.
                 if (j > items->array[i].content.array[0].stop) {
-                  fss_embedded_list_read_print_set_end(data);
+                  fss_embedded_list_read_print_set_end(data, items, i, *objects_delimits);
                 }
                 else {
                   for (; j <= items->array[i].content.array[0].stop; ++j) {
@@ -635,7 +626,7 @@ extern "C" {
 
               // Handle the Object end.
               if (line_current++ == line) {
-                fss_embedded_list_read_print_set_end(data);
+                fss_embedded_list_read_print_set_end(data, items, i, *objects_delimits);
 
                 break;
               }
@@ -660,19 +651,11 @@ extern "C" {
           fss_embedded_list_read_print_object_end(data);
 
           if (items->array[i].content.used) {
-            if (data->main->parameters.array[fss_embedded_list_read_parameter_object_e].result == f_console_result_found_e) {
-              const f_string_range_t before = fss_embedded_list_read_print_at_determine_begin(data, items->array[i].object, items->array[i].content);
-
-              if (before.start <= before.stop) {
-                f_print_except_dynamic_partial(data->buffer, before, *objects_delimits, data->main->output.to.stream);
-              }
-            }
-
             f_print_except_dynamic_partial(data->buffer, items->array[i].content.array[0], *contents_delimits, data->main->output.to.stream);
           }
         }
 
-        fss_embedded_list_read_print_set_end(data);
+        fss_embedded_list_read_print_set_end(data, items, i, *objects_delimits);
       } // for
 
       funlockfile(data->main->output.to.stream);
index 052213819abb54f70e1b576e81f8cc64e95c0593..56ad473b6eb6f4ed370701e1076d5f5b766a1112 100644 (file)
@@ -6,7 +6,7 @@
     inside {
     }
       with content.
-      \### Nested valid Object {
+      ### Nested valid Object {
         with nested content.
       }
       and outside.
index 052213819abb54f70e1b576e81f8cc64e95c0593..56ad473b6eb6f4ed370701e1076d5f5b766a1112 100644 (file)
@@ -6,7 +6,7 @@
     inside {
     }
       with content.
-      \### Nested valid Object {
+      ### Nested valid Object {
         with nested content.
       }
       and outside.
index 052213819abb54f70e1b576e81f8cc64e95c0593..56ad473b6eb6f4ed370701e1076d5f5b766a1112 100644 (file)
@@ -6,7 +6,7 @@
     inside {
     }
       with content.
-      \### Nested valid Object {
+      ### Nested valid Object {
         with nested content.
       }
       and outside.
index f28125f76b49e0b8c549f6cfd136f8b1e05e9bad..2acd8272bc355c9fa6cc8760a61c5a208e0ad37a 100644 (file)
@@ -1,26 +1,26 @@
   a  {
-  
+
     stuff
     
     This has
     Several lines
-}
+  }
   привет has space {
-      inside {
+    inside {
     }
-}
+  }
     \# Valid Object {
-          with content.
-}
+      with content.
+    }
     \# Valid Object {
-          \### Nested valid Object {
+      \### Nested valid Object {
         with nested content.
       }
       and outside.
-}
-{
-   Has no Object name (only white space) and is oddly spaced.
-}
+    }
+   {
+Has no Object name (only white space) and is oddly spaced.
+   }
 мир      {
 мирмирмир
 }
index 546e287e042ab9dfc4daf2db449b995004a88a71..c2e762728ce181a35afd371df575b69abde9138b 100644 (file)
@@ -1,26 +1,26 @@
   a{
-  
+
     stuff
     
     This has
     Several lines
-}
+  }
   привет has space{
-      inside {
+    inside {
     }
-}
+  }
     # Valid Object{
-          with content.
-}
+      with content.
+    }
     # Valid Object{
-          \### Nested valid Object {
+      ### Nested valid Object {
         with nested content.
       }
       and outside.
-}
+    }
    {
-   Has no Object name (only white space) and is oddly spaced.
-}
+Has no Object name (only white space) and is oddly spaced.
+   }
 мир{
 мирмирмир
 }
index 546e287e042ab9dfc4daf2db449b995004a88a71..c2e762728ce181a35afd371df575b69abde9138b 100644 (file)
@@ -1,26 +1,26 @@
   a{
-  
+
     stuff
     
     This has
     Several lines
-}
+  }
   привет has space{
-      inside {
+    inside {
     }
-}
+  }
     # Valid Object{
-          with content.
-}
+      with content.
+    }
     # Valid Object{
-          \### Nested valid Object {
+      ### Nested valid Object {
         with nested content.
       }
       and outside.
-}
+    }
    {
-   Has no Object name (only white space) and is oddly spaced.
-}
+Has no Object name (only white space) and is oddly spaced.
+   }
 мир{
 мирмирмир
 }
index 546e287e042ab9dfc4daf2db449b995004a88a71..c2e762728ce181a35afd371df575b69abde9138b 100644 (file)
@@ -1,26 +1,26 @@
   a{
-  
+
     stuff
     
     This has
     Several lines
-}
+  }
   привет has space{
-      inside {
+    inside {
     }
-}
+  }
     # Valid Object{
-          with content.
-}
+      with content.
+    }
     # Valid Object{
-          \### Nested valid Object {
+      ### Nested valid Object {
         with nested content.
       }
       and outside.
-}
+    }
    {
-   Has no Object name (only white space) and is oddly spaced.
-}
+Has no Object name (only white space) and is oddly spaced.
+   }
 мир{
 мирмирмир
 }
index c8821c6e222b696282906e323fd867fd81350583..d2bb5f2eea2719c34150c33b5dee63854147cba3 100644 (file)
@@ -53,7 +53,10 @@ extern "C" {
     if (at < data->contents.used) {
       if (data->contents.used && data->contents.array[at].array[0].start <= data->contents.array[at].array[0].stop) {
         if (data->contents.array[at].array[0].stop + 1 < data->buffer.used) {
-          before.start = data->contents.array[at].array[0].stop;
+          before.start = data->contents.array[at].array[0].stop + 1;
+
+          // Seek past any NULLs.
+          while (before.start < data->buffer.used && !data->buffer.string[before.start]) ++before.start;
         }
         else {
           return before;
@@ -64,12 +67,21 @@ extern "C" {
       }
       else {
         before.start = data->objects.array[at].stop;
-      }
 
-      while (before.start < data->buffer.used && data->buffer.string[before.start] != f_fss_eol_s.string[0]) ++before.start;
+        while (before.start < data->buffer.used && data->buffer.string[before.start] != f_fss_eol_s.string[0]) ++before.start;
+
+        if (before.start >= data->buffer.used || data->buffer.string[before.start] != f_fss_eol_s.string[0]) {
+          before.start = 1;
+          before.stop = 0;
+
+          return before;
+        }
+
+        ++before.start;
+      }
 
-      if (before.start + 1 < data->buffer.used && data->buffer.string[before.start] == f_fss_eol_s.string[0]) {
-        before.stop = ++before.start;
+      if (before.start < data->buffer.used) {
+        before.stop = before.start;
 
         while (before.stop < data->buffer.used && data->buffer.string[before.stop] != f_fss_extended_list_close_s.string[0]) ++before.stop;