state->status = f_memory_array_increase_by(4, sizeof(f_char_t), (void **) &destination->string, &destination->used, &destination->size);
if (F_status_is_error(state->status)) return;
+ #define ___fl_flag_ends_on_space___ 0x1
#define ___fl_flag_has_graph___ 0x2
#define ___fl_flag_is_comment___ 0x4
#define ___fl_flag_is_combining___ 0x8
f_number_unsigned_t previous = 0;
f_number_unsigned_t slash_count = 0;
- uint8_t flag = 0;
- uint8_t ends_on_space = F_false;
+ uint8_t flag = 0x0;
uint8_t width = 0;
// Find the first graph character.
} // while
if (range->start > range->stop || range->start >= object.used) {
- ends_on_space = F_false;
+ flag &= ~___fl_flag_ends_on_space___;
break;
}
if (F_status_is_error(state->status)) break;
}
else {
- ends_on_space = F_true;
+ flag |= ___fl_flag_ends_on_space___;
if (object.string[range->start] == f_fss_eol_s.string[0]) {
state->status = F_status_set_error(F_okay_eol);
}
// Prevent a space from being added post-trimming.
- ends_on_space = F_true;
+ flag |= ___fl_flag_ends_on_space___;
}
if (complete != f_fss_complete_trim_e) {
return;
}
- if (!ends_on_space) {
+ if (!(flag & ___fl_flag_ends_on_space___)) {
destination->string[destination->used++] = f_fss_space_s.string[0];
}
state->status = F_okay;
}
+ #undef ___fl_flag_ends_on_space___
#undef ___fl_flag_has_graph___
#undef ___fl_flag_is_comment___
#undef ___fl_flag_is_combining___
state->status = f_memory_array_increase_by(4, sizeof(f_char_t), (void **) &destination->string, &destination->used, &destination->size);
if (F_status_is_error(state->status)) return;
+ #define ___fl_flag_ends_on_space___ 0x1
#define ___fl_flag_has_eol___ 0x2
#define ___fl_flag_has_eol_do_prepend___ 0x3
#define ___fl_flag_has_graph___ 0x4
f_number_unsigned_t previous = 0;
f_number_unsigned_t slash_count = 0;
- uint8_t flag = 0;
- uint8_t ends_on_space = F_false;
+ uint8_t flag = 0x0;
uint8_t width = 0;
// Find the first graph character.
} // while
if (range->start > range->stop || range->start >= object.used) {
- ends_on_space = F_false;
+ flag &= ~___fl_flag_ends_on_space___;
break;
}
if (F_status_is_error(state->status)) break;
}
else {
- ends_on_space = F_true;
+ flag |= ___fl_flag_ends_on_space___;
if (object.string[range->start] == f_fss_eol_s.string[0]) {
state->status = F_status_set_error(F_okay_eol);
}
// Prevent a space from being added post-trimming.
- ends_on_space = F_true;
+ flag |= ___fl_flag_ends_on_space___;
}
if (complete != f_fss_complete_trim_e) {
return;
}
- if (!ends_on_space) {
+ if (!(flag & ___fl_flag_ends_on_space___)) {
destination->string[destination->used++] = f_fss_space_s.string[0];
}
state->status = F_okay;
}
+ #undef ___fl_flag_ends_on_space___
#undef ___fl_flag_has_eol___
#undef ___fl_flag_has_eol_do_prepend___
#undef ___fl_flag_has_graph___
return;
}
- const f_number_unsigned_t delimits_used = delimits->used;
- const f_number_unsigned_t begin = range->start;
+ #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
- f_number_unsigned_t previous = 0;
+ const f_number_unsigned_t begin = range->start;
found->start = begin;
range->start = begin;
}
+ const f_number_unsigned_t delimits_used = delimits->used;
+
+ f_number_unsigned_t first_slash = 0;
+ f_number_unsigned_t location = 0;
+ f_number_unsigned_t previous = 0;
+ f_number_unsigned_t slash_count = 0;
+
+ uint8_t flag_fl = 0x0;
f_char_t quote_found = 0;
if (quote) *quote = f_fss_quote_type_none_e;
// Identify where the object begins.
if (buffer.string[range->start] == f_fss_slash_s.string[0]) {
- f_number_unsigned_t first_slash = found->start = range->start;
+ first_slash = found->start = range->start;
+ flag_fl |= ___fl_flag_do_escape___;
state->status = f_utf_buffer_increment(buffer, range, 1);
+ if (state->status == F_okay) {
+ f_fss_skip_past_delimit(buffer, range, state);
+ }
+
+ // 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)) {
- while (range->start <= range->stop && range->start < buffer.used) {
+ if (f_fss_is_combining_joiner(buffer, *range, state) != F_false) {
+ range->start = first_slash;
+ flag_fl &= ~___fl_flag_do_escape___;
+ }
+ }
+
+ if (F_status_is_error(state->status)) return;
+
+ if (flag_fl & ___fl_flag_do_escape___) {
+ 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 (buffer.string[range->start] == f_fss_placeholder_s.string[0]) {
state->status = f_utf_buffer_increment(buffer, range, 1);
- if (F_status_is_error(state->status)) return;
continue;
}
}
state->status = f_utf_buffer_increment(buffer, range, 1);
- if (F_status_is_error(state->status)) return;
} // while
+
+ if (F_status_is_error(state->status)) return;
+
+ flag_fl &= ~___fl_flag_do_escape___;
}
if (range->start >= buffer.used) {
// Identify where the object ends.
if (quote_found) {
- f_number_unsigned_t first_slash = 0;
- f_number_unsigned_t slash_count = 0;
- f_number_unsigned_t location = 0;
+ first_slash = 0;
+ slash_count = 0;
+ location = 0;
while (range->start <= range->stop && range->start < buffer.used) {
++range->start;
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___
}
#endif // !defined(_di_fl_fss_basic_object_read_) || !defined(_di_fl_fss_extended_object_read_)