The program flags for the standard-specific functionality vs the program arguments were previously stored in the same bit space.
This breaks the two parts into the main program flags and the "feature" flags.
Implement support for new functionality where the Object structure can be optionally preserved.
Implement support for new functionality where the tabbing of the Object can be preserved, even when trimmed.
This is a step towards a "pretty print" mode that is more or less an "original print" mode.
The tabbing structure is now well preserved for standards like FSS Extended List (FSS-0003).
The Object alignment can determined from the Object close.
Use the `closes` structure to identify how the Object end is tabbed.
Then use that tabbing for the Object.
When trimming is enabled, still apply that tabbing.
This is done only for standards where such behavior makes sense.
The original print is now better preserved.
Printing an Object can now print the before and after Object characters (usually white space).
The trimming and original print may be used together to produce the results where the is no white space before or after the Object but everything else from the original source is preserved.
This combination of trim and original essentially ensure that the old behavior can be still produced.
I would further note that the processing of the FSS Embedded List (FSS-0008) Objects is not recursively performed.
No trimming or anything like that is applied at this time.
Only the selected depth is recursed into such that the Object and Content are processed.
I made this decision to keep the design as simple as possible.
Should I get the motivation and the time, then I may at some point in the future decided to recursively process and format all of the embedded structures.
I happened to notice duplicate and unused flags.
These are now removed.
Update the runtime tests accordingly.
Add new runtime tests to test the updated behavior.
I used the 0.6 and 0.7 to test these and I compared the results.
There is a discrepancy in some of 0.6 and 0.7 tests.
I will have to follow this commit with additional test fixes as necessary pending further review.
#endif // _di_fss_basic_list_read_files_t_
/**
- * The data structure for FSS Basic Read.
+ * The data structure for FSS Basic List Read.
*
* fss_basic_list_read_data_option_*:
* - at: The object at the given position is being selected (Think of this as select a row for some Object).
#ifndef _di_fss_basic_list_read_print_at_
void fss_basic_list_read_print_at(fll_program_data_t * const main, const f_array_length_t at, const f_fss_delimits_t delimits_object, const f_fss_delimits_t delimits_content, fss_basic_list_read_data_t * const data) {
- if (at >= data->contents.used) {
- return;
- }
+ if (at >= data->contents.used) return;
if ((data->option & fss_basic_list_read_data_option_object_d) || (data->option & fss_basic_list_read_data_option_content_d) && (data->contents.array[at].used || (data->option & fss_basic_list_read_data_option_empty_d))) {
flockfile(main->output.to.stream);
if (data->option & fss_basic_list_read_data_option_object_d) {
- if (data->option & fss_basic_list_read_data_option_trim_d) {
- fl_print_trim_except_in_dynamic_partial(data->buffer, data->objects.array[at], delimits_object, data->comments, main->output.to.stream);
- }
- else {
- f_print_except_in_dynamic_partial(data->buffer, data->objects.array[at], delimits_object, data->comments, main->output.to.stream);
- }
-
- fss_basic_list_read_print_object_end(main);
+ fss_basic_list_read_print_at_object(main, data, at, delimits_object);
}
if (data->option & fss_basic_list_read_data_option_content_d) {
#ifndef _di_fss_basic_list_read_print_at_object_
void fss_basic_list_read_print_at_object(fll_program_data_t * const main, fss_basic_list_read_data_t * const data, const f_array_length_t at, const f_fss_delimits_t delimits_object) {
- if (at >= data->objects.used) {
- return;
- }
+ if (at >= data->objects.used) return;
if (data->option & fss_basic_list_read_data_option_trim_d) {
fl_print_trim_except_dynamic_partial(data->buffer, data->objects.array[at], delimits_object, main->output.to.stream);
}
else {
- f_print_except_dynamic_partial(data->buffer, data->objects.array[at], delimits_object, main->output.to.stream);
+ if (data->buffer.used) {
+ f_string_range_t before = f_string_range_t_initialize;
+ f_string_range_t after = f_string_range_t_initialize;
+
+ if (data->option & fss_basic_list_read_data_option_original_d) {
+ if (data->objects.array[at].start <= data->objects.array[at].stop) {
+ if (data->objects.array[at].start) {
+ before.start = before.stop = data->objects.array[at].start - 1;
+
+ while (before.start && data->buffer.string[before.start] != f_fss_eol_s.string[0]) --before.start;
+
+ if (data->buffer.string[before.start] == f_fss_eol_s.string[0]) ++before.start;
+ }
+
+ if (f_fss_basic_list_open_s.used && data->objects.array[at].stop + 1 < data->buffer.used) {
+ after.start = after.stop = data->objects.array[at].stop + 1;
+
+ if (data->buffer.string[after.stop] == f_fss_basic_list_open_s.string[0]) {
+ after.start = 1;
+ after.stop = 0;
+ }
+ else {
+ while (after.stop < data->buffer.used && data->buffer.string[after.stop] != f_fss_basic_list_open_s.string[0]) ++after.stop;
+
+ if (after.stop == data->buffer.used || data->buffer.string[after.stop] == f_fss_basic_list_open_s.string[0]) --after.stop;
+ }
+ }
+ }
+ }
+
+ if (before.start <= before.stop) {
+ f_print_except_dynamic_partial(data->buffer, before, delimits_object, main->output.to.stream);
+ }
+
+ f_print_except_dynamic_partial(data->buffer, data->objects.array[at], delimits_object, main->output.to.stream);
+
+ if (after.start <= after.stop) {
+ f_print_except_dynamic_partial(data->buffer, after, delimits_object, main->output.to.stream);
+ }
+ }
}
fss_basic_list_read_print_object_end(main);
#ifndef _di_fss_basic_list_read_delimit_content_is_
f_status_t fss_basic_list_read_delimit_content_is(fss_basic_list_read_data_t * const data, const f_array_length_t depth) {
- if (data->delimit_mode == fss_basic_list_read_delimit_mode_none_e) {
- return F_false;
- }
-
- if (data->delimit_mode == fss_basic_list_read_delimit_mode_all_e) {
- return F_true;
- }
-
- if (depth < data->delimit_depth) {
- return data->delimit_mode == fss_basic_list_read_delimit_mode_content_lesser_e;
- }
-
- if (depth == data->delimit_depth) {
- return F_true;
- }
+ if (data->delimit_mode == fss_basic_list_read_delimit_mode_none_e) return F_false;
+ if (data->delimit_mode == fss_basic_list_read_delimit_mode_all_e) return F_true;
+ if (depth < data->delimit_depth) return data->delimit_mode == fss_basic_list_read_delimit_mode_content_lesser_e;
+ if (depth == data->delimit_depth) return F_true;
return data->delimit_mode == fss_basic_list_read_delimit_mode_content_greater_e;
}
print
run parameter:"script" ./tests/runtime/script/generate.sh parameter:"test_prefix"0002 tests/runtime/fss_0002/source/test-0002-mixed.fss parameter:"build_path"test/fss_0002
+ print
+ print Generating Test 0003 for Basic List (FSS-0002).
+ print
+ run parameter:"script" ./tests/runtime/script/generate.sh parameter:"test_prefix"0002 tests/runtime/fss_0002/source/test-0003-object_space.fss parameter:"build_path"test/fss_0002
+
verify_process:
print
print Verifying Tests for Basic List (FSS-0002).
d
a
привет
-y
+ y
"мир"
привет has space
"This is quoted"
-AlsoGood
-hi
-привет has space
+ AlsoGood
+hi
+ привет has space
a
also_empty
d
a
привет
-y
+ y
"мир"
привет has space
"This is quoted"
-AlsoGood
-hi
-привет has space
+ AlsoGood
+hi
+ привет has space
a
also_empty
привет:
мир
-y:
+ y :
z
"мир":
quoted, "yep".
\"and so does this" "have space"
"This is quoted":
But still a valid list.
-AlsoGood:
-hi:
+ AlsoGood:
+hi :
Check this.
-привет has space:
+ привет has space :
...
a:
a second "a".
привет:
мир
-y:
+ y :
z
"мир":
quoted, "yep".
\"and so does this" "have space"
"This is quoted":
But still a valid list.
-AlsoGood:
-hi:
+ AlsoGood:
+hi :
Check this.
-привет has space:
+ привет has space :
...
a:
a second "a".
a:
hi:
-a:
-a:
+ a:
+a :
:
The object name is an empty string.
a:
hi:
-a:
-a:
+ a:
+a :
:
The object name is an empty string.
-\# a valid list
+ \# a valid list
a
-\# a valid list
+ \# a valid list
a
"мир"
привет has space
empty
hi
-has spaces
+ has spaces
a
-\# a valid list
+ \# a valid list
a
"мир"
привет has space
empty
hi
-has spaces
+ has spaces
\\# even this is not.
привет мир a
-\# a valid list:
+ \# a valid list:
with content.
a:
another "A" list.
c d
привет мир a
-has spaces:
+ has spaces :
yep.
fin
\\# even this is not.
привет мир a
-\# a valid list:
+ \# a valid list:
with content.
a:
another "A" list.
c d
привет мир a
-has spaces:
+ has spaces :
yep.
fin
--- /dev/null
+
+ stuff
+
+ This has
+ Several lines
+
--- /dev/null
+мирмирмир
+
--- /dev/null
+Has no Object name (only white space) and is oddly spaced.
+
--- /dev/null
+Has no Object name (only white space) and is oddly spaced.
+
--- /dev/null
+
+ stuff
+
+ This has
+ Several lines
+
--- /dev/null
+
+ stuff
+
+ This has
+ Several lines
+
--- /dev/null
+
+ stuff
+
+ This has
+ Several lines
+
--- /dev/null
+
+ stuff
+
+ This has
+ Several lines
+
--- /dev/null
+мирмирмир
+
--- /dev/null
+мирмирмир
+
--- /dev/null
+
+ stuff
+
+ This has
+ Several lines
+
+
+ with content.
+
+Has no Object name (only white space) and is oddly spaced.
+
+мирмирмир
+
--- /dev/null
+
+ stuff
+
+ This has
+ Several lines
+
+
+ with content.
+
+Has no Object name (only white space) and is oddly spaced.
+
+мирмирмир
+
--- /dev/null
+
+ stuff
+
+ This has
+ Several lines
+
+
+ with content.
+
+Has no Object name (only white space) and is oddly spaced.
+
+мирмирмир
+
--- /dev/null
+
+ stuff
+
+ This has
+ Several lines
+
+
+ with content.
+
+Has no Object name (only white space) and is oddly spaced.
+
+мирмирмир
+
--- /dev/null
+
+ stuff
+
+ This has
+ Several lines
+
+
+ with content.
+
+Has no Object name (only white space) and is oddly spaced.
+
+мирмирмир
+
--- /dev/null
+привет has space
--- /dev/null
+ привет has space
--- /dev/null
+привет has space
--- /dev/null
+привет has space
--- /dev/null
+ a
+ привет has space
+ inside
+ \# Valid Object
+
+мир
+ hi
--- /dev/null
+ a
+ привет has space
+ inside
+ \# Valid Object
+
+мир
+ hi
--- /dev/null
+a
+привет has space
+inside
+# Valid Object
+
+мир
+hi
--- /dev/null
+a
+привет has space
+inside
+# Valid Object
+
+мир
+hi
--- /dev/null
+a
+привет has space
+inside
+# Valid Object
+
+мир
+hi
--- /dev/null
+a:
+
+ stuff
+
+ This has
+ Several lines
+
--- /dev/null
+привет has space:
--- /dev/null
+мир:
+мирмирмир
+
--- /dev/null
+ Several lines
--- /dev/null
+ Several lines
--- /dev/null
+:
+Has no Object name (only white space) and is oddly spaced.
+
--- /dev/null
+:
+Has no Object name (only white space) and is oddly spaced.
+
--- /dev/null
+ a :
+
+ stuff
+
+ This has
+ Several lines
+
--- /dev/null
+ a :
+
+ stuff
+
+ This has
+ Several lines
+
--- /dev/null
+a:
+
+ stuff
+
+ This has
+ Several lines
+
--- /dev/null
+a:
+
+ stuff
+
+ This has
+ Several lines
+
--- /dev/null
+мир:
+мирмирмир
+
--- /dev/null
+мир:
+мирмирмир
+
--- /dev/null
+привет has space:
--- /dev/null
+ a :
+
+ stuff
+
+ This has
+ Several lines
+
+ привет has space :
+ inside :
+
+ \# Valid Object :
+ with content.
+
+:
+Has no Object name (only white space) and is oddly spaced.
+
+мир :
+мирмирмир
+
+ hi :
--- /dev/null
+ a :
+
+ stuff
+
+ This has
+ Several lines
+
+ привет has space :
+ inside :
+
+ \# Valid Object :
+ with content.
+
+:
+Has no Object name (only white space) and is oddly spaced.
+
+мир :
+мирмирмир
+
+ hi :
--- /dev/null
+a:
+
+ stuff
+
+ This has
+ Several lines
+
+привет has space:
+inside:
+
+# Valid Object:
+ with content.
+
+:
+Has no Object name (only white space) and is oddly spaced.
+
+мир:
+мирмирмир
+
+hi:
--- /dev/null
+a:
+
+ stuff
+
+ This has
+ Several lines
+
+привет has space:
+inside:
+
+# Valid Object:
+ with content.
+
+:
+Has no Object name (only white space) and is oddly spaced.
+
+мир:
+мирмирмир
+
+hi:
--- /dev/null
+a:
+
+ stuff
+
+ This has
+ Several lines
+
+привет has space:
+inside:
+
+# Valid Object:
+ with content.
+
+:
+Has no Object name (only white space) and is oddly spaced.
+
+мир:
+мирмирмир
+
+hi:
--- /dev/null
+ a :
+
+ stuff
+
+ This has
+ Several lines
+
+ привет has space :
+ inside :
+
+ \# Valid Object :
+ with content.
+
+ :
+Has no Object name (only white space) and is oddly spaced.
+
+мир :
+мирмирмир
+
+# Comment Before.
+ hi :
+ # Comment inside.
extern "C" {
#endif
-#ifndef _di_fss_embedded_list_read_print_object_end_
- void fss_embedded_list_read_print_object_end(fss_embedded_list_read_data_t * const data) {
+#ifndef _di_fss_embedded_list_read_print_at_determine_begin_
+ f_string_range_t fss_embedded_list_read_print_at_determine_begin(fss_embedded_list_read_data_t * const data, const f_string_range_t object, const f_string_ranges_t contents) {
- if (data->main->parameters.array[fss_embedded_list_read_parameter_pipe_e].result == f_console_result_found_e) {
- f_print_dynamic_raw(fss_embedded_list_read_pipe_content_start_s, data->main->output.to.stream);
+ f_string_range_t before = f_string_range_t_initialize;
+
+ if (contents.used && contents.array[0].start <= contents.array[0].stop) {
+ if (contents.array[0].stop + 1 < data->buffer.used) {
+ before.start = contents.array[0].stop;
+ }
+ else {
+ return before;
+ }
+ }
+ else if (object.start > object.stop) {
+ return before;
}
else {
- if (data->main->parameters.array[fss_embedded_list_read_parameter_object_e].result == f_console_result_found_e && data->main->parameters.array[fss_embedded_list_read_parameter_content_e].result == f_console_result_found_e) {
- f_print_dynamic_raw(f_fss_embedded_list_open_s, data->main->output.to.stream);
- f_print_dynamic_raw(f_fss_embedded_list_open_end_s, data->main->output.to.stream);
+ before.start = object.stop;
+ }
+
+ while (before.start < data->buffer.used && data->buffer.string[before.start] != f_fss_eol_s.string[0]) ++before.start;
+
+ if (before.start + 1 < data->buffer.used && data->buffer.string[before.start] == f_fss_eol_s.string[0]) {
+ before.stop = ++before.start;
+
+ while (before.stop < data->buffer.used && data->buffer.string[before.stop] != f_fss_embedded_list_close_s.string[0]) ++before.stop;
+
+ if (before.stop < data->buffer.used && data->buffer.string[before.stop] == f_fss_embedded_list_close_s.string[0]) {
+ --before.stop;
}
else {
- f_print_dynamic_raw(f_fss_eol_s, data->main->output.to.stream);
+ before.start = 1;
+ before.stop = 0;
}
}
+ else {
+ before.start = 1;
+ before.stop = 0;
+ }
+
+ return before;
}
-#endif // _di_fss_embedded_list_read_print_object_end_
+#endif // _di_fss_embedded_list_read_print_at_determine_begin_
#ifndef _di_fss_embedded_list_read_print_content_ignore_
void fss_embedded_list_read_print_content_ignore(fss_embedded_list_read_data_t * const data) {
}
#endif // _di_fss_embedded_list_read_print_content_ignore_
+#ifndef _di_fss_embedded_list_read_print_object_
+ void fss_embedded_list_read_print_object(fss_embedded_list_read_data_t * const data, const f_string_range_t object, const f_string_ranges_t contents, const f_array_lengths_t objects_delimits, f_status_t (*print_object)(const f_string_static_t, const f_string_range_t, const f_array_lengths_t, FILE *)) {
+
+ if (!data->buffer.used) return;
+
+ if (data->main->parameters.array[fss_embedded_list_read_parameter_content_e].result == f_console_result_found_e && (data->main->parameters.array[fss_embedded_list_read_parameter_original_e].result != f_console_result_found_e || data->main->parameters.array[fss_embedded_list_read_parameter_trim_e].result == f_console_result_found_e)) {
+ const f_string_range_t before = fss_embedded_list_read_print_at_determine_begin(data, object, contents);
+
+ if (before.start <= before.stop) {
+ f_print_except_dynamic_partial(data->buffer, before, objects_delimits, data->main->output.to.stream);
+ }
+ }
+
+ f_string_range_t before = f_string_range_t_initialize;
+ f_string_range_t after = f_string_range_t_initialize;
+
+ if (data->main->parameters.array[fss_embedded_list_read_parameter_original_e].result == f_console_result_found_e) {
+ if (object.start <= object.stop) {
+ if (object.start) {
+ before.start = before.stop = object.start - 1;
+
+ while (before.start && data->buffer.string[before.start] != f_fss_eol_s.string[0]) --before.start;
+
+ if (data->buffer.string[before.start] == f_fss_eol_s.string[0]) ++before.start;
+ }
+
+ if (f_fss_embedded_list_open_s.used && object.stop + 1 < data->buffer.used) {
+ after.start = after.stop = object.stop + 1;
+
+ if (data->buffer.string[after.stop] == f_fss_embedded_list_open_s.string[0]) {
+ after.start = 1;
+ after.stop = 0;
+ }
+ else {
+ while (after.stop < data->buffer.used && data->buffer.string[after.stop] != f_fss_embedded_list_open_s.string[0]) ++after.stop;
+
+ if (after.stop == data->buffer.used || data->buffer.string[after.stop] == f_fss_embedded_list_open_s.string[0]) --after.stop;
+ }
+ }
+ }
+ }
+
+ if (before.start <= before.stop) {
+ f_print_except_dynamic_partial(data->buffer, before, objects_delimits, data->main->output.to.stream);
+ }
+
+ print_object(data->buffer, object, objects_delimits, data->main->output.to.stream);
+
+ if (after.start <= after.stop) {
+ f_print_except_dynamic_partial(data->buffer, after, objects_delimits, data->main->output.to.stream);
+ }
+ }
+#endif // _di_fss_embedded_list_read_print_object_
+
+#ifndef _di_fss_embedded_list_read_print_object_end_
+ void fss_embedded_list_read_print_object_end(fss_embedded_list_read_data_t * const data) {
+
+ if (data->main->parameters.array[fss_embedded_list_read_parameter_pipe_e].result == f_console_result_found_e) {
+ f_print_dynamic_raw(fss_embedded_list_read_pipe_content_start_s, data->main->output.to.stream);
+ }
+ else {
+ if (data->main->parameters.array[fss_embedded_list_read_parameter_object_e].result == f_console_result_found_e && data->main->parameters.array[fss_embedded_list_read_parameter_content_e].result == f_console_result_found_e) {
+ f_print_dynamic_raw(f_fss_embedded_list_open_s, data->main->output.to.stream);
+ f_print_dynamic_raw(f_fss_embedded_list_open_end_s, data->main->output.to.stream);
+ }
+ else {
+ f_print_dynamic_raw(f_fss_eol_s, data->main->output.to.stream);
+ }
+ }
+ }
+#endif // _di_fss_embedded_list_read_print_object_end_
+
#ifndef _di_fss_embedded_list_read_print_set_end_
void fss_embedded_list_read_print_set_end(fss_embedded_list_read_data_t * const data) {
#endif
/**
+ * Determine the spacing before the Content close.
+ *
+ * This is intended to be used to determine the spacing before both an Object and a Content when using the appropriate modes.
+ *
+ * @param data
+ * The program data.
+ * @param object
+ * The range within data.buffer representing the Object.
+ * @param contents
+ * The ranges within data.buffer representing the Content.
+ *
+ * @return
+ * The range found.
+ * The range.start = 1 and range.stop = 0 is returned if not found.
+ */
+#ifndef _di_fss_embedded_list_read_print_at_determine_begin_
+ extern f_string_range_t fss_embedded_list_read_print_at_determine_begin(fss_embedded_list_read_data_t * const data, const f_string_range_t object, const f_string_ranges_t contents) F_attribute_visibility_internal_d;
+#endif // _di_fss_embedded_list_read_print_at_determine_begin_
+
+/**
* Print the ignore character for content.
*
* This is only used in pipe output mode.
#endif // _di_fss_embedded_list_read_print_content_ignore_
/**
+ * Print the Object.
+ *
+ * @param data
+ * The program data.
+ * @param object
+ * The range within data.buffer representing the Object.
+ * @param contents
+ * The ranges within data.buffer representing the Content.
+ * This is used for determining the begin locations.
+ * @param objects_delimits
+ * The Object delimits array.
+ * @param print_object
+ * A callback for performing the printing of the Object.
+ */
+#ifndef _di_fss_embedded_list_read_print_object_
+ extern void fss_embedded_list_read_print_object(fss_embedded_list_read_data_t * const data, const f_string_range_t object, const f_string_ranges_t contents, const f_array_lengths_t objects_delimits, f_status_t (*print_object)(const f_string_static_t, const f_string_range_t, const f_array_lengths_t, FILE *)) F_attribute_visibility_internal_d;
+#endif // _di_fss_embedded_list_read_print_object_
+
+/**
* Print the end of an object (which is essentially the start of a content).
*
* @param data
// Handle Object begin.
if (line_current++ == line) {
- print_object(data->buffer, items->array[i].object, *objects_delimits, data->main->output.to.stream);
+ fss_embedded_list_read_print_object(data, items->array[i].object, items->array[i].content, *objects_delimits, print_object);
fss_embedded_list_read_print_object_end(data);
break;
if (skip[i]) continue;
- print_object(data->buffer, items->array[i].object, *objects_delimits, data->main->output.to.stream);
+ fss_embedded_list_read_print_object(data, items->array[i].object, items->array[i].content, *objects_delimits, print_object);
if (data->main->parameters.array[fss_embedded_list_read_parameter_content_e].result == f_console_result_found_e) {
fss_embedded_list_read_print_object_end(data);
if (items->array[i].content.used) {
+ if (data->main->parameters.array[fss_embedded_list_read_parameter_object_e].result == f_console_result_found_e) {
+ const f_string_range_t before = fss_embedded_list_read_print_at_determine_begin(data, items->array[i].object, items->array[i].content);
+
+ if (before.start <= before.stop) {
+ f_print_except_dynamic_partial(data->buffer, before, *objects_delimits, data->main->output.to.stream);
+ }
+ }
+
f_print_except_dynamic_partial(data->buffer, items->array[i].content.array[0], *contents_delimits, data->main->output.to.stream);
}
}
print
run parameter:"script" ./tests/runtime/script/generate.sh parameter:"test_prefix"0008 tests/runtime/fss_0008/source/test-0002-mixed.fss parameter:"build_path"test/fss_0008
+ print
+ print Generating Test 0003 for Embedded List (FSS-0008).
+ print
+ run parameter:"script" ./tests/runtime/script/generate.sh parameter:"test_prefix"0008 tests/runtime/fss_0008/source/test-0003-object_space.fss parameter:"build_path"test/fss_0008
+
verify_process:
print
print Verifying Tests for Embedded List (FSS-0008).
d
a
привет
-y
+ y
"мир"
привет has space
"This is quoted"
-AlsoGood
-hi
-привет has space
+ AlsoGood
+hi
+ привет has space
a
also_empty
d
a
привет
-y
+ y
"мир"
привет has space
"This is quoted"
-AlsoGood
-hi
-привет has space
+ AlsoGood
+hi
+ привет has space
a
also_empty
привет{
мир
}
-y{
+ y {
z
}
"мир"{
"This is quoted"{
But still a valid list.
}
-AlsoGood{
+ AlsoGood{
}
-hi{
+hi {
Check this.
}
-привет has space{
+ привет has space {
...
}
a{
привет{
мир
}
-y{
+ y {
z
}
"мир"{
"This is quoted"{
But still a valid list.
}
-AlsoGood{
+ AlsoGood{
}
-hi{
+hi {
Check this.
}
-привет has space{
+ привет has space {
...
}
a{
a{
}
-a{
+ a{
}
-a{
+a {
}
a{
}
-a{
+ a{
}
-a{
+a {
}
}
hi{
}
-a{
+ a{
}
-a{
+a {
}
{
The object name is an empty string.
}
hi{
}
-a{
+ a{
}
-a{
+a {
}
{
The object name is an empty string.
привет has space
empty
hi
-has spaces
+ has spaces
привет has space
empty
hi
-has spaces
+ has spaces
привет мир a
}
-has spaces{
+ has spaces {
yep.
fin
}
привет мир a
}
-has spaces{
+ has spaces {
yep.
fin
}
--- /dev/null
+
+ stuff
+
+ This has
+ Several lines
--- /dev/null
+ inside {
+ }
--- /dev/null
+Has no Object name (only white space) and is oddly spaced.
--- /dev/null
+Has no Object name (only white space) and is oddly spaced.
--- /dev/null
+
+ stuff
+
+ This has
+ Several lines
--- /dev/null
+
+ stuff
+
+ This has
+ Several lines
--- /dev/null
+
+ stuff
+
+ This has
+ Several lines
--- /dev/null
+
+ stuff
+
+ This has
+ Several lines
--- /dev/null
+ inside {
+ }
--- /dev/null
+ inside {
+ }
--- /dev/null
+
+ stuff
+
+ This has
+ Several lines
+ inside {
+ }
+ with content.
+ \### Nested valud Object {
+ with nested content.
+ }
+ and outside.
+Has no Object name (only white space) and is oddly spaced.
+мирмирмир
+ empty {
+ }
--- /dev/null
+
+ stuff
+
+ This has
+ Several lines
+ inside {
+ }
+ with content.
+ \### Nested valud Object {
+ with nested content.
+ }
+ and outside.
+Has no Object name (only white space) and is oddly spaced.
+мирмирмир
+ empty {
+ }
--- /dev/null
+
+ stuff
+
+ This has
+ Several lines
+ inside {
+ }
+ with content.
+ \### Nested valud Object {
+ with nested content.
+ }
+ and outside.
+Has no Object name (only white space) and is oddly spaced.
+мирмирмир
+ empty {
+ }
--- /dev/null
+
+ stuff
+
+ This has
+ Several lines
+ inside {
+ }
+ with content.
+ \### Nested valud Object {
+ with nested content.
+ }
+ and outside.
+Has no Object name (only white space) and is oddly spaced.
+мирмирмир
+ empty {
+ }
--- /dev/null
+
+ stuff
+
+ This has
+ Several lines
+ inside {
+ }
+ with content.
+ \### Nested valud Object {
+ with nested content.
+ }
+ and outside.
+Has no Object name (only white space) and is oddly spaced.
+мирмирмир
+ empty {
+ }
--- /dev/null
+привет has space
--- /dev/null
+ привет has space
--- /dev/null
+привет has space
--- /dev/null
+привет has space
--- /dev/null
+ a
+ привет has space
+ \# Valid Object
+ \# Valid Object
+
+мир
+ hi
+nested
--- /dev/null
+ a
+ привет has space
+ \# Valid Object
+ \# Valid Object
+
+мир
+ hi
+nested
--- /dev/null
+a
+привет has space
+# Valid Object
+# Valid Object
+
+мир
+hi
+nested
--- /dev/null
+a
+привет has space
+# Valid Object
+# Valid Object
+
+мир
+hi
+nested
--- /dev/null
+a
+привет has space
+# Valid Object
+# Valid Object
+
+мир
+hi
+nested
--- /dev/null
+ a{
+
+ stuff
+
+ This has
+ Several lines
+}
--- /dev/null
+ привет has space{
+ inside {
+ }
+}
--- /dev/null
+мир{
+мирмирмир
+}
--- /dev/null
+ Several lines
--- /dev/null
+ Several lines
--- /dev/null
+ {
+ Has no Object name (only white space) and is oddly spaced.
+}
--- /dev/null
+ {
+ Has no Object name (only white space) and is oddly spaced.
+}
--- /dev/null
+ a {
+
+ stuff
+
+ This has
+ Several lines
+}
--- /dev/null
+ a {
+
+ stuff
+
+ This has
+ Several lines
+}
--- /dev/null
+ a{
+
+ stuff
+
+ This has
+ Several lines
+}
--- /dev/null
+ a{
+
+ stuff
+
+ This has
+ Several lines
+}
--- /dev/null
+мир{
+мирмирмир
+}
--- /dev/null
+мир{
+мирмирмир
+}
--- /dev/null
+ привет has space{
+ inside {
+ }
+}
--- /dev/null
+ a {
+
+ stuff
+
+ This has
+ Several lines
+}
+ привет has space {
+ inside {
+ }
+}
+ \# Valid Object {
+ with content.
+}
+ \# Valid Object {
+ \### Nested valud Object {
+ with nested content.
+ }
+ and outside.
+}
+{
+ Has no Object name (only white space) and is oddly spaced.
+}
+мир {
+мирмирмир
+}
+ hi {
+ }
+nested {
+ empty {
+ }
+}
--- /dev/null
+ a {
+
+ stuff
+
+ This has
+ Several lines
+ }
+ привет has space {
+ inside {
+ }
+ }
+ \# Valid Object {
+ with content.
+ }
+ \# Valid Object {
+ \### Nested valud Object {
+ with nested content.
+ }
+ and outside.
+ }
+{
+Has no Object name (only white space) and is oddly spaced.
+ }
+мир {
+мирмирмир
+}
+ hi {
+ # Comment inside.
+ }
+nested {
+ empty {
+ }
+ # Comment after.
+}
--- /dev/null
+ a{
+
+ stuff
+
+ This has
+ Several lines
+}
+ привет has space{
+ inside {
+ }
+}
+ # Valid Object{
+ with content.
+}
+ # Valid Object{
+ \### Nested valud Object {
+ with nested content.
+ }
+ and outside.
+}
+ {
+ Has no Object name (only white space) and is oddly spaced.
+}
+мир{
+мирмирмир
+}
+ hi{
+ }
+nested{
+ empty {
+ }
+}
--- /dev/null
+ a{
+
+ stuff
+
+ This has
+ Several lines
+}
+ привет has space{
+ inside {
+ }
+}
+ # Valid Object{
+ with content.
+}
+ # Valid Object{
+ \### Nested valud Object {
+ with nested content.
+ }
+ and outside.
+}
+ {
+ Has no Object name (only white space) and is oddly spaced.
+}
+мир{
+мирмирмир
+}
+ hi{
+ }
+nested{
+ empty {
+ }
+}
--- /dev/null
+ a{
+
+ stuff
+
+ This has
+ Several lines
+}
+ привет has space{
+ inside {
+ }
+}
+ # Valid Object{
+ with content.
+}
+ # Valid Object{
+ \### Nested valud Object {
+ with nested content.
+ }
+ and outside.
+}
+ {
+ Has no Object name (only white space) and is oddly spaced.
+}
+мир{
+мирмирмир
+}
+ hi{
+ }
+nested{
+ empty {
+ }
+}
--- /dev/null
+ a {
+
+ stuff
+
+ This has
+ Several lines
+ }
+
+ привет has space {
+ inside {
+ }
+ }
+
+ \# Valid Object {
+ with content.
+ }
+
+ \# Valid Object {
+ \### Nested valud Object {
+ with nested content.
+ }
+ and outside.
+ }
+
+ {
+Has no Object name (only white space) and is oddly spaced.
+ }
+
+мир {
+мирмирмир
+}
+
+# Comment Before.
+ hi {
+ # Comment inside.
+ }
+# Comment after.
+
+nested {
+ # Comment Before.
+ empty {
+ # Comment inside.
+ }
+ # Comment after.
+}
#endif // _di_fss_extended_list_read_files_t_
/**
- * The data structure for FSS Basic Read.
+ * The data structure for FSS Extended List Read.
*
* fss_extended_list_read_data_option_*:
* - at: The object at the given position is being selected (Think of this as select a row for some Object).
#ifndef _di_fss_extended_list_read_print_at_
void fss_extended_list_read_print_at(fll_program_data_t * const main, const f_array_length_t at, const f_fss_delimits_t delimits_object, const f_fss_delimits_t delimits_content, fss_extended_list_read_data_t * const data) {
- if (at >= data->contents.used) {
- return;
- }
+ if (at >= data->contents.used) return;
if ((data->option & fss_extended_list_read_data_option_object_d) || ((data->option & fss_extended_list_read_data_option_content_d) && (data->contents.array[at].used && data->contents.array[at].array[0].start <= data->contents.array[at].array[0].stop || (data->option & fss_extended_list_read_data_option_empty_d)))) {
flockfile(main->output.to.stream);
if (data->option & fss_extended_list_read_data_option_object_d) {
- if (data->option & fss_extended_list_read_data_option_trim_d) {
- fl_print_trim_except_dynamic_partial(data->buffer, data->objects.array[at], delimits_object, main->output.to.stream);
- }
- else {
- f_print_except_dynamic_partial(data->buffer, data->objects.array[at], delimits_object, main->output.to.stream);
- }
-
- fss_extended_list_read_print_object_end(main, data);
+ fss_extended_list_read_print_at_object(main, data, at, delimits_object);
}
if (data->option & fss_extended_list_read_data_option_content_d) {
fss_extended_list_read_print_content_ignore(main);
}
}
+
+ if (data->option & fss_extended_list_read_data_option_object_d) {
+ const f_string_range_t before = fss_extended_list_read_print_at_determine_begin(main, data, at);
+
+ if (before.start <= before.stop) {
+ f_print_except_dynamic_partial(data->buffer, before, delimits_object, main->output.to.stream);
+ }
+ }
}
fss_extended_list_read_print_set_end(main, data);
}
#endif // _di_fss_extended_list_read_print_at_
+#ifndef _di_fss_extended_list_read_print_at_determine_begin_
+ f_string_range_t fss_extended_list_read_print_at_determine_begin(fll_program_data_t * const main, fss_extended_list_read_data_t * const data, const f_array_length_t at) {
+
+ f_string_range_t before = f_string_range_t_initialize;
+
+ if (at < data->contents.used) {
+ if (data->contents.used && data->contents.array[at].array[0].start <= data->contents.array[at].array[0].stop) {
+ if (data->contents.array[at].array[0].stop + 1 < data->buffer.used) {
+ before.start = data->contents.array[at].array[0].stop;
+ }
+ else {
+ return before;
+ }
+ }
+ else if (data->objects.array[at].start > data->objects.array[at].stop) {
+ return before;
+ }
+ else {
+ before.start = data->objects.array[at].stop;
+ }
+
+ while (before.start < data->buffer.used && data->buffer.string[before.start] != f_fss_eol_s.string[0]) ++before.start;
+
+ if (before.start + 1 < data->buffer.used && data->buffer.string[before.start] == f_fss_eol_s.string[0]) {
+ before.stop = ++before.start;
+
+ while (before.stop < data->buffer.used && data->buffer.string[before.stop] != f_fss_extended_list_close_s.string[0]) ++before.stop;
+
+ if (before.stop < data->buffer.used && data->buffer.string[before.stop] == f_fss_extended_list_close_s.string[0]) {
+ --before.stop;
+ }
+ else {
+ before.start = 1;
+ before.stop = 0;
+ }
+ }
+ else {
+ before.start = 1;
+ before.stop = 0;
+ }
+ }
+
+ return before;
+ }
+#endif // _di_fss_extended_list_read_print_at_determine_begin_
+
#ifndef _di_fss_extended_list_read_print_at_object_
void fss_extended_list_read_print_at_object(fll_program_data_t * const main, fss_extended_list_read_data_t * const data, const f_array_length_t at, const f_fss_delimits_t delimits_object) {
- if (at >= data->objects.used) {
- return;
+ if (at >= data->objects.used) return;
+
+ if ((data->option & fss_extended_list_read_data_option_content_d) && (!(data->option & fss_extended_list_read_data_option_original_d) || (data->option & fss_extended_list_read_data_option_trim_d))) {
+ const f_string_range_t before = fss_extended_list_read_print_at_determine_begin(main, data, at);
+
+ if (before.start <= before.stop) {
+ f_print_except_dynamic_partial(data->buffer, before, delimits_object, main->output.to.stream);
+ }
}
if (data->option & fss_extended_list_read_data_option_trim_d) {
fl_print_trim_except_dynamic_partial(data->buffer, data->objects.array[at], delimits_object, main->output.to.stream);
}
else {
- f_print_except_dynamic_partial(data->buffer, data->objects.array[at], delimits_object, main->output.to.stream);
+ if (data->buffer.used) {
+ f_string_range_t before = f_string_range_t_initialize;
+ f_string_range_t after = f_string_range_t_initialize;
+
+ if (data->option & fss_extended_list_read_data_option_original_d) {
+ if (data->objects.array[at].start <= data->objects.array[at].stop) {
+ if (data->objects.array[at].start) {
+ before.start = before.stop = data->objects.array[at].start - 1;
+
+ while (before.start && data->buffer.string[before.start] != f_fss_eol_s.string[0]) --before.start;
+
+ if (data->buffer.string[before.start] == f_fss_eol_s.string[0]) ++before.start;
+ }
+
+ if (f_fss_extended_list_open_s.used && data->objects.array[at].stop + 1 < data->buffer.used) {
+ after.start = after.stop = data->objects.array[at].stop + 1;
+
+ if (data->buffer.string[after.stop] == f_fss_extended_list_open_s.string[0]) {
+ after.start = 1;
+ after.stop = 0;
+ }
+ else {
+ while (after.stop < data->buffer.used && data->buffer.string[after.stop] != f_fss_extended_list_open_s.string[0]) ++after.stop;
+
+ if (after.stop == data->buffer.used || data->buffer.string[after.stop] == f_fss_extended_list_open_s.string[0]) --after.stop;
+ }
+ }
+ }
+ }
+
+ if (before.start <= before.stop) {
+ f_print_except_dynamic_partial(data->buffer, before, delimits_object, main->output.to.stream);
+ }
+
+ f_print_except_dynamic_partial(data->buffer, data->objects.array[at], delimits_object, main->output.to.stream);
+
+ if (after.start <= after.stop) {
+ f_print_except_dynamic_partial(data->buffer, after, delimits_object, main->output.to.stream);
+ }
+ }
}
fss_extended_list_read_print_object_end(main, data);
#endif // _di_fss_extended_list_read_print_at_
/**
+ * Determine the spacing before the Content close.
+ *
+ * This is intended to be used to determine the spacing before both an Object and a Content when using the appropriate modes.
+ *
+ * @param main
+ * The main program data.
+ * @param data
+ * The program data.
+ * @param at
+ * The index in the Objects and Contents to print.
+ *
+ * @return
+ * The range found.
+ * The range.start = 1 and range.stop = 0 is returned if not found.
+ */
+#ifndef _di_fss_extended_list_read_print_at_determine_begin_
+ extern f_string_range_t fss_extended_list_read_print_at_determine_begin(fll_program_data_t * const main, fss_extended_list_read_data_t * const data, const f_array_length_t at) F_attribute_visibility_internal_d;
+#endif // _di_fss_extended_list_read_print_at_determine_begin_
+
+/**
* Explicitly print the Object at the given position.
*
* @param main
}
}
- // @fixme The fll_fss_*_read functions do not have a store of the set closing ranges but should.
- // Simulate the ending by printing, but the original range should ideally be used.
+ // Print the ending data.
if (data->option & fss_extended_list_read_data_option_object_d) {
if (*line == data->line) {
flockfile(main->output.to.stream);
fss_extended_list_read_print_one(main);
}
else {
+ if (data->option & fss_extended_list_read_data_option_content_d) {
+ const f_string_range_t before = fss_extended_list_read_print_at_determine_begin(main, data, at);
+
+ if (before.start <= before.stop) {
+ f_print_except_dynamic_partial(data->buffer, before, delimits_object, main->output.to.stream);
+ }
+ }
+
fss_extended_list_read_print_set_end(main, data);
}
print
run parameter:"script" ./tests/runtime/script/generate.sh parameter:"test_prefix"0003 tests/runtime/fss_0003/source/test-0002-mixed.fss parameter:"build_path"test/fss_0003
+ print
+ print Generating Test 0003 for Extended List (FSS-0003).
+ print
+ run parameter:"script" ./tests/runtime/script/generate.sh parameter:"test_prefix"0003 tests/runtime/fss_0003/source/test-0003-object_space.fss parameter:"build_path"test/fss_0003
+
verify_process:
print
print Verifying Tests for Extended List (FSS-0003).
d
a
привет
-y
+ y
"мир"
привет has space
"This is quoted"
-AlsoGood
-hi
-привет has space
+ AlsoGood
+hi
+ привет has space
a
also_empty
d
a
привет
-y
+ y
"мир"
привет has space
"This is quoted"
-AlsoGood
-hi
-привет has space
+ AlsoGood
+hi
+ привет has space
a
also_empty
привет{
мир
}
-y{
+ y {
z
}
"мир"{
"This is quoted"{
But still a valid list.
}
-AlsoGood{
+ AlsoGood{
}
-hi{
+hi {
Check this.
}
-привет has space{
+ привет has space {
...
}
a{
привет{
мир
}
-y{
+ y {
z
}
"мир"{
"This is quoted"{
But still a valid list.
}
-AlsoGood{
+ AlsoGood{
}
-hi{
+hi {
Check this.
}
-привет has space{
+ привет has space {
...
}
a{
a{
}
-a{
+ a{
}
-a{
+a {
}
a{
}
-a{
+ a{
}
-a{
+a {
}
}
hi{
}
-a{
+ a{
}
-a{
+a {
}
{
The object name is an empty string.
}
hi{
}
-a{
+ a{
}
-a{
+a {
}
{
The object name is an empty string.
привет has space
empty
hi
-has spaces
+ has spaces
привет has space
empty
hi
-has spaces
+ has spaces
привет мир a
}
-has spaces{
+ has spaces {
yep.
fin
}
привет мир a
}
-has spaces{
+ has spaces {
yep.
fin
}
--- /dev/null
+
+ stuff
+
+ This has
+ Several lines
--- /dev/null
+ inside {
+ }
--- /dev/null
+Has no Object name (only white space) and is oddly spaced.
--- /dev/null
+Has no Object name (only white space) and is oddly spaced.
--- /dev/null
+
+ stuff
+
+ This has
+ Several lines
--- /dev/null
+
+ stuff
+
+ This has
+ Several lines
--- /dev/null
+
+ stuff
+
+ This has
+ Several lines
--- /dev/null
+
+ stuff
+
+ This has
+ Several lines
--- /dev/null
+ inside {
+ }
--- /dev/null
+ inside {
+ }
--- /dev/null
+
+ stuff
+
+ This has
+ Several lines
+ inside {
+ \}
+ with content.
+Has no Object name (only white space) and is oddly spaced.
+мирмирмир
--- /dev/null
+
+ stuff
+
+ This has
+ Several lines
+ inside {
+ \}
+ with content.
+Has no Object name (only white space) and is oddly spaced.
+мирмирмир
--- /dev/null
+
+ stuff
+
+ This has
+ Several lines
+ inside {
+ }
+ with content.
+Has no Object name (only white space) and is oddly spaced.
+мирмирмир
--- /dev/null
+
+ stuff
+
+ This has
+ Several lines
+ inside {
+ }
+ with content.
+Has no Object name (only white space) and is oddly spaced.
+мирмирмир
--- /dev/null
+
+ stuff
+
+ This has
+ Several lines
+ inside {
+ }
+ with content.
+Has no Object name (only white space) and is oddly spaced.
+мирмирмир
--- /dev/null
+привет has space
--- /dev/null
+ привет has space
--- /dev/null
+привет has space
--- /dev/null
+привет has space
--- /dev/null
+ a
+ привет has space
+ \# Valid Object
+
+мир
+ hi
--- /dev/null
+ a
+ привет has space
+ \# Valid Object
+
+мир
+ hi
--- /dev/null
+a
+привет has space
+# Valid Object
+
+мир
+hi
--- /dev/null
+a
+привет has space
+# Valid Object
+
+мир
+hi
--- /dev/null
+a
+привет has space
+# Valid Object
+
+мир
+hi
--- /dev/null
+ a{
+
+ stuff
+
+ This has
+ Several lines
+ }
--- /dev/null
+ привет has space{
+ inside {
+ }
+ }
--- /dev/null
+ Several lines
--- /dev/null
+ Several lines
--- /dev/null
+ {
+Has no Object name (only white space) and is oddly spaced.
+ }
--- /dev/null
+ {
+Has no Object name (only white space) and is oddly spaced.
+ }
--- /dev/null
+ a {
+
+ stuff
+
+ This has
+ Several lines
+ }
--- /dev/null
+ a {
+
+ stuff
+
+ This has
+ Several lines
+ }
--- /dev/null
+ a{
+
+ stuff
+
+ This has
+ Several lines
+ }
--- /dev/null
+ a{
+
+ stuff
+
+ This has
+ Several lines
+ }
--- /dev/null
+мир{
+мирмирмир
+}
--- /dev/null
+мир{
+мирмирмир
+}
--- /dev/null
+ привет has space{
+ inside {
+ }
+ }
--- /dev/null
+ a {
+
+ stuff
+
+ This has
+ Several lines
+ }
+ привет has space {
+ inside {
+ \}
+ }
+ \# Valid Object {
+ with content.
+ }
+{
+Has no Object name (only white space) and is oddly spaced.
+ }
+мир {
+мирмирмир
+}
+ hi {
+ }
--- /dev/null
+ a {
+
+ stuff
+
+ This has
+ Several lines
+ }
+ привет has space {
+ inside {
+ \}
+ }
+ \# Valid Object {
+ with content.
+ }
+{
+Has no Object name (only white space) and is oddly spaced.
+ }
+мир {
+мирмирмир
+}
+ hi {
+ }
--- /dev/null
+ a{
+
+ stuff
+
+ This has
+ Several lines
+ }
+ привет has space{
+ inside {
+ }
+ }
+ # Valid Object{
+ with content.
+ }
+ {
+Has no Object name (only white space) and is oddly spaced.
+ }
+мир{
+мирмирмир
+}
+ hi{
+ }
--- /dev/null
+ a{
+
+ stuff
+
+ This has
+ Several lines
+ }
+ привет has space{
+ inside {
+ }
+ }
+ # Valid Object{
+ with content.
+ }
+ {
+Has no Object name (only white space) and is oddly spaced.
+ }
+мир{
+мирмирмир
+}
+ hi{
+ }
--- /dev/null
+ a{
+
+ stuff
+
+ This has
+ Several lines
+ }
+ привет has space{
+ inside {
+ }
+ }
+ # Valid Object{
+ with content.
+ }
+ {
+Has no Object name (only white space) and is oddly spaced.
+ }
+мир{
+мирмирмир
+}
+ hi{
+ }
--- /dev/null
+ a {
+
+ stuff
+
+ This has
+ Several lines
+ }
+
+ привет has space {
+ inside {
+ \}
+ }
+
+ \# Valid Object {
+ with content.
+ }
+
+ {
+Has no Object name (only white space) and is oddly spaced.
+ }
+
+мир {
+мирмирмир
+}
+
+# Comment Before.
+ hi {
+ # Comment inside.
+ }
+# Comment after.
#endif // _di_fss_extended_read_files_t_
/**
- * The data structure for FSS Basic Read.
+ * The data structure for FSS Extended Read.
*
* fss_extended_read_data_option_*:
* - at: The object at the given position is being selected (Think of this as select a row for some Object).
#endif // _di_fss_payload_read_files_t_
/**
- * The data structure for FSS Basic Read.
+ * The data structure for FSS Payload Read.
*
* fss_payload_read_data_option_*:
* - at: The object at the given position is being selected (Think of this as select a row for some Object).
#ifndef _di_fss_payload_read_print_at_
void fss_payload_read_print_at(fll_program_data_t * const main, const bool is_payload, const f_array_length_t at, const f_fss_delimits_t delimits_object, const f_fss_delimits_t delimits_content, fss_payload_read_data_t * const data) {
- if (at >= data->contents.used) {
- return;
- }
+ if (at >= data->contents.used) return;
if ((data->option & fss_payload_read_data_option_object_d) || (data->option & fss_payload_read_data_option_content_d) && (data->contents.array[at].used || (data->option & fss_payload_read_data_option_empty_d))) {
flockfile(main->output.to.stream);
if (data->option & fss_payload_read_data_option_object_d) {
- if (data->option & fss_payload_read_data_option_trim_d) {
- fl_print_trim_except_in_dynamic_partial(data->buffer, data->objects.array[at], delimits_object, data->comments, main->output.to.stream);
- }
- else {
- f_print_except_in_dynamic_partial(data->buffer, data->objects.array[at], delimits_object, data->comments, main->output.to.stream);
- }
-
- fss_payload_read_print_object_end(main);
+ fss_payload_read_print_at_object(main, data, at, delimits_object);
}
if (data->option & fss_payload_read_data_option_content_d) {
}
if (!is_payload) {
+
fss_payload_read_print_set_end(main);
}
#ifndef _di_fss_payload_read_print_at_object_
void fss_payload_read_print_at_object(fll_program_data_t * const main, fss_payload_read_data_t * const data, const f_array_length_t at, const f_fss_delimits_t delimits_object) {
- if (at >= data->objects.used) {
- return;
- }
+ if (at >= data->objects.used) return;
if (data->option & fss_payload_read_data_option_trim_d) {
fl_print_trim_except_dynamic_partial(data->buffer, data->objects.array[at], delimits_object, main->output.to.stream);
}
else {
- f_print_except_dynamic_partial(data->buffer, data->objects.array[at], delimits_object, main->output.to.stream);
+ if (data->buffer.used) {
+ f_string_range_t before = f_string_range_t_initialize;
+ f_string_range_t after = f_string_range_t_initialize;
+
+ if (data->option & fss_payload_read_data_option_original_d) {
+ if (data->objects.array[at].start <= data->objects.array[at].stop) {
+ if (data->objects.array[at].start) {
+ before.start = before.stop = data->objects.array[at].start - 1;
+
+ while (before.start && data->buffer.string[before.start] != f_fss_eol_s.string[0]) --before.start;
+
+ if (data->buffer.string[before.start] == f_fss_eol_s.string[0]) ++before.start;
+ }
+
+ if (f_fss_payload_list_open_s.used && data->objects.array[at].stop + 1 < data->buffer.used) {
+ after.start = after.stop = data->objects.array[at].stop + 1;
+
+ if (data->buffer.string[after.stop] == f_fss_payload_list_open_s.string[0]) {
+ after.start = 1;
+ after.stop = 0;
+ }
+ else {
+ while (after.stop < data->buffer.used && data->buffer.string[after.stop] != f_fss_payload_list_open_s.string[0]) ++after.stop;
+
+ if (after.stop == data->buffer.used || data->buffer.string[after.stop] == f_fss_payload_list_open_s.string[0]) --after.stop;
+ }
+ }
+ }
+ }
+
+ if (before.start <= before.stop) {
+ f_print_except_dynamic_partial(data->buffer, before, delimits_object, main->output.to.stream);
+ }
+
+ f_print_except_dynamic_partial(data->buffer, data->objects.array[at], delimits_object, main->output.to.stream);
+
+ if (after.start <= after.stop) {
+ f_print_except_dynamic_partial(data->buffer, after, delimits_object, main->output.to.stream);
+ }
+ }
}
fss_payload_read_print_object_end(main);
print
run parameter:"script" ./tests/runtime/script/generate.sh parameter:"test_prefix"000e tests/runtime/fss_000e/source/test-0002-mixed.fss parameter:"build_path"test/fss_000e
+ print
+ print Generating Test 0003 for Payload (FSS-000E).
+ print
+ run parameter:"script" ./tests/runtime/script/generate.sh parameter:"test_prefix"000e tests/runtime/fss_000e/source/test-0003-object_space.fss parameter:"build_path"test/fss_000e
+
verify_process:
print
print Verifying Tests for Payload (FSS-000E).
d
a
привет
-y
+ y
"мир"
привет has space
"This is quoted"
-AlsoGood
-hi
-привет has space
+ AlsoGood
+hi
+ привет has space
a
also_empty
payload
d
a
привет
-y
+ y
"мир"
привет has space
"This is quoted"
-AlsoGood
-hi
-привет has space
+ AlsoGood
+hi
+ привет has space
a
also_empty
payload
привет:
мир
-y:
+ y :
z
"мир":
quoted, "yep".
\"and so does this" "have space"
"This is quoted":
But still a valid list.
-AlsoGood:
-hi:
+ AlsoGood:
+hi :
Check this.
-привет has space:
+ привет has space :
...
a:
a second "a".
привет:
мир
-y:
+ y :
z
"мир":
quoted, "yep".
\"and so does this" "have space"
"This is quoted":
But still a valid list.
-AlsoGood:
-hi:
+ AlsoGood:
+hi :
Check this.
-привет has space:
+ привет has space :
...
a:
a second "a".
a:
hi:
-a:
-a:
+ a:
+a :
:
The object name is an empty string.
a:
hi:
-a:
-a:
+ a:
+a :
:
The object name is an empty string.
-\# a valid list
+ \# a valid list
a
-\# a valid list
+ \# a valid list
a
"мир"
привет has space
empty
hi
-has spaces
+ has spaces
payload
a
-\# a valid list
+ \# a valid list
a
"мир"
привет has space
empty
hi
-has spaces
+ has spaces
payload
\\# even this is not.
привет мир a
-\# a valid list:
+ \# a valid list:
with content.
a:
another "A" list.
c d
привет мир a
-has spaces:
+ has spaces :
yep.
fin
payload:
\\# even this is not.
привет мир a
-\# a valid list:
+ \# a valid list:
with content.
a:
another "A" list.
c d
привет мир a
-has spaces:
+ has spaces :
yep.
fin
payload:
--- /dev/null
+
+ stuff
+
+ This has
+ Several lines
+
--- /dev/null
+мирмирмир
+
--- /dev/null
+Has no Object name (only white space) and is oddly spaced.
+
--- /dev/null
+Has no Object name (only white space) and is oddly spaced.
+
--- /dev/null
+
+ stuff
+
+ This has
+ Several lines
+
--- /dev/null
+
+ stuff
+
+ This has
+ Several lines
+
--- /dev/null
+
+ stuff
+
+ This has
+ Several lines
+
--- /dev/null
+
+ stuff
+
+ This has
+ Several lines
+
--- /dev/null
+мирмирмир
+
--- /dev/null
+мирмирмир
+
--- /dev/null
+привет has space
--- /dev/null
+ привет has space
--- /dev/null
+привет has space
--- /dev/null
+привет has space
--- /dev/null
+ a
+ привет has space
+ inside
+ \# Valid Object
+
+мир
+ hi
+payload
--- /dev/null
+ a
+ привет has space
+ inside
+ \# Valid Object
+
+мир
+ hi
+payload
--- /dev/null
+a
+привет has space
+inside
+# Valid Object
+
+мир
+hi
+payload
--- /dev/null
+a
+привет has space
+inside
+# Valid Object
+
+мир
+hi
+payload
--- /dev/null
+a
+привет has space
+inside
+# Valid Object
+
+мир
+hi
+payload
--- /dev/null
+a:
+
+ stuff
+
+ This has
+ Several lines
+
--- /dev/null
+привет has space:
--- /dev/null
+мир:
+мирмирмир
+
--- /dev/null
+ Several lines
--- /dev/null
+ Several lines
--- /dev/null
+:
+Has no Object name (only white space) and is oddly spaced.
+
--- /dev/null
+:
+Has no Object name (only white space) and is oddly spaced.
+
--- /dev/null
+ a :
+
+ stuff
+
+ This has
+ Several lines
+
--- /dev/null
+ a :
+
+ stuff
+
+ This has
+ Several lines
+
--- /dev/null
+a:
+
+ stuff
+
+ This has
+ Several lines
+
--- /dev/null
+a:
+
+ stuff
+
+ This has
+ Several lines
+
--- /dev/null
+мир:
+мирмирмир
+
--- /dev/null
+мир:
+мирмирмир
+
--- /dev/null
+привет has space:
--- /dev/null
+ a :
+
+ stuff
+
+ This has
+ Several lines
+
+ привет has space :
+ inside :
+
+ \# Valid Object :
+ with content.
+
+:
+Has no Object name (only white space) and is oddly spaced.
+
+мир :
+мирмирмир
+
+ hi :
+
+payload:
+0
+1
+2
+3
+done.