validation FEATURE multi-error parsing/validation
Refs #1978
diff --git a/src/parser_internal.h b/src/parser_internal.h
index 458d297..f807d4d 100644
--- a/src/parser_internal.h
+++ b/src/parser_internal.h
@@ -1,9 +1,10 @@
/**
* @file parser_internal.h
* @author Radek Krejci <rkrejci@cesnet.cz>
+ * @author Michal Vasko <mvasko@cesnet.cz>
* @brief Internal structures and functions for libyang parsers
*
- * Copyright (c) 2020 CESNET, z.s.p.o.
+ * Copyright (c) 2020 - 2023 CESNET, z.s.p.o.
*
* This source code is licensed under BSD 3-Clause License (the "License").
* You may not use this file except in compliance with the License.
@@ -27,6 +28,22 @@
struct lysp_ctx;
/**
+ * @brief Check data parser error taking into account multi-error validation.
+ *
+ * @param[in] r Local return value.
+ * @param[in] err_cmd Command to perform on any error.
+ * @param[in] lydctx Data parser context.
+ * @param[in] label Label to go to on fatal error.
+ */
+#define LY_DPARSER_ERR_GOTO(r, err_cmd, lydctx, label) \
+ if (r) { \
+ err_cmd; \
+ if ((r != LY_EVALID) || !lydctx || !(lydctx->val_opts & LYD_VALIDATE_MULTI_ERROR)) { \
+ goto label; \
+ } \
+ }
+
+/**
* @brief Callback for ::lyd_ctx to free the structure
*
* @param[in] ctx Data parser context to free.