range->start = slash_first;
if (slash_count % 2 == 0) {
- 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)) break;
-
found->array[found->used++].stop = newline_last;
range->start = previous + 1;
state->status = F_fss_found_content;
// Found a valid object, set stop point to last newline (if newline_last is begin, there newline_last is not a new line).
if (state->status == F_okay_eol) {
- 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)) break;
-
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;
return;
}
- 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;
-
// The EOS and stop cases only happen here when the next object is not found, so do not increment found.used and let caller handle.
if (range->start >= buffer.used) {
found->array[found->used].stop = buffer.used - 1;
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_has_slash___ 0x1
+ #define ___fl_flag_has_line_first___ 0x1
+ #define ___fl_flag_has_slash___ 0x2
const f_number_unsigned_t begin = range->start;
const f_number_unsigned_t delimits_used = delimits->used;
f_number_unsigned_t slash_first = 0;
f_number_unsigned_t comment_start = 0;
- uint8_t flag_fl = 0;
+ uint8_t flag_fl = ___fl_flag_has_line_first___;
found->array[found->used].start = range->start;
if (F_status_set_fine(state->status) == F_interrupt) break;
}
- f_fss_skip_past_space(buffer, range, state);
+ if (state->status != F_okay_eol) {
+ 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;
+ // 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;
- }
+ continue;
+ }
- if (F_status_is_error(state->status)) break;
+ if (F_status_is_error(state->status)) break;
+ }
if (state->status == F_okay_eol) {
newline_last = range->start++;
line_start = range->start;
+ flag_fl &= ~___fl_flag_has_line_first___;
// Any line that starts with a combining/joiner must be treated as Content and not as an Object.
f_fss_skip_past_delimit(buffer, range, state);
if (range->start > range->stop || range->start >= buffer.used) break;
if (state->status == F_okay_eol) {
- newline_last = range->start;
- line_start = range->start + 1;
-
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;
+ state->status = F_okay_eol;
continue;
}
++range->start;
- // If the last newline is the entire start, then there is no Content (if newline_last is begin, there newline_last is not a new line).
- if (begin != newline_last && newline_last == found->array[found->used].start) {
+ if (flag_fl & ___fl_flag_has_line_first___) {
found->array[found->used].start = 1;
found->array[found->used++].stop = 0;
-
state->status = F_fss_found_content_not;
}
else {
comments->array[comments->used].start = comment_start;
comments->array[comments->used++].stop = range->start++;
+ flag_fl &= ~___fl_flag_has_line_first___;
continue;
}
state->status = F_fss_found_content_not;
+ #undef ___fl_flag_has_line_first___
#undef ___fl_flag_has_slash___
}
#endif // _di_fl_fss_extended_list_content_read_