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;
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;
// 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);
}
}
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;
}
}
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.
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;
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) {
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;
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;
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]) {
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) {
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;
}
}
}
// 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]) {
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);
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]) {
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);
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;
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
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_)