flag_fl &= ~___fl_flag_has_graph_first___;
- if (buffer.string[range->start] == f_fss_eol_s.string[0]) {
+ if (state->status == F_okay_eol) {
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);
}
// No valid object close found, seek until EOL.
f_fss_seek_to_eol(buffer, range, state);
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;
-
- delimits->array[delimits->used++] = comment_delimit;
- }
-
- newline_last = range->start;
- line_start = newline_last + 1;
- flag_fl |= ___fl_flag_has_graph_first___;
}
}
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;
+ close_location = previous = range->start++;
f_fss_skip_past_space_previous(buffer, range, state, &previous);
if (F_status_is_error(state->status)) break;
if (range->start > range->stop || range->start >= buffer.used) break;
- if (buffer.string[range->start] == f_fss_eol_s.string[0]) {
+ if (state->status == F_okay_eol) {
if (depth >= found->used) {
state->status = f_memory_array_resize(depth + 2, sizeof(f_fss_nest_t), (void **) &found->depth, &found->used, &found->size);
}
line_start = newline_last + 1;
flag_fl |= ___fl_flag_has_graph_first___;
- if (!depth) {
+ if (depth) {
+ --depth;
+ }
+ else {
state->status = f_utf_buffer_increment(buffer, range, 1);
if (F_status_is_error(state->status)) {
return;
}
- if (range->start >= buffer.used) {
- state->status = F_okay_eos;
- } else if (range->start > range->stop) {
- state->status = F_okay_stop;
- }
- else {
- state->status = F_fss_found_content;
- }
+ state->status = F_fss_found_content;
return;
}
-
- --depth;
}
else {
f_range_t range = f_range_t_initialize;
f_range_t found_object = f_range_t_initialize;
- f_ranges_t found_content = f_ranges_t_initialize;
f_ranges_t comments = f_ranges_t_initialize;
- f_fss_nest_t found = f_fss_nest_t_initialize;
+ f_fss_nest_t found_content = f_fss_nest_t_initialize;
f_state_t state = f_state_t_initialize;
f_status_t status_object = F_okay;
f_uint8s_t quotes = f_uint8s_t_initialize;
printf("[ -------> ] --- [04] Failure with getline() for matches, with set %lu, result is negative.\n", set);
}
- assert_true(result >= 0);
+ assert_return_code(result, 0);
matches = atoi(line_matches);
printf("[ -------> ] --- [10] Failure with getline() for counts, with set %lu, result is negative.\n", set);
}
- assert_true(result >= 0);
+ assert_return_code(result, 0);
counts = atoi(line_counts);
- fl_fss_embedded_list_content_read(set_strings, &range, &found, &delimits, &comments, &state);
+ fl_fss_embedded_list_content_read(set_strings, &range, &found_content, &delimits, &comments, &state);
if (!(state.status == F_fss_found_content || state.status == F_data_not)) {
printf("[ -------> ] --- [11] Failure with fl_fss_embedded_list_content_read(), with set %lu, status=%u, expected %u, or %u.\n", set, state.status, F_fss_found_content, F_data_not);
assert_true(state.status == F_fss_found_content || state.status == F_data_not);
if (state.status == F_fss_found_content) {
- if (!found_content.used) {
- printf("[ -------> ] --- [12] Failure with fl_fss_embedded_list_content_read(), with set %lu, expected found_content.used (%lu) <> 0.\n", set, found_content.used);
+ if (!(found_content.used && found_content.depth[0].used && found_content.depth[0].array[0].content.used)) {
+ printf(
+ "[ -------> ] --- [12] Failure with fl_fss_embedded_list_content_read(), with set %lu, expected found_content.used (%lu) <> 0 or found_content.depth.used (%lu) <> 0 or found_content.depth[0].array[0].content.used (%lu) <> 0 <> 0.\n",
+ set,
+ found_content.used,
+ found_content.used
+ ? found_content.depth[0].used
+ : 0,
+ found_content.used && found_content.depth[0].used
+ ? found_content.depth[0].array[0].content.used
+ : 0
+ );
}
- assert_true(found_content.used);
+ assert_true(found_content.used && found_content.depth[0].used && found_content.depth[0].array[0].content.used);
- if (found_content.used != (f_number_unsigned_t) counts) {
- printf("[ -------> ] --- [13] Failure with fl_fss_embedded_list_content_read(), with set %lu, expected found_content.used (%lu) == %lu, found = '%s', expected = '%s'.\n", set, found_content.used, (f_number_unsigned_t) counts, set_result.string ? set_result.string : "", set_contents[set].string ? set_contents[set].string : "");
+ if (found_content.depth[0].used != (f_number_unsigned_t) counts) {
+ printf("[ -------> ] --- [13] Failure with fl_fss_embedded_list_content_read(), with set %lu, expected found_content.depth[0].used (%lu) == %lu, found = '%s', expected = '%s'.\n", set, found_content.depth[0].used, (f_number_unsigned_t) counts, set_result.string ? set_result.string : "", set_contents[set].string ? set_contents[set].string : "");
}
- assert_true(found_content.used == (f_number_unsigned_t) counts);
+ assert_true(found_content.depth[0].used == (f_number_unsigned_t) counts);
state.status = F_none;
assert_int_equal(state.status, F_okay);
{
- const f_status_t status = data__extract_from_source(set_delimit, found_content.array[0], &set_result);
+ const f_status_t status = data__extract_from_source(set_delimit, found_content.depth[0].array[0].content.array[0], &set_result);
if (F_status_is_error(status)) {
printf("[ -------> ] --- [15] Failure with data__extract_from_source() for extract set contents, with set %lu, status=%u has error bit set.\n", set, status);
if (comments.array) free(comments.array);
if (delimits.array) free(delimits.array);
- if (found_content.array) free(found_content.array);
if (quotes.array) free(quotes.array);
if (line_counts) free(line_counts);
if (line_object) free(line_object);
if (set_result.string) free(set_result.string);
- f_fss_nest_delete(&found);
+ f_fss_nest_delete(&found_content);
comments.array = 0;
comments.used = 0;
delimits.array = 0;
delimits.used = 0;
delimits.size = 0;
- found_content.array = 0;
+ found_content.depth = 0;
found_content.used = 0;
found_content.size = 0;
line_counts = 0;
if (comments.array) free(comments.array);
if (delimits.array) free(delimits.array);
- if (found_content.array) free(found_content.array);
if (quotes.array) free(quotes.array);
- f_fss_nest_delete(&found);
+ f_fss_nest_delete(&found_content);
}
}