From ebf4271307d45e7fa53652ee38821dc724ed7668 Mon Sep 17 00:00:00 2001 From: Kevin Day Date: Fri, 2 Oct 2026 22:15:26 -0500 Subject: [PATCH] Progress: Continue working, focusing on extended list read. --- level_1/fl_fss/c/fss/basic_list.c | 28 +++-- level_1/fl_fss/c/fss/embedded_list.c | 12 ++ level_1/fl_fss/c/fss/extended_list.c | 113 +++++++++++------- .../extended_list-combining_read-1.txt | 4 +- 4 files changed, 97 insertions(+), 60 deletions(-) diff --git a/level_1/fl_fss/c/fss/basic_list.c b/level_1/fl_fss/c/fss/basic_list.c index 57f3fd1d3..f592d4c23 100644 --- a/level_1/fl_fss/c/fss/basic_list.c +++ b/level_1/fl_fss/c/fss/basic_list.c @@ -86,7 +86,7 @@ extern "C" { slash_count = 1; flag_fl |= ___fl_flag_do_escape___; - for (; F_status_is_error_not(state->status) && range->start <= range->stop && range->start < buffer.used; ++range->start) { + for (; range->start <= range->stop && range->start < buffer.used; ++range->start) { if (state->interrupt) { state->interrupt((void *) state, 0); @@ -208,7 +208,10 @@ extern "C" { ++range->start; flag_fl &= ~___fl_flag_has_delimit_comment_graph_first___; - if (f_fss_is_combining_joiner(buffer, *range, state) == F_true) { + f_fss_skip_past_space(buffer, range, state); + + // The skip space returns F_complete_not_utf_start with error bit set on combining/joiner. + if (F_status_set_fine(state->status) == F_complete_not_utf_start) { flag_fl &= ~___fl_flag_has_graph_first_do_escape___; slash_count = 0; @@ -218,10 +221,6 @@ extern "C" { continue; } - if (F_status_is_error_not(state->status)) { - f_fss_skip_past_space(buffer, range, state); - } - if (F_status_is_error(state->status)) break; if (range->start > range->stop || range->start >= buffer.used) break; @@ -269,7 +268,7 @@ extern "C" { if ((flag_fl & ___fl_flag_has_graph_first___) && buffer.string[range->start] == f_fss_comment_s.string[0]) { previous = range->start++; - if (f_fss_is_combining_joiner(buffer, *range, state) == F_true) { + if (range->start <= range->stop && range->start < buffer.used && f_fss_is_combining_joiner(buffer, *range, state) == F_true) { flag_fl &= ~___fl_flag_has_graph_first_do_escape___; slash_count = 0; @@ -490,12 +489,13 @@ extern "C" { f_fss_skip_past_space(content, range, state); -/* - if (F_status_set_fine(state->status) == F_complete_not_utf_start) { + // The skip space returns F_complete_not_utf_start with error bit set on combining/joiner. + /*if (F_status_set_fine(state->status) == F_complete_not_utf_start) { flag_fl &= ~___fl_flag_has_graph_first_do_escape___; slash_count = 0; f_fss_skip_past_combining_joiner(buffer, range, state); + if (F_status_is_error(state->status)) break; continue; }*/ @@ -545,15 +545,19 @@ extern "C" { flag_fl |= ___fl_flag_has_graph___; f_fss_skip_past_space(content, range, state); // TODO: destination->string[destination->used++] = f_fss_slash_s.string[0]; don't skip entirely, also write! Do this for all before continuing based on the "start" position above. -/* + + // The skip space returns F_complete_not_utf_start with error bit set on combining/joiner. + /* if (F_status_set_fine(state->status) == F_complete_not_utf_start) { flag_fl &= ~___fl_flag_has_graph_first_do_escape___; slash_count = 0; f_fss_skip_past_combining_joiner(buffer, range, state); + if (F_status_is_error(state->status)) break; - continue; // TODO: see todo's above and also repeat for the other cases in this file. - }*/ + continue; + } + */ if (F_status_is_error(state->status)) break; diff --git a/level_1/fl_fss/c/fss/embedded_list.c b/level_1/fl_fss/c/fss/embedded_list.c index c9716f5a2..4ab5d8dd2 100644 --- a/level_1/fl_fss/c/fss/embedded_list.c +++ b/level_1/fl_fss/c/fss/embedded_list.c @@ -106,6 +106,8 @@ extern "C" { slash_first = slash_last = position_previous = range->start++; cache->slashes->array[depth] = 1; + // TODO: needs combining/joiner check. + for (; range->start <= range->stop && range->start < buffer.used && (buffer.string[range->start] == f_fss_placeholder_s.string[0] || buffer.string[range->start] == f_fss_slash_s.string[0]); ++range->start) { if (state->interrupt) { @@ -144,6 +146,8 @@ extern "C" { before_list_open = position_previous; flag_fl &= ~___fl_flag_is_open_close_graph_first___; + // TODO: needs combining/joiner check. + if (buffer.string[range->start] == f_fss_embedded_list_open_s.string[0]) { flag_fl |= ___fl_flag_is_open___; } @@ -261,6 +265,8 @@ extern "C" { flag_fl |= ___fl_flag_is_delimit_close___; flag_fl &= ~___fl_flag_has_graph_first___; comment_delimit = slash_first; + + // TODO: needs combining/joiner check. } else { flag_fl &= ~___fl_flag_has_graph_first___; @@ -271,6 +277,8 @@ extern "C" { before_list_open = position_previous; position_previous = range->start; + // TODO: needs combining/joiner check. + state->status = f_utf_buffer_increment(buffer, range, 1); if (F_status_is_error(state->status)) break; @@ -363,6 +371,8 @@ extern "C" { else if (buffer.string[range->start] == f_fss_embedded_list_close_s.string[0] && (flag_fl & ___fl_flag_has_graph_first___)) { close_location = range->start; + // TODO: needs combining/joiner check. + while (range->start <= range->stop && range->start < buffer.used) { if (state->interrupt) { @@ -505,6 +515,8 @@ extern "C" { } else if (buffer.string[range->start] == f_fss_comment_s.string[0] && (flag_fl & ___fl_flag_has_graph_first___)) { + // TODO: needs combining/joiner check. + // 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; diff --git a/level_1/fl_fss/c/fss/extended_list.c b/level_1/fl_fss/c/fss/extended_list.c index ca367a9fd..339518844 100644 --- a/level_1/fl_fss/c/fss/extended_list.c +++ b/level_1/fl_fss/c/fss/extended_list.c @@ -37,11 +37,7 @@ extern "C" { state->status = f_memory_array_increase(state->step_small, sizeof(f_range_t), (void **) &found->array, &found->used, &found->size); if (F_status_is_error(state->status)) return; - #define ___fl_flag_do_escape___ 0x1 - #define ___fl_flag_has_graph_first___ 0x2 - #define ___fl_flag_has_graph_first_do_escape___ 0x3 - #define ___fl_flag_has_delimit_comment___ 0x4 - #define ___fl_flag_has_delimit_comment_graph_first___ 0x6 + #define ___fl_flag_has_slash___ 0x1 const f_number_unsigned_t delimits_used = delimits->used; const f_number_unsigned_t comments_used = comments->used; @@ -52,7 +48,7 @@ extern "C" { f_number_unsigned_t slash_first = 0; f_number_unsigned_t comment_start = 0; - uint8_t flag_fl = ___fl_flag_has_graph_first___; + uint8_t flag_fl = 0; found->array[found->used].start = range->start; @@ -65,10 +61,18 @@ extern "C" { } f_fss_skip_past_space(buffer, range, state); + + // The skip space returns F_complete_not_utf_start with error bit set on combining/joiner. + if (F_status_set_fine(state->status) == F_complete_not_utf_start) { + f_fss_skip_past_combining_joiner(buffer, range, state); + if (F_status_is_error(state->status)) break; + + continue; + } + if (F_status_is_error(state->status)) break; if (state->status == F_okay_eol) { - flag_fl |= ___fl_flag_has_graph_first___; newline_last = range->start++; line_start = range->start; @@ -78,9 +82,10 @@ extern "C" { if (state->status == F_okay_eos || state->status == F_okay_stop) break; if (buffer.string[range->start] == f_fss_slash_s.string[0]) { - slash_first = range->start; + flag_fl |= ___fl_flag_has_slash___; + slash_first = range->start++; - for (++range->start; range->start <= range->stop && range->start < buffer.used; ++range->start) { + for (; range->start <= range->stop && range->start < buffer.used; ++range->start) { if (state->interrupt) { state->interrupt((void *) state, 0); @@ -88,11 +93,25 @@ extern "C" { } if (buffer.string[range->start] == f_fss_placeholder_s.string[0]) continue; - if (buffer.string[range->start] != f_fss_slash_s.string[0]) break; + // If any slash has a combining/joiner following it, then there is no escaping at all for that slash and therefore it is not considered an escaping character. + if (f_fss_is_combining_joiner(buffer, *range, state) == F_true) { + flag_fl |= ___fl_flag_has_slash___; + + f_fss_skip_past_combining_joiner(buffer, range, state); + + break; + } + + if (F_status_is_error(state->status)) break; + if (buffer.string[range->start] != f_fss_slash_s.string[0]) break; } // for + if (F_status_is_error(state->status)) break; if (range->start > range->stop || range->start >= buffer.used) break; + if (!(flag_fl & ___fl_flag_has_slash___)) continue; + + flag_fl &= ~___fl_flag_has_slash___; // Only the first slash before a close is delimited, all others are maintained. // For example '}' = valid close, '\}' represents '}', '\\}' represents '\}', '\\\}' represents '\\}', '\\\\}' represents '\\\}', and so on.. @@ -100,25 +119,17 @@ extern "C" { if (buffer.string[range->start] == f_fss_extended_list_close_s.string[0]) { ++range->start; - while (range->start <= range->stop && range->start < buffer.used) { - - if (state->interrupt) { - state->interrupt((void *) state, 0); - if (F_status_set_fine(state->status) == F_interrupt) break; - } - - if (buffer.string[range->start] == f_fss_eol_s.string[0]) break; - - if (f_fss_is_space(buffer, *range, state) == F_false) { - if (F_status_is_error(state->status)) break; - - break; - } + f_fss_skip_past_space(buffer, range, state); - state->status = f_utf_buffer_increment(buffer, range, 1); + // The skip space returns F_complete_not_utf_start with error bit set on combining/joiner. + if (F_status_set_fine(state->status) == F_complete_not_utf_start) { + f_fss_skip_past_combining_joiner(buffer, range, state); if (F_status_is_error(state->status)) break; - } // while + continue; + } + + if (F_status_is_error(state->status)) break; if (range->start > range->stop || range->start >= buffer.used) break; if (buffer.string[range->start] == f_fss_eol_s.string[0]) { @@ -134,12 +145,24 @@ extern "C" { } } else if (buffer.string[range->start] == f_fss_comment_s.string[0]) { + previous = ++range->start; + + if (range->start <= range->stop && range->start < buffer.used && 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)) break; + + continue; + } + + range->start = previous; + state->status = f_memory_array_increase(state->step_small, sizeof(f_number_unsigned_t), (void **) &delimits->array, &delimits->used, &delimits->size); if (F_status_is_error(state->status)) break; delimits->array[delimits->used++] = slash_first; } + // It is safe to seek to EOL because only a single f_fss_extended_list_close_s can exist on a single line and be a valid close (aside from white space). f_fss_seek_to_eol(buffer, range, state); if (F_status_is_error(state->status)) break; @@ -149,24 +172,15 @@ extern "C" { if (buffer.string[range->start] == f_fss_extended_list_close_s.string[0]) { ++range->start; - while (range->start <= range->stop && range->start < buffer.used) { - - if (state->interrupt) { - state->interrupt((void *) state, 0); - if (F_status_set_fine(state->status) == F_interrupt) break; - } - - if (buffer.string[range->start] == f_fss_eol_s.string[0]) break; - - if (f_fss_is_space(buffer, *range, state) == F_false) { - if (F_status_is_error(state->status)) break; - - break; - } + f_fss_skip_past_space(buffer, range, state); - state->status = f_utf_buffer_increment(buffer, range, 1); + // The skip space returns F_complete_not_utf_start with error bit set on combining/joiner. + if (F_status_set_fine(state->status) == F_complete_not_utf_start) { + f_fss_skip_past_combining_joiner(buffer, range, state); if (F_status_is_error(state->status)) break; - } // while + + continue; + } if (F_status_is_error(state->status)) break; if (range->start > range->stop || range->start >= buffer.used) break; @@ -198,6 +212,16 @@ extern "C" { } if (buffer.string[range->start] == f_fss_comment_s.string[0]) { + previous = ++range->start; + + if (range->start <= range->stop && range->start < buffer.used && 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)) break; + + continue; + } + + range->start = previous; // The newline_last is initialized to the range->start, which may not actually be a new line. comment_start = (buffer.string[newline_last] == f_string_eol_s.string[0]) ? newline_last + 1 : newline_last; @@ -236,10 +260,7 @@ extern "C" { state->status = F_fss_found_content_not; - #undef ___fl_flag_do_escape___ - #undef ___fl_flag_has_graph_first___ - #undef ___fl_flag_has_delimit_comment___ - #undef ___fl_flag_has_delimit_comment_graph_first___ + #undef ___fl_flag_has_slash___ } #endif // _di_fl_fss_extended_list_content_read_ diff --git a/level_1/fl_fss/data/tests/contents/extended_list-combining_read-1.txt b/level_1/fl_fss/data/tests/contents/extended_list-combining_read-1.txt index 518af0b8f..2fed02e6c 100644 --- a/level_1/fl_fss/data/tests/contents/extended_list-combining_read-1.txt +++ b/level_1/fl_fss/data/tests/contents/extended_list-combining_read-1.txt @@ -1,3 +1,3 @@ - ́ +́ is_second and content 2. - does have ́ content 3. + does have ́ content 3. -- 2.52.0