Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
yaml/v2: use stack based parser. (#7661)
* yaml/v2: move to a stack based parser. Use a LIFO list (or stack) to save parser states. This allows code to be reused between inputs, outputs, filters, customs and processors. With this support for list-based properties for processors now works. Signed-off-by: Phillip Whelan <[email protected]> * yaml/v2: remove unused STATE_PROCESSOR_MAP. Signed-off-by: Phillip Whelan <[email protected]> * yaml/v2: use debug printing the structure/state event messages. Signed-off-by: Phillip Whelan <[email protected]> * yaml/v2: fix assignment when adding multiple processors. Signed-off-by: Phillip Whelan <[email protected]> * yaml/v2: move variable declarations out of switch case statements. Signed-off-by: Phillip Whelan <[email protected]> * yaml/v2: wrap state_names behind state_str function. Signed-off-by: Phillip Whelan <[email protected]> * processors: update fallback call in flb_processor_unit_set_property. Signed-off-by: Phillip Whelan <[email protected]> * yaml/v2: remove unused variables and functions. Signed-off-by: Phillip Whelan <[email protected]> * yaml/v2: move variable declaration out of case statement. Signed-off-by: Phillip Whelan <[email protected]> * yaml/v2: rename all instances 'i' to idx and remove local declarations. Signed-off-by: Phillip Whelan <[email protected]> * processors: fix memory leak in updated processor test. Signed-off-by: Phillip Whelan <[email protected]> * yaml/v2: improve tests. Signed-off-by: Phillip Whelan <[email protected]> * yaml/v2: add single parser file test. Signed-off-by: Phillip Whelan <[email protected]> * yaml/v2: finish test for parsers_file for yaml. Signed-off-by: Phillip Whelan <[email protected]> * yaml/v2: move to a stack based parser. Use a LIFO list (or stack) to save parser states. This allows code to be reused between inputs, outputs, filters, customs and processors. With this support for list-based properties for processors now works. Signed-off-by: Phillip Whelan <[email protected]> * yaml/v2: remove unused STATE_PROCESSOR_MAP. Signed-off-by: Phillip Whelan <[email protected]> * yaml/v2: windows fixes. Signed-off-by: Phillip Whelan <[email protected]> * yaml/v2: add missing parsers.conf test file. Signed-off-by: Phillip Whelan <[email protected]> * yaml/v2: free flb_config in parser test. Signed-off-by: Phillip Whelan <[email protected]> * yaml/v2: minor section fixes. Signed-off-by: Phillip Whelan <[email protected]> * yaml/v2: refactor state_name to use a switch case. Signed-off-by: Phillip Whelan <[email protected]> * yaml/v2: remove single letter variables. Signed-off-by: Phillip Whelan <[email protected]> * yaml/v2: check return values. Signed-off-by: Phillip Whelan <[email protected]> * yaml/v2: rewrite allocation flags as macros. Signed-off-by: Phillip Whelan <[email protected]> * yaml/v2: move all type definitions to the start. Signed-off-by: Phillip Whelan <[email protected]> * yaml/v2: rename get_last_included_file to state_get_last. Signed-off-by: Phillip Whelan <[email protected]> * yaml/v2: check return value of snprintf in read_glob. Signed-off-by: Phillip Whelan <[email protected]> * yaml/v2: fix return value for error in state_push_witharr. Signed-off-by: Phillip Whelan <[email protected]> * yaml/v2: remove comment. Signed-off-by: Phillip Whelan <[email protected]> * yaml/v2: adhere to code standard. Signed-off-by: Phillip Whelan <[email protected]> * yaml/v2: redefine HAS_KEY and HAS_KEYVALS as macros. Signed-off-by: Phillip Whelan <[email protected]> * yaml/v2: erase redefinitions. Signed-off-by: Phillip Whelan <[email protected]> * yaml/v2: release local variable 'file' and not 'cfg_file'. Signed-off-by: Phillip Whelan <[email protected]> * yaml/v2: check list size when getting current state. Signed-off-by: Phillip Whelan <[email protected]> * yaml/v2: move initialization out of declaration. Signed-off-by: Phillip Whelan <[email protected]> * yaml/v2: check return value of get_current_state. Signed-off-by: Phillip Whelan <[email protected]> * yaml/v2: check return value of flb_sds_printf when concatenating filename. Signed-off-by: Phillip Whelan <[email protected]> * yaml/v2: syntax fixes. Signed-off-by: Phillip Whelan <[email protected]> * yaml/v2: check everything in yaml_error_event. Signed-off-by: Phillip Whelan <[email protected]> * yaml/v2: check return values. Signed-off-by: Phillip Whelan <[email protected]> * yaml/v2: fix bugs introduced by code deduplication. Signed-off-by: Phillip Whelan <[email protected]> * yaml/v2: check return values for state_get_last. Signed-off-by: Phillip Whelan <[email protected]> * yaml/v2: fix 'e' undeclared error. Signed-off-by: Phillip Whelan <[email protected]> * yaml/v2: rename kv to prop. Signed-off-by: Phillip Whelan <[email protected]> * yaml/v2: add missing error handling. Signed-off-by: Phillip Whelan <[email protected]> * yaml/v2: fix codig violations in comments. Signed-off-by: Phillip Whelan <[email protected]> * yaml/v2: rename short variables. Signed-off-by: Phillip Whelan <[email protected]> * yaml/v2: check return values and fix memory leaks. Signed-off-by: Phillip Whelan <[email protected]> * yaml/v2: rename file to include_dir. Signed-off-by: Phillip Whelan <[email protected]> * yaml/v2: add new line before if, break out else to next line. Signed-off-by: Phillip Whelan <[email protected]> --------- Signed-off-by: Phillip Whelan <[email protected]>
- Loading branch information