Zenroom
Zenroom copied to clipboard
New zencode_parse/validate calls
More than one use-case has highlighted the need for a call that can parse the syntax of a zencode script and return if valid.
This also opens the possibility for another call that can parse the syntax and execute the Given statements to return if input is valid as expected.
The solution is to implement two new calls available from zenroom header and bindings:
// parse script and return if valid for syntax parser (no execution)
int zencode_parse_tobuf(char *script, char *stderr_buf, size_t stderr_len);
// parse script and execute Given steps to indicate if syntax valid and input valid
int zencode_validate_tobuf(char *script, char *conf, char *keys, char *data,
char *stdout_buf, size_t stdout_len,
char *stderr_buf, size_t stderr_len);
Both calls should return JSON parsable output since their use is in programmatic environment as libs.