return;
}
- while (range->start <= range->stop && range->start < buffer.used) {
+ const f_number_unsigned_t initial = *count;
+
+ for (; range->start <= range->stop && range->start < buffer.used; ++range->start) {
if (state->interrupt) {
state->interrupt((void *) state, 0);
}
if (buffer.string[range->start] == f_fss_placeholder_s.string[0]) {
- ++range->start;
-
- continue;
+ // Do nothing.
}
-
- if (buffer.string[range->start] == f_fss_slash_s.string[0]) {
+ else if (buffer.string[range->start] == f_fss_slash_s.string[0]) {
++(*count);
}
else {
if (private_f_fss_is_combining_joiner(buffer, *range, state) == F_true) {
+
+ // A combining joiner invalidates as slash immediately before it and there is only a preceding slash if count > initial.
+ if (*count > initial) --(*count);
+
const f_status_t status = state->status;
private_f_fss_skip_past_combining_joiner(buffer, range, state);
return;
}
-
- state->status = f_utf_buffer_increment(buffer, range, 1);
- if (F_status_is_error(state->status)) return;
- } // while
+ } // for
if (range->start > range->stop) {
state->status = F_okay_stop;
*
* F_interrupt (with error bit) if stopping due to an interrupt.
* F_parameter (with error bit) if a parameter is invalid.
- *
- * Errors (with error bit) from f_utf_buffer_increment().
*/
#ifndef _di_f_fss_count_slash_
extern void f_fss_count_slash(const f_string_static_t buffer, f_range_t * const range, f_number_unsigned_t * const count, f_state_t * const state);
* F_interrupt (with error bit) if stopping due to an interrupt.
* F_parameter (with error bit) if a parameter is invalid.
*
+ * Errors (with error bit) from: f_fss_count_slash().
* Errors (with error bit) from: f_fss_is_graph().
* Errors (with error bit) from: f_fss_is_space().
* Errors (with error bit) from: f_fss_is_zero_width().
* Errors (with error bit) from: f_fss_seek_to_eol().
* Errors (with error bit) from: f_fss_skip_past_delimit().
* Errors (with error bit) from: f_fss_skip_past_space().
+ * Errors (with error bit) from: f_fss_slash_count().
* Errors (with error bit) from: f_memory_array_increase_by().
* Errors (with error bit) from: f_utf_buffer_increment().
*
+ * @see f_fss_count_slash()
* @see f_fss_is_graph()
* @see f_fss_is_space()
* @see f_fss_is_zero_width()
slash_count = 1;
flag_fl |= ___fl_flag_do_escape___;
- for (; range->start <= range->stop && range->start < buffer.used; ++range->start) {
+ f_fss_count_slash(buffer, range, &slash_count, state);
+ if (F_status_is_error(state->status)) return;
- 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_placeholder_s.string[0]) continue;
-
- // 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_graph_first_do_escape___;
-
- 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;
-
- ++slash_count;
- } // for
+ flag_fl &= ~___fl_flag_do_escape___;
- if (F_status_is_error(state->status)) break;
if (range->start > range->stop || range->start >= buffer.used) break;
- if (!(flag_fl & ___fl_flag_do_escape___)) continue;
-
- flag_fl &= ~___fl_flag_do_escape___;
+ if (state->status == F_combarudoo || state->status == F_bound) continue;
if (buffer.string[range->start] == f_fss_basic_list_open_s.string[0]) {
flag_fl &= ~___fl_flag_has_graph_first___;
if (object.string[range->start] == f_fss_slash_s.string[0]) {
slash_count = 1;
- for (++range->start; range->start <= range->stop && range->start < object.used; ++range->start) {
-
- if (state->interrupt) {
- state->interrupt((void *) state, 0);
- if (F_status_set_fine(state->status) == F_interrupt) break;
- }
-
- if (object.string[range->start] == f_fss_placeholder_s.string[0]) continue;
- if (object.string[range->start] != f_fss_slash_s.string[0]) break;
-
- ++slash_count;
- } // for
-
+ f_fss_count_slash(object, range, &slash_count, state);
if (F_status_is_error(state->status)) break;
+ // Slashes at the end of the object must be delimited to avoid delimiting the object close character.
if (range->start > range->stop || range->start >= object.used) {
-
- // Slashes at the end of the object must be delimited to avoid delimiting the object close character.
slash_count *= 2;
}
* F_interrupt (with error bit) if stopping due to an interrupt.
* F_parameter (with error bit) if a parameter is invalid.
*
+ * Errors (with error bit) from: f_fss_count_slash().
* Errors (with error bit) from: f_fss_is_graph().
* Errors (with error bit) from: f_fss_is_space().
* Errors (with error bit) from: f_fss_is_zero_width().
* Errors (with error bit) from: f_memory_array_increase_by().
* Errors (with error bit) from: f_utf_buffer_increment().
*
+ * @see f_fss_count_slash()
* @see f_fss_is_graph()
* @see f_fss_is_space()
* @see f_fss_is_zero_width()
if (object.string[range->start] == f_fss_slash_s.string[0]) {
slash_count = 1;
- for (++range->start; range->start <= range->stop && range->start < object.used; ++range->start) {
-
- if (state->interrupt) {
- state->interrupt((void *) state, 0);
-
- if (F_status_set_fine(state->status) == F_interrupt) {
- destination->used = destination_used;
-
- return;
- }
- }
-
- if (object.string[range->start] == f_fss_placeholder_s.string[0]) continue;
- if (object.string[range->start] != f_fss_slash_s.string[0]) break;
-
- ++slash_count;
- } // for
+ f_fss_count_slash(object, range, &slash_count, state);
+ if (F_status_is_error(state->status)) return;
if (range->start > range->stop || range->start >= object.used) {
* F_interrupt (with error bit) if stopping due to an interrupt.
* F_parameter (with error bit) if a parameter is invalid.
*
+ * Errors (with error bit) from: f_fss_count_slash().
* Errors (with error bit) from: f_fss_is_graph().
* Errors (with error bit) from: f_fss_is_space().
* Errors (with error bit) from: f_fss_is_zero_width().
* Errors (with error bit) from: f_memory_array_increase_by().
* Errors (with error bit) from: f_utf_buffer_increment().
*
+ * @see f_fss_count_slash()
* @see f_fss_is_graph()
* @see f_fss_is_space()
* @see f_fss_is_zero_width()
* F_interrupt (with error bit) if stopping due to an interrupt.
* F_parameter (with error bit) if a parameter is invalid.
*
+ * Errors (with error bit) from: f_fss_count_slash().
* Errors (with error bit) from: f_fss_is_graph().
* Errors (with error bit) from: f_fss_is_space().
* Errors (with error bit) from: f_fss_is_zero_width().
* Errors (with error bit) from: f_fss_skip_past_space().
* Errors (with error bit) from: f_utf_buffer_increment().
*
+ * @see f_fss_count_slash()
* @see f_fss_is_graph()
* @see f_fss_is_space()
* @see f_fss_is_zero_width()
* F_interrupt (with error bit) if stopping due to an interrupt.
* F_parameter (with error bit) if a parameter is invalid.
*
+ * Errors (with error bit) from: f_fss_count_slash().
* Errors (with error bit) from: f_fss_is_graph().
* Errors (with error bit) from: f_fss_is_space().
* Errors (with error bit) from: f_fss_is_zero_width().
* Errors (with error bit) from: f_memory_array_increase().
* Errors (with error bit) from: f_utf_buffer_increment().
*
+ * @see f_fss_count_slash()
* @see f_fss_is_graph()
* @see f_fss_is_space()
* @see f_fss_is_zero_width()
if (object.string[range->start] == f_fss_slash_s.string[0]) {
slash_count = 1;
- for (++range->start; range->start <= range->stop && range->start < object.used; ++range->start) {
-
- if (state->interrupt) {
- state->interrupt((void *) state, 0);
-
- if (F_status_set_fine(state->status) == F_interrupt) {
- destination->used = destination_used;
-
- return;
- }
- }
-
- if (object.string[range->start] == f_fss_placeholder_s.string[0]) continue;
- if (object.string[range->start] != f_fss_slash_s.string[0]) break;
-
- ++slash_count;
- } // for
+ f_fss_count_slash(object, range, &slash_count, state);
+ if (F_status_is_error(state->status)) return;
if (range->start > range->stop || range->start >= object.used) {
* F_interrupt (with error bit) if stopping due to an interrupt.
* F_parameter (with error bit) if a parameter is invalid.
*
+ * Errors (with error bit) from: f_fss_count_slash().
* Errors (with error bit) from: f_fss_is_graph().
* Errors (with error bit) from: f_fss_is_space().
* Errors (with error bit) from: f_fss_is_zero_width().
* Errors (with error bit) from: f_memory_array_increase_by().
* Errors (with error bit) from: f_utf_buffer_increment().
*
+ * @see f_fss_count_slash()
* @see f_fss_is_graph()
* @see f_fss_is_space()
* @see f_fss_is_zero_width()
line_start = slash_first;
}
- // If any slash has a combining/joiner following it, then there is no escaping at all but this is not a valid escaping slash.
- while (F_status_is_error_not(state->status) && range->start <= range->stop && range->start < buffer.used) {
-
- if (state->interrupt) {
- state->interrupt((void *) state, 0);
- if (F_status_is_error(state->status)) break;
- }
-
- if (buffer.string[range->start] == f_fss_placeholder_s.string[0]) {
- // Do nothing.
- }
- else 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) {
- flag_fl &= ~___fl_flag_do_escape___;
-
- f_fss_skip_past_combining_joiner(buffer, range, state);
-
- break;
- }
- else {
- break;
- }
-
- if (F_status_is_error_not(state->status)) {
- state->status = f_utf_buffer_increment(buffer, range, 1);
- }
- } // while
-
- if (F_status_is_error(state->status)) break;
- if (!(flag_fl & ___fl_flag_do_escape___)) continue;
+ f_fss_count_slash(buffer, range, &slash_count, state);
+ if (F_status_is_error(state->status)) return;
flag_fl &= ~___fl_flag_do_escape___;
return;
}
+ if (state->status == F_combarudoo || state->status == F_bound) continue;
+
if (buffer.string[range->start] == list_open.string[0]) {
flag_fl &= ~___fl_flag_has_graph_first___;
line_stop = range->start++;
* F_interrupt (with error bit) if stopping due to an interrupt.
* F_parameter (with error bit) if a parameter is invalid.
*
+ * Errors (with error bit) from: f_fss_count_slash().
* Errors (with error bit) from: f_fss_is_graph().
* Errors (with error bit) from: f_fss_is_space().
* Errors (with error bit) from: f_fss_is_zero_width().
* Errors (with error bit) from: f_memory_array_increase_by().
* Errors (with error bit) from: f_utf_buffer_increment().
*
+ * @see f_fss_count_slash()
* @see f_fss_is_graph()
* @see f_fss_is_space()
* @see f_fss_is_zero_width()
flag_fl &= ~___fl_flag_has_joiner_combining___;
- while (range->start <= range->stop && range->start < buffer.used) {
+ f_fss_count_slash(buffer, range, &slash_count, state);
- if (state->interrupt) {
- state->interrupt((void *) state, 0);
- if (F_status_set_fine(state->status) == F_interrupt) return;
- }
-
- if (buffer.string[range->start] == f_fss_placeholder_s.string[0]) {
- ++range->start;
-
- continue;
- }
-
- 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);
-
- flag_fl |= ___fl_flag_has_joiner_combining___;
- }
-
- 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 (F_status_is_error(state->status)) return;
+ if (state->status == F_combarudoo || state->status == F_bound) continue;
if (range->start >= buffer.used) {
found->stop = buffer.used - 1;
if (buffer.string[range->start] == f_fss_slash_s.string[0]) {
if (slash_count % 2 == 1) {
- delimits->array[delimits->used] = range->start;
- ++delimits->used;
+ delimits->array[delimits->used++] = range->start;
}
--slash_count;
item_first = partial.start = range->start++;
item_total = 1;
- for (; range->start <= range->stop && range->start < object.used; ++range->start) {
-
- if (state->interrupt) {
- state->interrupt((void *) state, internal);
- if (F_status_set_fine(state->status) == F_interrupt) break;
- }
-
- if (object.string[range->start] == f_fss_slash_s.string[0]) { // TODO: Verify no combining joiners following. Also, skip past slashes? Or count slashes function?
- ++item_total;
- }
- else if (object.string[range->start] != f_fss_placeholder_s.string[0]) {
- break;
- }
- } // for
+ f_fss_count_slash(object, range, &item_total, state);
+ if (F_status_is_error(state->status)) return;
if (range->start > range->stop || range->start >= object.used) {
*
* Errors (with error bit) from: f_memory_array_increase().
* Errors (with error bit) from: f_memory_array_increase_by().
+ * Errors (with error bit) from: f_fss_count_slash().
* Errors (with error bit) from: f_fss_is_combining_joiner().
* Errors (with error bit) from: f_fss_is_graph().
* Errors (with error bit) from: f_fss_is_space().
*
* @see f_memory_array_increase()
* @see f_memory_array_increase_by()
+ * @see f_fss_count_slash()
* @see f_fss_is_combining_joiner()
* @see f_fss_is_graph()
* @see f_fss_is_space()