]> Kevux Git Server - fll/commitdiff
Progress: Latest changes.
authorKevin Day <Kevin@kevux.org>
Wed, 5 Aug 2026 02:58:58 +0000 (21:58 -0500)
committerKevin Day <Kevin@kevux.org>
Wed, 5 Aug 2026 02:58:58 +0000 (21:58 -0500)
Take care of all of the to do's for the `private_fl_fss_basic_or_extended_read()`.

I need to not verify the logic and compare against the unit tests.

The other FSS functions are not yet updated/fixed.

level_0/f_fss/c/fss.c
level_0/f_utf/c/utf/is.h
level_1/fl_fss/c/private-fss.c

index 3c59400adcf832d0322562de9474bbbb7761c359..f00cf385dd23b67958350756b7664f656d678805 100644 (file)
@@ -577,7 +577,7 @@ extern "C" {
       }
     } // for
 
-    status->status = flag & 0x1
+    state->status = flag & 0x1
       ? F_bound
       : flag & 0x2
         ? F_combarudoo
index 2608477f1f8516eab5cb66205ddce7fc656880eb..9a5b08d21cf542b9d15ae3b2e8f9086d27b43fa1 100644 (file)
@@ -174,8 +174,8 @@ extern "C" {
  *   Can be anything greater than 0.
  *
  * @return
- *   F_true if a UTF-8 combining character.
- *   F_false if not a UTF-8 combining character.
+ *   F_true if a UTF-8 combining or a joiner character.
+ *   F_false if neither a UTF-8 combining nor a joiner character.
  *   F_data_not if width_max is less than 1.
  *
  *   F_complete_not_utf (with error bit set) if character is an incomplete UTF-8 sequence.
index 6fcf1588fae81420e163d40be77dbb2112a571d8..208b1d477e10fe730ccc16f20ac8dec0d4b65e63 100644 (file)
@@ -26,17 +26,6 @@ extern "C" {
       return;
     }
 
-    #define ___fl_flag_do_escape___          0x40
-    #define ___fl_flag_do_prepend___         0x1
-    #define ___fl_flag_has_graph___          0x2
-    #define ___fl_flag_is_comment___         0x4
-    #define ___fl_flag_is_combining___       0x8
-    #define ___fl_flag_is_combining_graph___ 0xa
-    #define ___fl_flag_is_joined___          0x10
-    #define ___fl_flag_is_joiner___          0x20
-    #define ___fl_flag_is_joiner_graph___    0x22
-    #define ___fl_flag_is_joinerd___         0x30
-
     const f_number_unsigned_t begin = range->start;
 
     found->start = begin;
@@ -80,6 +69,10 @@ extern "C" {
       range->start = begin;
     }
 
+    #define ___fl_flag_do_escape___            0x1
+    #define ___fl_flag_has_graph___            0x2
+    #define ___fl_flag_has_joiner_combining___ 0x4
+
     const f_number_unsigned_t delimits_used = delimits->used;
 
     f_number_unsigned_t first_slash = 0;
@@ -105,9 +98,11 @@ extern "C" {
 
       // If first slash has a combining/joiner following it, then there is no escaping at all so first_slash is the start of an object and is not considered an escaping character.
       if (F_status_is_error_not(state->status)) {
-        if (f_fss_is_combining_joiner(buffer, *range, state) != F_false) {
+        if (f_fss_is_combining_joiner(buffer, *range, state) == F_true) {
           range->start = first_slash;
           flag_fl &= ~___fl_flag_do_escape___;
+
+          f_fss_skip_past_combining_joiner(buffer, range, state);
         }
       }
 
@@ -160,9 +155,12 @@ extern "C" {
                 break;
               }
             }
-          }
 
-          state->status = f_utf_buffer_increment(buffer, range, 1);
+            state->status = f_utf_buffer_increment(buffer, range, 1);
+          }
+          else {
+            f_fss_skip_past_combining_joiner(buffer, range, state);
+          }
         } // while
 
         if (F_status_is_error(state->status)) return;
@@ -196,8 +194,24 @@ extern "C" {
       }
     }
     else if (!(flag & 0x2) && (buffer.string[range->start] == f_fss_quote_single_s.string[0] || buffer.string[range->start] == f_fss_quote_double_s.string[0] || buffer.string[range->start] == f_fss_quote_grave_s.string[0])) {
-      quote_found = buffer.string[range->start]; // TODO: check for combining and joiner.
-      found->start = ++range->start;
+      previous = range->start++;
+
+      if (range->start <= range->stop && range->start < buffer.used) {
+        if (f_fss_is_combining_joiner(buffer, *range, state) == F_false) {
+          if (F_status_is_error(state->status)) return;
+
+          quote_found = buffer.string[previous];
+          found->start = range->start;
+        }
+        else {
+          f_fss_skip_past_combining_joiner(buffer, range, state);
+          if (F_status_is_error(state->status)) return;
+        }
+      }
+      else {
+        quote_found = buffer.string[previous];
+        found->start = range->start;
+      }
     }
 
     // Identify where the object ends.
@@ -213,8 +227,6 @@ extern "C" {
           if (F_status_set_fine(state->status) == F_interrupt) return;
         }
 
-        // TODO: check for combinign and joiner flags.
-
         if (buffer.string[range->start] == f_fss_slash_s.string[0]) {
           first_slash = range->start;
           slash_count = 1;
@@ -222,6 +234,19 @@ extern "C" {
           state->status = f_utf_buffer_increment(buffer, range, 1);
           if (F_status_is_error(state->status)) return;
 
+          if (range->start <= range->stop && range->start < buffer.used) {
+            if (f_fss_is_combining_joiner(buffer, *range, state) == F_true) {
+              f_fss_skip_past_combining_joiner(buffer, range, state);
+              if (F_status_is_error(state->status)) return;
+
+              continue;
+            }
+
+            if (F_status_is_error(state->status)) return;
+          }
+
+          flag_fl &= ~___fl_flag_has_joiner_combining___;
+
           while (range->start <= range->stop && range->start < buffer.used) {
 
             if (state->interrupt) {
@@ -235,16 +260,34 @@ extern "C" {
 
               continue;
             }
-            else if (buffer.string[range->start] != f_fss_slash_s.string[0]) {
-              break;
+
+            if (buffer.string[range->start] == f_fss_slash_s.string[0]) {
+              ++slash_count;
             }
+            else {
+              if (f_fss_is_combining_joiner(buffer, *range, state) == F_true) {
+                f_fss_skip_past_combining_joiner(buffer, range, state);
+                if (F_status_is_error(state->status)) return;
 
-            ++slash_count;
+                flag_fl |= ___fl_flag_has_joiner_combining___;
+              }
+              else {
+                if (F_status_is_error(state->status)) return;
+              }
+
+              break;
+            }
 
             state->status = f_utf_buffer_increment(buffer, range, 1);
             if (F_status_is_error(state->status)) return;
           } // while
 
+          if (flag_fl & ___fl_flag_has_joiner_combining___) {
+            flag_fl &= ~___fl_flag_has_joiner_combining___;
+
+            continue;
+          }
+
           if (range->start >= buffer.used) {
             found->stop = buffer.used - 1;
             state->status = F_end_not_group_eos;
@@ -259,13 +302,11 @@ extern "C" {
             return;
           }
 
-          if (buffer.string[range->start] == quote_found) { // TODO: check for combining and joiner.
-            location = range->start;
+          if (buffer.string[range->start] == quote_found) {
+            location = range->start++;
 
-            // Check to see if there is a whitespace, EOS, or EOL after the quote, if not, then this is not a closing quote and delimits do not apply.
-            // TODO: This should check for combining and joining and set flags.
-            if (range->start + 1 <= range->stop && range->start + 1 < buffer.used) {
-              ++range->start;
+            // Check to see if there is a whitespace, EOS, or EOL after the quote, if not, then this is not a closing quote and delimits do not apply (also handles combining/joiner after the quote).
+            if (range->start <= range->stop && range->start < buffer.used) {
 
               f_fss_skip_past_delimit(buffer, range, state);
               if (F_status_is_error(state->status)) return;
@@ -277,18 +318,63 @@ extern "C" {
                 state->status = F_true;
               }
               else {
-                if (f_fss_is_space(buffer, *range, state) == F_false) {
+                if (f_fss_is_combining_joiner(buffer, *range, state) == F_true) {
+
+                  // The found quote is not a valid quote because of the combining/joiner character.
+                  state->status = F_false;
+                }
+                else {
                   if (F_status_is_error(state->status)) return;
+
+                  // This check sets the state status, which is then used by the condition below.
+                  if (f_fss_is_space(buffer, *range, state) == F_true) {
+                    if (state->status == F_control && buffer.string[range->start] == f_fss_eol_s.string[0]) {
+
+                      // The EOL is immediately valid and is not to be checked for combining/joiners.
+                      state->status = F_true;
+                    }
+                    else {
+                      previous = range->start;
+                      flag_fl &= ~___fl_flag_has_joiner_combining___;
+
+                      state->status = f_utf_buffer_increment(buffer, range, 1);
+                      if (F_status_is_error(state->status)) return;
+
+                      if (range->start <= range->stop && range->start < buffer.used) {
+                        if (f_fss_is_combining_joiner(buffer, *range, state) == F_true) {
+                          flag_fl |= ___fl_flag_has_joiner_combining___;
+                        }
+                        else {
+                          if (F_status_is_error(state->status)) return;
+                        }
+                      }
+
+                      // Designate that this is an appropriate space.
+                      if (flag_fl & ___fl_flag_has_joiner_combining___) {
+                        flag_fl &= ~___fl_flag_has_joiner_combining___;
+                        state->status = F_false;
+                      }
+                      else {
+                        state->status = F_true;
+                        range->start = previous;
+                      }
+                    }
+                  }
+                  else {
+                    if (F_status_is_error(state->status)) return;
+                  }
                 }
               }
             }
             else {
+              --range->start;
 
               // EOS or EOL was reached, so it is a valid closing quote.
               // (for EOL, this is always TRUE, for EOS this could be false but there is no way to know this, so assume TRUE.)
               state->status = F_true;
             }
 
+            // At this point if state status is TRUE, then we are dealing with a valid quote after the slash.
             if (state->status == F_true) {
               if (quote) {
                 if (quote_found == f_fss_quote_double_s.string[0]) {
@@ -330,47 +416,13 @@ extern "C" {
 
                 range->start = location + 1;
 
-                state->status = f_fss_skip_past_delimit(buffer, range, 1);
+                f_fss_skip_past_delimit(buffer, range, state);
                 if (F_status_is_error(state->status)) return;
 
-                if (f_fss_is_graph(buffer, *range, state) != F_true) {
+                if (f_fss_is_graph(buffer, *range, state) == F_false) {
                   if (F_status_is_error(state->status)) return;
-
-                  // Anything other than a new line must be checked if a combining or joiner is in the next character.
-                  // TODO: review this logic.
-                  if (buffer.string[range->start] != f_fss_eol_s.string[0]) {
-                    previous = range->start;
-
-                    state->status = f_utf_buffer_increment(buffer, range, 1);
-                    if (F_status_is_error(state->status)) return;
-
-                    if (state->status == F_okay) {
-                      f_fss_skip_past_delimit(buffer, range, state);
-                      if (F_status_is_error(state->status)) return;
-
-                      if (state->status == F_okay) {
-                        f_fss_is_combining_joiner(buffer, *range, state);
-                        if (F_status_is_error(state->status)) return;
-                      }
-
-                      // TODO: the status is F_combarudoo for combining and F_bound for joiner.
-
-                      // Swap the status to represent F_true for is graph and otherwise for not is graph.
-                      if (state->status == F_true) {
-                        range->start = previous;
-                        state->status = F_false;
-                      }
-                      else {
-                        state->status = F_true;
-                      }
-                    }
-                    else {
-                      state->status = F_true;
-                    }
-                  }
                 }
-
-                if (state->status == F_true) {
+                else {
                   while (range->start <= range->stop && range->start < buffer.used && buffer.string[range->start] != f_fss_eol_s.string[0]) {
 
                     if (state->interrupt) {
@@ -456,23 +508,49 @@ extern "C" {
         else if (buffer.string[range->start] == quote_found) {
 
           // Check to see if there is a whitespace, EOS, or EOL after the quote, if not, then this is not a closing quote.
-          location = range->start;
+          location = range->start++;
 
-          if (range->start + 1 <= range->stop && range->start + 1 < buffer.used) {
-            ++range->start;
+          f_fss_skip_past_delimit(buffer, range, state);
+          if (F_status_is_error(state->status)) return;
 
-            f_fss_skip_past_delimit(buffer, range, state);
-            if (F_status_is_error(state->status)) return;
+          if (range->start <= range->stop && range->start < buffer.used) {
+            if (f_fss_is_space(buffer, *range, state) == F_true) {
+              previous = range->start;
+              flag_fl &= ~___fl_flag_has_joiner_combining___;
+
+              state->status = f_utf_buffer_increment(buffer, range, 1);
+              if (F_status_is_error(state->status)) return;
 
-            if (range->start > range->stop || range->start >= buffer.used) {
+              if (range->start <= range->stop && range->start < buffer.used) {
+                if (f_fss_is_combining_joiner(buffer, *range, state) == F_true) {
+                  flag_fl |= ___fl_flag_has_joiner_combining___;
+                }
+                else {
+                  if (F_status_is_error(state->status)) return;
+                }
+              }
 
-              // EOS or EOL was reached, so it is a valid closing quote.
-              // (for EOL, this is always TRUE, for EOS this could be false but there is no way to know this, so assume TRUE.)
-              state->status = F_true;
+              // Designate that this is an appropriate space.
+              if (flag_fl & ___fl_flag_has_joiner_combining___) {
+                flag_fl &= ~___fl_flag_has_joiner_combining___;
+                state->status = F_false;
+              }
+              else {
+                state->status = F_true;
+                range->start = previous;
+              }
             }
             else {
-              if (f_fss_is_space(buffer, *range, state) == F_false) {
+              if (F_status_is_error(state->status)) return;
+
+              if (f_fss_is_combining_joiner(buffer, *range, state) == F_true) {
+                state->status = F_false;
+              }
+              else {
                 if (F_status_is_error(state->status)) return;
+
+                state->status = F_true;
+                range->start = previous;
               }
             }
           }
@@ -481,10 +559,12 @@ extern "C" {
             // EOS or EOL was reached, so it is a valid closing quote.
             // (for EOL, this is always TRUE, for EOS this could be false but there is no way to know this, so assume TRUE.)
             state->status = F_true;
+            range->start = location;
           }
 
           range->start = location;
 
+          // At this point if state status is TRUE, then we are dealing with a valid quote.
           if (state->status == F_true) {
             if (quote) {
               if (quote_found == f_fss_quote_double_s.string[0]) {
@@ -528,10 +608,7 @@ extern "C" {
                 return;
               }
 
-              if (f_fss_is_space(buffer, *range, state) == F_false) {
-                if (F_status_is_error(state->status)) return;
-              }
-              else {
+              if (f_fss_is_space(buffer, *range, state) == F_true) {
                 if (F_status_is_error_not(state->status)) {
                   state->status = f_utf_buffer_increment(buffer, range, 1);
 
@@ -543,6 +620,8 @@ extern "C" {
                 return;
               }
 
+              if (F_status_is_error(state->status)) return;
+
               if (buffer.string[range->start] != f_fss_placeholder_s.string[0]) {
                 while (range->start <= range->stop && range->start < buffer.used && buffer.string[range->start] != f_fss_eol_s.string[0]) {
 
@@ -627,7 +706,15 @@ extern "C" {
           return;
         }
         else {
-          // TODO: check for combining and joiner and set flag.
+          if (f_fss_is_combining_joiner(buffer, *range, state) == F_true) {
+            f_fss_skip_past_combining_joiner(buffer, range, state);
+            if (F_status_is_error(state->status)) return;
+
+            continue;
+          }
+          else {
+            if (F_status_is_error(state->status)) return;
+          }
         }
 
         state->status = f_utf_buffer_increment(buffer, range, 1);
@@ -658,7 +745,7 @@ extern "C" {
           if (F_status_set_fine(state->status) == F_interrupt) return;
         }
 
-        f_fss_skip_past_delimit(object, range, state);
+        f_fss_skip_past_delimit(buffer, range, state);
         if (F_status_is_error(state->status)) break;
         if (range->start > range->stop || range->start >= buffer.used) break;
 
@@ -666,26 +753,44 @@ extern "C" {
           f_fss_skip_past_combining_joiner(buffer, range, state);
           if (F_status_is_error(state->status)) return;
 
-          if (state->status == F_combarudoo) {
-            state->status = f_utf_buffer_increment(buffer, range, 2);
+          continue;
+        }
+
+        if (F_status_is_error(state->status)) return;
+
+        // Break if a space that is not part of a joiner is found (as in if the space is not followed by a combining or joiner).
+        if (f_fss_is_space(buffer, *range, state) == F_true) {
+          previous = range->start;
+
+          state->status = f_utf_buffer_increment(buffer, range, 1);
+          if (F_status_is_error(state->status)) return;
+
+          // There cannot be a combining or joiner once out of range, so reset and break.
+          if (range->start > range->stop || range->start >= buffer.used) {
+            range->start = previous;
+
+            break;
+          }
+
+          f_fss_skip_past_delimit(buffer, range, state);
+          if (F_status_is_error(state->status)) break;
+
+          if (f_fss_is_combining_joiner(buffer, *range, state) == F_true) {
+            f_fss_skip_past_combining_joiner(buffer, range, state);
             if (F_status_is_error(state->status)) return;
 
             continue;
           }
-        }
-        else if (F_status_is_error(state->status)) {
-          return;
-        }
-        else if (f_fss_is_space(buffer, *range, state) == F_false) {
-          if (F_status_is_error(state->status)) return;
-        }
-        else {
-          // TODO: Set internal flag here for designating that a space is found.
-          //       The combining/joiner check above should check for this flag so that.
-          //       If the flag is already set, then decrement/reset back to space position (maybe create a peek or similar function to check?).
+
+          if (F_status_is_error(state->status)) break;
+
+          range->start = previous;
+
           break;
         }
 
+        if (F_status_is_error(state->status)) return;
+
         state->status = f_utf_buffer_increment(buffer, range, 1);
         if (F_status_is_error(state->status)) return;
       } // while
@@ -726,15 +831,8 @@ extern "C" {
     state->status = F_fss_found_object_not;
 
     #undef ___fl_flag_do_escape___
-    #undef ___fl_flag_do_prepend___
     #undef ___fl_flag_has_graph___
-    #undef ___fl_flag_is_comment___
-    #undef ___fl_flag_is_combining___
-    #undef ___fl_flag_is_combining_graph___
-    #undef ___fl_flag_is_joined___
-    #undef ___fl_flag_is_joiner___
-    #undef ___fl_flag_is_joiner_graph___
-    #undef ___fl_flag_is_joinerd___
+    #undef ___fl_flag_has_joiner_combining___
   }
 #endif // !defined(_di_fl_fss_basic_object_read_) || !defined(_di_fl_fss_extended_object_read_)