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_delimit_comment___ 0x4
+ #define ___fl_flag_has_delimit_comment_graph_first___ 0x6
+
const f_number_unsigned_t delimits_used = delimits->used;
const f_number_unsigned_t comments_used = comments->used;
f_number_unsigned_t start = 0;
f_number_unsigned_t comment_delimit = 0;
- uint8_t graph_first = 0x1; // 0x0 = false, 0x1 = true, 0x2 = false, but there is a delimited comment, comment_delimit is set.
+ uint8_t flag_fl = ___fl_flag_has_graph_first___;
// Identify where the content ends.
while (range->start <= range->stop && range->start < buffer.used) {
}
if (buffer.string[range->start] == f_fss_eol_s.string[0]) {
- if (graph_first == 0x2) {
+ if (flag_fl & ___fl_flag_has_delimit_comment___) {
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;
}
newline_last = range->start;
- graph_first = 0x1;
+ flag_fl |= ___fl_flag_has_graph_first___;
++range->start;
continue;
if (range->start > range->stop || range->start >= buffer.used) break;
if (buffer.string[range->start] == f_fss_basic_list_open_s.string[0]) {
- graph_first = 0x0;
+ flag_fl &= ~___fl_flag_has_delimit_comment_graph_first___;
++range->start;
while (range->start <= range->stop && range->start < buffer.used) {
if (F_status_is_error(state->status)) break;
- if (graph_first == 0x2) {
+ if (flag_fl & ___fl_flag_has_delimit_comment___) {
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++] = comment_delimit;
}
- graph_first = 0x1;
+ flag_fl |= ___fl_flag_has_graph_first___;
range->start = start + 1;
}
}
- else if (graph_first == 0x1 && buffer.string[range->start] == f_fss_comment_s.string[0]) {
- graph_first = 0x2;
+ else if ((flag_fl & ___fl_flag_has_graph_first___) && buffer.string[range->start] == f_fss_comment_s.string[0]) {
+ flag_fl &= ___fl_flag_has_delimit_comment___;
comment_delimit = slash_first;
++range->start;
}
if (buffer.string[range->start] == f_fss_basic_list_open_s.string[0]) {
++range->start;
- graph_first = 0x0;
+ flag_fl &= ~___fl_flag_has_delimit_comment_graph_first___;
while (range->start <= range->stop && range->start < buffer.used) {
}
if (buffer.string[range->start] == f_fss_eol_s.string[0]) {
- if (graph_first == 0x2) {
+ if (flag_fl & ___fl_flag_has_delimit_comment___) {
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;
}
newline_last = range->start;
- graph_first = 0x1;
+ flag_fl |= ___fl_flag_has_graph_first___;
}
continue;
}
- if (graph_first == 0x1 && buffer.string[range->start] == f_fss_comment_s.string[0]) {
+ if ((flag_fl & ___fl_flag_has_graph_first___) && buffer.string[range->start] == f_fss_comment_s.string[0]) {
// The newline_last is initialized to the range->start, which may not actually be a new line.
if (buffer.string[newline_last] == f_string_eol_s.string[0]) {
continue;
}
- if (graph_first == 0x1) {
+ if (flag_fl & ___fl_flag_has_graph_first___) {
if (f_fss_is_space(buffer, *range, state) == F_false) {
if (F_status_is_error(state->status)) break;
- graph_first = 0x0;
+ flag_fl &= ~___fl_flag_has_delimit_comment_graph_first___;
}
}
}
state->status = F_fss_found_content;
+
+ #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___
}
#endif // _di_fl_fss_basic_list_content_read_
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_delimit_comment___ 0x4
+ #define ___fl_flag_has_delimit_comment_graph_first___ 0x6
+ #define ___fl_flag_is_delimit_close___ 0x8
+ #define ___fl_flag_is_delimit_close_delimit_comment___ 0xc
+ #define ___fl_flag_is_object___ 0x10
+ #define ___fl_flag_is_open___ 0x20
+ #define ___fl_flag_is_open_close_graph_first___ 0x2a
+
const f_number_unsigned_t delimits_used = delimits->used;
const f_number_unsigned_t comments_used = comments->used;
f_number_unsigned_t before_list_open = position_previous;
f_number_unsigned_t close_location = 0;
- // 0x0 = is false for all, 0x1 = is first graph, 0x2 = is delimited comment, 0x4 = is open, 0x8 = is object, 0x10 = is delimited close.
- uint8_t is_state = 0x1;
+ uint8_t flag_fl = ___fl_flag_has_graph_first___;
// Initialize depth 1 start position.
// Positions_start.used is used as a max depth (such that cache->positions->used == max depth + 1).
}
if (buffer.string[range->start] == f_fss_eol_s.string[0]) {
- if (is_state & 0x2) {
+ if (flag_fl & ___fl_flag_has_delimit_comment___) {
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;
newline_last = position_previous = range->start++;
line_start = range->start;
- is_state = 0x1;
+ flag_fl |= ___fl_flag_has_graph_first___;
}
- else if (buffer.string[range->start] == f_fss_slash_s.string[0] && (is_state & 0x1)) {
+ else if (buffer.string[range->start] == f_fss_slash_s.string[0] && (flag_fl & ___fl_flag_has_graph_first___)) {
slash_first = slash_last = position_previous = range->start++;
cache->slashes->array[depth] = 1;
// For example '}' = valid close, '\}' represents '}', '\\}' represents '\}', '\\\}' represents '\\}', '\\\\}' represents '\\\}', and so on..
// When slash is odd and a (delimited) valid open/close is found, then save delimited positions and continue.
if (buffer.string[range->start] == f_fss_eol_s.string[0]) {
- if (is_state & 0x2) {
+ if (flag_fl & ___fl_flag_has_delimit_comment___) {
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;
newline_last = position_previous = range->start++;
line_start = range->start;
- is_state = 0x1;
+ flag_fl |= ___fl_flag_has_graph_first___;
}
else if (buffer.string[range->start] == f_fss_embedded_list_open_s.string[0] || buffer.string[range->start] == f_fss_embedded_list_close_s.string[0]) {
before_list_open = position_previous;
- is_state &= ~0x15;
+ flag_fl &= ~___fl_flag_is_open_close_graph_first___;
if (buffer.string[range->start] == f_fss_embedded_list_open_s.string[0]) {
- is_state |= 0x4;
+ flag_fl |= ___fl_flag_is_open___;
}
position_previous = range->start++;
newline_last = range->start;
line_start = newline_last + 1;
- if (is_state & 0x4) {
+ if (flag_fl & ___fl_flag_is_open___) {
if (cache->slashes->array[depth] % 2 == 0) {
- is_state |= 0x8;
+ flag_fl |= ___fl_flag_is_object___;
}
else {
- is_state &= ~0x8;
+ flag_fl &= ~___fl_flag_is_object___;
}
range->start = slash_first;
} // while
// When slashes are even, the object is valid and needs to be processed.
- if (is_state & 0x8) {
+ if (flag_fl & ___fl_flag_is_object___) {
if (++depth >= cache->objects->size) {
state->status = f_memory_array_resize(depth + 2, sizeof(f_range_t), (void **) &cache->objects->array, &cache->objects->used, &cache->objects->size);
}
}
}
else {
- is_state |= 0x10;
+ flag_fl |= ___fl_flag_is_delimit_close___;
}
- if (is_state & 0x12) {
+ if (flag_fl & ___fl_flag_is_delimit_close_delimit_comment___) {
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;
}
range->start = line_start;
- is_state = 0x1;
+ flag_fl |= ___fl_flag_has_graph_first___;
}
}
- else if (buffer.string[range->start] == f_fss_comment_s.string[0] && (is_state & 0x1)) {
- is_state |= 0x2;
- is_state &= ~0x1;
+ else if (buffer.string[range->start] == f_fss_comment_s.string[0] && (flag_fl & ___fl_flag_has_graph_first___)) {
+ flag_fl |= ___fl_flag_is_delimit_close___;
+ flag_fl &= ~___fl_flag_has_graph_first___;
comment_delimit = slash_first;
}
else {
- is_state &= ~0x1;
+ flag_fl &= ~___fl_flag_has_graph_first___;
}
}
else if (buffer.string[range->start] == f_fss_embedded_list_open_s.string[0]) {
- is_state &= ~0x1;
+ flag_fl &= ~___fl_flag_has_graph_first___;
before_list_open = position_previous;
position_previous = range->start;
cache->slashes->used = depth + 1;
}
- if (is_state & 0x2) {
+ if (flag_fl & ___fl_flag_has_delimit_comment___) {
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;
newline_last = range->start;
line_start = newline_last + 1;
- is_state = 0x1;
+ flag_fl |= ___fl_flag_has_graph_first___;
}
else {
f_fss_seek_to_eol(buffer, range, state);
if (F_status_is_error(state->status)) break;
- if (is_state & 0x2) {
+ if (flag_fl & ___fl_flag_has_delimit_comment___) {
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;
newline_last = range->start;
line_start = newline_last + 1;
- is_state = 0x1;
+ flag_fl |= ___fl_flag_has_graph_first___;
}
}
- else if (buffer.string[range->start] == f_fss_embedded_list_close_s.string[0] && (is_state & 0x1)) {
+ 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;
while (range->start <= range->stop && range->start < buffer.used) {
found->used = depth + 1;
}
- if (is_state & 0x2) {
+ if (flag_fl & ___fl_flag_has_delimit_comment___) {
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;
newline_last = range->start;
line_start = newline_last + 1;
- is_state = 0x1;
+ flag_fl |= ___fl_flag_has_graph_first___;
if (!depth) {
state->status = f_utf_buffer_increment(buffer, range, 1);
}
if (buffer.string[range->start] == f_fss_eol_s.string[0]) {
- if (is_state & 0x2) {
+ if (flag_fl & ___fl_flag_has_delimit_comment___) {
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;
newline_last = range->start;
line_start = newline_last + 1;
- is_state = 0x1;
+ flag_fl |= ___fl_flag_has_graph_first___;
break;
}
if (F_status_is_error(state->status) || state->status == F_interrupt) break;
}
}
- else if (buffer.string[range->start] == f_fss_comment_s.string[0] && (is_state & 0x1)) {
+ else if (buffer.string[range->start] == f_fss_comment_s.string[0] && (flag_fl & ___fl_flag_has_graph_first___)) {
// 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;
--range->start;
}
else {
- if (is_state & 0x2) {
+ if (flag_fl & ___fl_flag_has_delimit_comment___) {
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;
newline_last = range->start;
line_start = newline_last + 1;
- is_state = 0x1;
+ flag_fl |= ___fl_flag_has_graph_first___;
}
state->status = f_memory_array_increase(state->step_small, sizeof(f_range_t), (void **) &comments->array, &comments->used, &comments->size);
else if (buffer.string[range->start] != f_fss_eol_s.string[0]) {
position_previous = range->start;
- if (is_state & 0x1) {
+ if (flag_fl & ___fl_flag_has_graph_first___) {
if (f_fss_is_space(buffer, *range, state) == F_false) {
- is_state &= ~0x1;
+ flag_fl &= ~___fl_flag_has_graph_first___;
}
}
state->status = F_status_set_error(depth ? F_end_not_nest_eos : F_end_not_eos);
}
}
+
+ #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_is_delimit_close___
+ #undef ___fl_flag_is_delimit_close_delimit_comment___
+ #undef ___fl_flag_is_object___
+ #undef ___fl_flag_is_open___
+ #undef ___fl_flag_is_open_close_graph_first___
}
#endif // _di_fl_fss_embedded_list_content_read_