parser REFACTOR unify context naming
diff --git a/src/parser_common.c b/src/parser_common.c
index 9a86ac1..79a0f44 100644
--- a/src/parser_common.c
+++ b/src/parser_common.c
@@ -285,21 +285,21 @@
return LY_SUCCESS;
}
-static LY_ERR lysp_stmt_container(struct lys_parser_ctx *ctx, const struct lysp_stmt *stmt, struct lysp_node *parent,
+static LY_ERR lysp_stmt_container(struct lysp_ctx *ctx, const struct lysp_stmt *stmt, struct lysp_node *parent,
struct lysp_node **siblings);
-static LY_ERR lysp_stmt_choice(struct lys_parser_ctx *ctx, const struct lysp_stmt *stmt, struct lysp_node *parent,
+static LY_ERR lysp_stmt_choice(struct lysp_ctx *ctx, const struct lysp_stmt *stmt, struct lysp_node *parent,
struct lysp_node **siblings);
-static LY_ERR lysp_stmt_case(struct lys_parser_ctx *ctx, const struct lysp_stmt *stmt, struct lysp_node *parent,
+static LY_ERR lysp_stmt_case(struct lysp_ctx *ctx, const struct lysp_stmt *stmt, struct lysp_node *parent,
struct lysp_node **siblings);
-static LY_ERR lysp_stmt_uses(struct lys_parser_ctx *ctx, const struct lysp_stmt *stmt, struct lysp_node *parent,
+static LY_ERR lysp_stmt_uses(struct lysp_ctx *ctx, const struct lysp_stmt *stmt, struct lysp_node *parent,
struct lysp_node **siblings);
-static LY_ERR lysp_stmt_grouping(struct lys_parser_ctx *ctx, const struct lysp_stmt *stmt, struct lysp_node *parent,
+static LY_ERR lysp_stmt_grouping(struct lysp_ctx *ctx, const struct lysp_stmt *stmt, struct lysp_node *parent,
struct lysp_node_grp **groupings);
-static LY_ERR lysp_stmt_list(struct lys_parser_ctx *ctx, const struct lysp_stmt *stmt, struct lysp_node *parent,
+static LY_ERR lysp_stmt_list(struct lysp_ctx *ctx, const struct lysp_stmt *stmt, struct lysp_node *parent,
struct lysp_node **siblings);
static LY_ERR
-lysp_stmt_validate_value(struct lys_parser_ctx *ctx, enum yang_arg val_type, const char *val)
+lysp_stmt_validate_value(struct lysp_ctx *ctx, enum yang_arg val_type, const char *val)
{
uint8_t prefix = 0;
ly_bool first = 1;
@@ -340,7 +340,7 @@
* @return LY_ERR values.
*/
static LY_ERR
-lysp_stmt_ext(struct lys_parser_ctx *ctx, const struct lysp_stmt *stmt, enum ly_stmt insubstmt,
+lysp_stmt_ext(struct lysp_ctx *ctx, const struct lysp_stmt *stmt, enum ly_stmt insubstmt,
LY_ARRAY_COUNT_TYPE insubstmt_index, struct lysp_ext_instance **exts)
{
struct lysp_ext_instance *e;
@@ -376,7 +376,7 @@
* @return LY_ERR values.
*/
static LY_ERR
-lysp_stmt_text_field(struct lys_parser_ctx *ctx, const struct lysp_stmt *stmt, uint32_t substmt_index,
+lysp_stmt_text_field(struct lysp_ctx *ctx, const struct lysp_stmt *stmt, uint32_t substmt_index,
const char **value, enum yang_arg arg, struct lysp_ext_instance **exts)
{
if (*value) {
@@ -412,7 +412,7 @@
* @return LY_ERR values.
*/
static LY_ERR
-lysp_stmt_qnames(struct lys_parser_ctx *ctx, const struct lysp_stmt *stmt,
+lysp_stmt_qnames(struct lysp_ctx *ctx, const struct lysp_stmt *stmt,
struct lysp_qname **qnames, enum yang_arg arg, struct lysp_ext_instance **exts)
{
struct lysp_qname *item;
@@ -449,7 +449,7 @@
* @return LY_ERR values.
*/
static LY_ERR
-lysp_stmt_text_fields(struct lys_parser_ctx *ctx, const struct lysp_stmt *stmt,
+lysp_stmt_text_fields(struct lysp_ctx *ctx, const struct lysp_stmt *stmt,
const char ***texts, enum yang_arg arg, struct lysp_ext_instance **exts)
{
const char **item;
@@ -484,7 +484,7 @@
* @return LY_ERR values.
*/
static LY_ERR
-lysp_stmt_status(struct lys_parser_ctx *ctx, const struct lysp_stmt *stmt, uint16_t *flags, struct lysp_ext_instance **exts)
+lysp_stmt_status(struct lysp_ctx *ctx, const struct lysp_stmt *stmt, uint16_t *flags, struct lysp_ext_instance **exts)
{
size_t arg_len;
@@ -529,7 +529,7 @@
* @return LY_ERR values.
*/
static LY_ERR
-lysp_stmt_when(struct lys_parser_ctx *ctx, const struct lysp_stmt *stmt, struct lysp_when **when_p)
+lysp_stmt_when(struct lysp_ctx *ctx, const struct lysp_stmt *stmt, struct lysp_when **when_p)
{
LY_ERR ret = LY_SUCCESS;
struct lysp_when *when;
@@ -577,7 +577,7 @@
* @return LY_ERR values.
*/
static LY_ERR
-lysp_stmt_config(struct lys_parser_ctx *ctx, const struct lysp_stmt *stmt, uint16_t *flags, struct lysp_ext_instance **exts)
+lysp_stmt_config(struct lysp_ctx *ctx, const struct lysp_stmt *stmt, uint16_t *flags, struct lysp_ext_instance **exts)
{
size_t arg_len;
@@ -622,7 +622,7 @@
* @return LY_ERR values.
*/
static LY_ERR
-lysp_stmt_mandatory(struct lys_parser_ctx *ctx, const struct lysp_stmt *stmt, uint16_t *flags,
+lysp_stmt_mandatory(struct lysp_ctx *ctx, const struct lysp_stmt *stmt, uint16_t *flags,
struct lysp_ext_instance **exts)
{
size_t arg_len;
@@ -667,7 +667,7 @@
* @return LY_ERR values.
*/
static LY_ERR
-lysp_stmt_restr(struct lys_parser_ctx *ctx, const struct lysp_stmt *stmt, struct lysp_restr *restr)
+lysp_stmt_restr(struct lysp_ctx *ctx, const struct lysp_stmt *stmt, struct lysp_restr *restr)
{
LY_CHECK_RET(lysp_stmt_validate_value(ctx, Y_STR_ARG, stmt->arg));
LY_CHECK_RET(lydict_insert(PARSER_CTX(ctx), stmt->arg, 0, &restr->arg.str));
@@ -708,7 +708,7 @@
* @return LY_ERR values.
*/
static LY_ERR
-lysp_stmt_restrs(struct lys_parser_ctx *ctx, const struct lysp_stmt *stmt, struct lysp_restr **restrs)
+lysp_stmt_restrs(struct lysp_ctx *ctx, const struct lysp_stmt *stmt, struct lysp_restr **restrs)
{
struct lysp_restr *restr;
@@ -726,7 +726,7 @@
* @return LY_ERR values.
*/
static LY_ERR
-lysp_stmt_any(struct lys_parser_ctx *ctx, const struct lysp_stmt *stmt, struct lysp_node *parent, struct lysp_node **siblings)
+lysp_stmt_any(struct lysp_ctx *ctx, const struct lysp_stmt *stmt, struct lysp_node *parent, struct lysp_node **siblings)
{
struct lysp_node_anydata *any;
@@ -792,7 +792,7 @@
* @return LY_ERR values.
*/
static LY_ERR
-lysp_stmt_type_enum_value_pos(struct lys_parser_ctx *ctx, const struct lysp_stmt *stmt, int64_t *value, uint16_t *flags,
+lysp_stmt_type_enum_value_pos(struct lysp_ctx *ctx, const struct lysp_stmt *stmt, int64_t *value, uint16_t *flags,
struct lysp_ext_instance **exts)
{
size_t arg_len;
@@ -870,7 +870,7 @@
* @return LY_ERR values.
*/
static LY_ERR
-lysp_stmt_type_enum(struct lys_parser_ctx *ctx, const struct lysp_stmt *stmt, struct lysp_type_enum **enums)
+lysp_stmt_type_enum(struct lysp_ctx *ctx, const struct lysp_stmt *stmt, struct lysp_type_enum **enums)
{
struct lysp_type_enum *enm;
@@ -932,7 +932,7 @@
* @return LY_ERR values.
*/
static LY_ERR
-lysp_stmt_type_fracdigits(struct lys_parser_ctx *ctx, const struct lysp_stmt *stmt, uint8_t *fracdig,
+lysp_stmt_type_fracdigits(struct lysp_ctx *ctx, const struct lysp_stmt *stmt, uint8_t *fracdig,
struct lysp_ext_instance **exts)
{
char *ptr;
@@ -989,7 +989,7 @@
* @return LY_ERR values.
*/
static LY_ERR
-lysp_stmt_type_reqinstance(struct lys_parser_ctx *ctx, const struct lysp_stmt *stmt, uint8_t *reqinst, uint16_t *flags,
+lysp_stmt_type_reqinstance(struct lysp_ctx *ctx, const struct lysp_stmt *stmt, uint8_t *reqinst, uint16_t *flags,
struct lysp_ext_instance **exts)
{
size_t arg_len;
@@ -1033,7 +1033,7 @@
* @return LY_ERR values.
*/
static LY_ERR
-lysp_stmt_type_pattern_modifier(struct lys_parser_ctx *ctx, const struct lysp_stmt *stmt, const char **pat,
+lysp_stmt_type_pattern_modifier(struct lysp_ctx *ctx, const struct lysp_stmt *stmt, const char **pat,
struct lysp_ext_instance **exts)
{
size_t arg_len;
@@ -1084,7 +1084,7 @@
* @return LY_ERR values.
*/
static LY_ERR
-lysp_stmt_type_pattern(struct lys_parser_ctx *ctx, const struct lysp_stmt *stmt, struct lysp_restr **patterns)
+lysp_stmt_type_pattern(struct lysp_ctx *ctx, const struct lysp_stmt *stmt, struct lysp_restr **patterns)
{
char *buf;
size_t arg_len;
@@ -1142,7 +1142,7 @@
* @return LY_ERR values.
*/
static LY_ERR
-lysp_stmt_type(struct lys_parser_ctx *ctx, const struct lysp_stmt *stmt, struct lysp_type *type)
+lysp_stmt_type(struct lysp_ctx *ctx, const struct lysp_stmt *stmt, struct lysp_type *type)
{
struct lysp_type *nest_type;
const char *str_path = NULL;
@@ -1240,7 +1240,7 @@
* @return LY_ERR values.
*/
static LY_ERR
-lysp_stmt_leaf(struct lys_parser_ctx *ctx, const struct lysp_stmt *stmt, struct lysp_node *parent, struct lysp_node **siblings)
+lysp_stmt_leaf(struct lysp_ctx *ctx, const struct lysp_stmt *stmt, struct lysp_node *parent, struct lysp_node **siblings)
{
struct lysp_node_leaf *leaf;
@@ -1321,7 +1321,7 @@
* @return LY_ERR values.
*/
static LY_ERR
-lysp_stmt_maxelements(struct lys_parser_ctx *ctx, const struct lysp_stmt *stmt,
+lysp_stmt_maxelements(struct lysp_ctx *ctx, const struct lysp_stmt *stmt,
uint32_t *max, uint16_t *flags, struct lysp_ext_instance **exts)
{
size_t arg_len;
@@ -1388,7 +1388,7 @@
* @return LY_ERR values.
*/
static LY_ERR
-lysp_stmt_minelements(struct lys_parser_ctx *ctx, const struct lysp_stmt *stmt,
+lysp_stmt_minelements(struct lysp_ctx *ctx, const struct lysp_stmt *stmt,
uint32_t *min, uint16_t *flags, struct lysp_ext_instance **exts)
{
size_t arg_len;
@@ -1448,7 +1448,7 @@
* @return LY_ERR values.
*/
static LY_ERR
-lysp_stmt_orderedby(struct lys_parser_ctx *ctx, const struct lysp_stmt *stmt, uint16_t *flags, struct lysp_ext_instance **exts)
+lysp_stmt_orderedby(struct lysp_ctx *ctx, const struct lysp_stmt *stmt, uint16_t *flags, struct lysp_ext_instance **exts)
{
size_t arg_len;
@@ -1494,7 +1494,7 @@
* @return LY_ERR values.
*/
static LY_ERR
-lysp_stmt_leaflist(struct lys_parser_ctx *ctx, const struct lysp_stmt *stmt, struct lysp_node *parent,
+lysp_stmt_leaflist(struct lysp_ctx *ctx, const struct lysp_stmt *stmt, struct lysp_node *parent,
struct lysp_node **siblings)
{
struct lysp_node_leaflist *llist;
@@ -1580,7 +1580,7 @@
* @return LY_ERR values.
*/
static LY_ERR
-lysp_stmt_refine(struct lys_parser_ctx *ctx, const struct lysp_stmt *stmt, struct lysp_refine **refines)
+lysp_stmt_refine(struct lysp_ctx *ctx, const struct lysp_stmt *stmt, struct lysp_refine **refines)
{
struct lysp_refine *rf;
@@ -1646,7 +1646,7 @@
* @return LY_ERR values.
*/
static LY_ERR
-lysp_stmt_typedef(struct lys_parser_ctx *ctx, const struct lysp_stmt *stmt, struct lysp_node *parent,
+lysp_stmt_typedef(struct lysp_ctx *ctx, const struct lysp_stmt *stmt, struct lysp_node *parent,
struct lysp_tpdf **typedefs)
{
struct lysp_tpdf *tpdf;
@@ -1713,7 +1713,7 @@
* @return LY_ERR values.
*/
static LY_ERR
-lysp_stmt_inout(struct lys_parser_ctx *ctx, const struct lysp_stmt *stmt, struct lysp_node *parent,
+lysp_stmt_inout(struct lysp_ctx *ctx, const struct lysp_stmt *stmt, struct lysp_node *parent,
struct lysp_node_action_inout *inout_p)
{
if (inout_p->nodetype) {
@@ -1791,7 +1791,7 @@
* @return LY_ERR values.
*/
static LY_ERR
-lysp_stmt_action(struct lys_parser_ctx *ctx, const struct lysp_stmt *stmt, struct lysp_node *parent,
+lysp_stmt_action(struct lysp_ctx *ctx, const struct lysp_stmt *stmt, struct lysp_node *parent,
struct lysp_node_action **actions)
{
struct lysp_node_action *act;
@@ -1867,7 +1867,7 @@
* @return LY_ERR values.
*/
static LY_ERR
-lysp_stmt_notif(struct lys_parser_ctx *ctx, const struct lysp_stmt *stmt, struct lysp_node *parent,
+lysp_stmt_notif(struct lysp_ctx *ctx, const struct lysp_stmt *stmt, struct lysp_node *parent,
struct lysp_node_notif **notifs)
{
struct lysp_node_notif *notif;
@@ -1953,7 +1953,7 @@
* @return LY_ERR values.
*/
static LY_ERR
-lysp_stmt_grouping(struct lys_parser_ctx *ctx, const struct lysp_stmt *stmt, struct lysp_node *parent,
+lysp_stmt_grouping(struct lysp_ctx *ctx, const struct lysp_stmt *stmt, struct lysp_node *parent,
struct lysp_node_grp **groupings)
{
struct lysp_node_grp *grp;
@@ -2040,7 +2040,7 @@
* @return LY_ERR values.
*/
static LY_ERR
-lysp_stmt_augment(struct lys_parser_ctx *ctx, const struct lysp_stmt *stmt, struct lysp_node *parent,
+lysp_stmt_augment(struct lysp_ctx *ctx, const struct lysp_stmt *stmt, struct lysp_node *parent,
struct lysp_node_augment **augments)
{
struct lysp_node_augment *aug;
@@ -2130,7 +2130,7 @@
* @return LY_ERR values.
*/
static LY_ERR
-lysp_stmt_uses(struct lys_parser_ctx *ctx, const struct lysp_stmt *stmt, struct lysp_node *parent,
+lysp_stmt_uses(struct lysp_ctx *ctx, const struct lysp_stmt *stmt, struct lysp_node *parent,
struct lysp_node **siblings)
{
struct lysp_node_uses *uses;
@@ -2192,7 +2192,7 @@
* @return LY_ERR values.
*/
static LY_ERR
-lysp_stmt_case(struct lys_parser_ctx *ctx, const struct lysp_stmt *stmt, struct lysp_node *parent,
+lysp_stmt_case(struct lysp_ctx *ctx, const struct lysp_stmt *stmt, struct lysp_node *parent,
struct lysp_node **siblings)
{
struct lysp_node_case *cas;
@@ -2271,7 +2271,7 @@
* @return LY_ERR values.
*/
static LY_ERR
-lysp_stmt_choice(struct lys_parser_ctx *ctx, const struct lysp_stmt *stmt, struct lysp_node *parent,
+lysp_stmt_choice(struct lysp_ctx *ctx, const struct lysp_stmt *stmt, struct lysp_node *parent,
struct lysp_node **siblings)
{
struct lysp_node_choice *choice;
@@ -2360,7 +2360,7 @@
* @return LY_ERR values.
*/
static LY_ERR
-lysp_stmt_container(struct lys_parser_ctx *ctx, const struct lysp_stmt *stmt, struct lysp_node *parent,
+lysp_stmt_container(struct lysp_ctx *ctx, const struct lysp_stmt *stmt, struct lysp_node *parent,
struct lysp_node **siblings)
{
struct lysp_node_container *cont;
@@ -2463,7 +2463,7 @@
* @return LY_ERR values.
*/
static LY_ERR
-lysp_stmt_list(struct lys_parser_ctx *ctx, const struct lysp_stmt *stmt, struct lysp_node *parent,
+lysp_stmt_list(struct lysp_ctx *ctx, const struct lysp_stmt *stmt, struct lysp_node *parent,
struct lysp_node **siblings)
{
struct lysp_node_list *list;
@@ -2573,7 +2573,7 @@
{
LY_ERR ret = LY_SUCCESS;
uint16_t flags;
- struct lys_parser_ctx pctx = {0};
+ struct lysp_ctx pctx = {0};
struct ly_set pmods = {0};
void *objs;
diff --git a/src/parser_internal.h b/src/parser_internal.h
index 627836a..09410a0 100644
--- a/src/parser_internal.h
+++ b/src/parser_internal.h
@@ -20,9 +20,9 @@
struct lyd_ctx;
struct ly_in;
-struct lys_yang_parser_ctx;
-struct lys_yin_parser_ctx;
-struct lys_parser_ctx;
+struct lysp_yang_ctx;
+struct lysp_yin_ctx;
+struct lysp_ctx;
/**
* @brief Callback for ::lyd_ctx to free the structure
@@ -178,7 +178,7 @@
* @param[out] submod Pointer to the parsed submodule structure.
* @return LY_ERR value - LY_SUCCESS, LY_EINVAL or LY_EVALID.
*/
-LY_ERR yang_parse_submodule(struct lys_yang_parser_ctx **context, struct ly_ctx *ly_ctx, struct lys_parser_ctx *main_ctx,
+LY_ERR yang_parse_submodule(struct lysp_yang_ctx **context, struct ly_ctx *ly_ctx, struct lysp_ctx *main_ctx,
struct ly_in *in, struct lysp_submodule **submod);
/**
@@ -189,7 +189,7 @@
* module structure, will be filled in.
* @return LY_ERR values.
*/
-LY_ERR yang_parse_module(struct lys_yang_parser_ctx **context, struct ly_in *in, struct lys_module *mod);
+LY_ERR yang_parse_module(struct lysp_yang_ctx **context, struct ly_in *in, struct lys_module *mod);
/**
* @brief Parse module from YIN data.
@@ -200,7 +200,7 @@
* module structure, will be filled in.
* @return LY_ERR values.
*/
-LY_ERR yin_parse_module(struct lys_yin_parser_ctx **yin_ctx, struct ly_in *in, struct lys_module *mod);
+LY_ERR yin_parse_module(struct lysp_yin_ctx **yin_ctx, struct ly_in *in, struct lys_module *mod);
/**
* @brief Parse submodule from YIN data.
@@ -212,7 +212,7 @@
* @param[in,out] submod Submodule structure where the parsed information, will be filled in.
* @return LY_ERR values.
*/
-LY_ERR yin_parse_submodule(struct lys_yin_parser_ctx **yin_ctx, struct ly_ctx *ctx, struct lys_parser_ctx *main_ctx,
+LY_ERR yin_parse_submodule(struct lysp_yin_ctx **yin_ctx, struct ly_ctx *ctx, struct lysp_ctx *main_ctx,
struct ly_in *in, struct lysp_submodule **submod);
/**
diff --git a/src/parser_yang.c b/src/parser_yang.c
index 3a1fe17..5db623d 100644
--- a/src/parser_yang.c
+++ b/src/parser_yang.c
@@ -106,12 +106,12 @@
__loop_end = 1; \
}
-LY_ERR parse_container(struct lys_yang_parser_ctx *ctx, struct lysp_node *parent, struct lysp_node **siblings);
-LY_ERR parse_uses(struct lys_yang_parser_ctx *ctx, struct lysp_node *parent, struct lysp_node **siblings);
-LY_ERR parse_choice(struct lys_yang_parser_ctx *ctx, struct lysp_node *parent, struct lysp_node **siblings);
-LY_ERR parse_case(struct lys_yang_parser_ctx *ctx, struct lysp_node *parent, struct lysp_node **siblings);
-LY_ERR parse_list(struct lys_yang_parser_ctx *ctx, struct lysp_node *parent, struct lysp_node **siblings);
-LY_ERR parse_grouping(struct lys_yang_parser_ctx *ctx, struct lysp_node *parent, struct lysp_node_grp **groupings);
+LY_ERR parse_container(struct lysp_yang_ctx *ctx, struct lysp_node *parent, struct lysp_node **siblings);
+LY_ERR parse_uses(struct lysp_yang_ctx *ctx, struct lysp_node *parent, struct lysp_node **siblings);
+LY_ERR parse_choice(struct lysp_yang_ctx *ctx, struct lysp_node *parent, struct lysp_node **siblings);
+LY_ERR parse_case(struct lysp_yang_ctx *ctx, struct lysp_node *parent, struct lysp_node **siblings);
+LY_ERR parse_list(struct lysp_yang_ctx *ctx, struct lysp_node *parent, struct lysp_node **siblings);
+LY_ERR parse_grouping(struct lysp_yang_ctx *ctx, struct lysp_node *parent, struct lysp_node_grp **groupings);
/**
* @brief Add another character to dynamic buffer, a low-level function.
@@ -164,7 +164,7 @@
* @return LY_ERR values.
*/
LY_ERR
-buf_store_char(struct lys_yang_parser_ctx *ctx, enum yang_arg arg, char **word_p, size_t *word_len,
+buf_store_char(struct lysp_yang_ctx *ctx, enum yang_arg arg, char **word_p, size_t *word_len,
char **word_b, size_t *buf_len, ly_bool need_buf, uint8_t *prefix)
{
uint32_t c;
@@ -188,14 +188,14 @@
/* check character validity */
switch (arg) {
case Y_IDENTIF_ARG:
- LY_CHECK_RET(lysp_check_identifierchar((struct lys_parser_ctx *)ctx, c, !(*word_len), NULL));
+ LY_CHECK_RET(lysp_check_identifierchar((struct lysp_ctx *)ctx, c, !(*word_len), NULL));
break;
case Y_PREF_IDENTIF_ARG:
- LY_CHECK_RET(lysp_check_identifierchar((struct lys_parser_ctx *)ctx, c, !(*word_len), prefix));
+ LY_CHECK_RET(lysp_check_identifierchar((struct lysp_ctx *)ctx, c, !(*word_len), prefix));
break;
case Y_STR_ARG:
case Y_MAYBE_STR_ARG:
- LY_CHECK_RET(lysp_check_stringchar((struct lys_parser_ctx *)ctx, c));
+ LY_CHECK_RET(lysp_check_stringchar((struct lysp_ctx *)ctx, c));
break;
}
@@ -246,7 +246,7 @@
* @return LY_ERR values.
*/
LY_ERR
-skip_comment(struct lys_yang_parser_ctx *ctx, uint8_t comment)
+skip_comment(struct lysp_yang_ctx *ctx, uint8_t comment)
{
/* internal statuses: */
#define COMMENT_NO 0 /* comment ended */
@@ -319,7 +319,7 @@
* @return LY_ERR values.
*/
static LY_ERR
-read_qstring(struct lys_yang_parser_ctx *ctx, enum yang_arg arg, char **word_p, char **word_b,
+read_qstring(struct lysp_yang_ctx *ctx, enum yang_arg arg, char **word_p, char **word_b,
size_t *word_len, size_t *buf_len)
{
/* string parsing status: */
@@ -572,7 +572,7 @@
* @return LY_ERR values.
*/
LY_ERR
-get_argument(struct lys_yang_parser_ctx *ctx, enum yang_arg arg, uint16_t *flags, char **word_p,
+get_argument(struct lysp_yang_ctx *ctx, enum yang_arg arg, uint16_t *flags, char **word_p,
char **word_b, size_t *word_len)
{
LY_ERR ret;
@@ -711,7 +711,7 @@
* @return LY_ERR values.
*/
LY_ERR
-get_keyword(struct lys_yang_parser_ctx *ctx, enum ly_stmt *kw, char **word_p, size_t *word_len)
+get_keyword(struct lysp_yang_ctx *ctx, enum ly_stmt *kw, char **word_p, size_t *word_len)
{
uint8_t prefix;
const char *word_start;
@@ -833,7 +833,7 @@
LOGVAL_PARSER(ctx, LY_VCODE_INCHAR, ctx->in->current[-len]), LY_EVALID);
++ctx->indent;
/* check character validity */
- LY_CHECK_RET(lysp_check_identifierchar((struct lys_parser_ctx *)ctx, c,
+ LY_CHECK_RET(lysp_check_identifierchar((struct lysp_ctx *)ctx, c,
ctx->in->current - len == word_start ? 1 : 0, &prefix));
}
if (!ctx->in->current[0]) {
@@ -871,7 +871,7 @@
* @return LY_ERR values.
*/
static LY_ERR
-parse_ext_substmt(struct lys_yang_parser_ctx *ctx, enum ly_stmt kw, char *word, size_t word_len,
+parse_ext_substmt(struct lysp_yang_ctx *ctx, enum ly_stmt kw, char *word, size_t word_len,
struct lysp_stmt **child)
{
char *buf;
@@ -925,7 +925,7 @@
* @return LY_ERR values.
*/
static LY_ERR
-parse_ext(struct lys_yang_parser_ctx *ctx, const char *ext_name, size_t ext_name_len, enum ly_stmt insubstmt,
+parse_ext(struct lysp_yang_ctx *ctx, const char *ext_name, size_t ext_name_len, enum ly_stmt insubstmt,
LY_ARRAY_COUNT_TYPE insubstmt_index, struct lysp_ext_instance **exts)
{
LY_ERR ret = LY_SUCCESS;
@@ -980,7 +980,7 @@
* @return LY_ERR values.
*/
static LY_ERR
-parse_text_field(struct lys_yang_parser_ctx *ctx, enum ly_stmt substmt, uint32_t substmt_index,
+parse_text_field(struct lysp_yang_ctx *ctx, enum ly_stmt substmt, uint32_t substmt_index,
const char **value, enum yang_arg arg, struct lysp_ext_instance **exts)
{
LY_ERR ret = LY_SUCCESS;
@@ -1025,7 +1025,7 @@
* @return LY_ERR values.
*/
static LY_ERR
-parse_yangversion(struct lys_yang_parser_ctx *ctx, uint8_t *version, struct lysp_ext_instance **exts)
+parse_yangversion(struct lysp_yang_ctx *ctx, uint8_t *version, struct lysp_ext_instance **exts)
{
LY_ERR ret = LY_SUCCESS;
char *buf, *word;
@@ -1077,7 +1077,7 @@
* @return LY_ERR values.
*/
static LY_ERR
-parse_belongsto(struct lys_yang_parser_ctx *ctx, const char **prefix, struct lysp_ext_instance **exts)
+parse_belongsto(struct lysp_yang_ctx *ctx, const char **prefix, struct lysp_ext_instance **exts)
{
LY_ERR ret = LY_SUCCESS;
char *buf, *word;
@@ -1134,7 +1134,7 @@
* @return LY_ERR values.
*/
static LY_ERR
-parse_revisiondate(struct lys_yang_parser_ctx *ctx, char *rev, struct lysp_ext_instance **exts)
+parse_revisiondate(struct lysp_yang_ctx *ctx, char *rev, struct lysp_ext_instance **exts)
{
LY_ERR ret = LY_SUCCESS;
char *buf, *word;
@@ -1150,7 +1150,7 @@
LY_CHECK_RET(get_argument(ctx, Y_STR_ARG, NULL, &word, &buf, &word_len));
/* check value */
- if (lysp_check_date((struct lys_parser_ctx *)ctx, word, word_len, "revision-date")) {
+ if (lysp_check_date((struct lysp_ctx *)ctx, word, word_len, "revision-date")) {
free(buf);
return LY_EVALID;
}
@@ -1185,7 +1185,7 @@
* @return LY_ERR values.
*/
static LY_ERR
-parse_include(struct lys_yang_parser_ctx *ctx, const char *module_name, struct lysp_include **includes)
+parse_include(struct lysp_yang_ctx *ctx, const char *module_name, struct lysp_include **includes)
{
LY_ERR ret = LY_SUCCESS;
char *buf, *word;
@@ -1244,7 +1244,7 @@
* @return LY_ERR values.
*/
static LY_ERR
-parse_import(struct lys_yang_parser_ctx *ctx, const char *module_prefix, struct lysp_import **imports)
+parse_import(struct lysp_yang_ctx *ctx, const char *module_prefix, struct lysp_import **imports)
{
LY_ERR ret = LY_SUCCESS;
char *buf, *word;
@@ -1262,7 +1262,7 @@
switch (kw) {
case LY_STMT_PREFIX:
LY_CHECK_RET(parse_text_field(ctx, LY_STMT_PREFIX, 0, &imp->prefix, Y_IDENTIF_ARG, &imp->exts));
- LY_CHECK_RET(lysp_check_prefix((struct lys_parser_ctx *)ctx, *imports, module_prefix, &imp->prefix), LY_EVALID);
+ LY_CHECK_RET(lysp_check_prefix((struct lysp_ctx *)ctx, *imports, module_prefix, &imp->prefix), LY_EVALID);
break;
case LY_STMT_DESCRIPTION:
PARSER_CHECK_STMTVER2_RET(ctx, "description", "import");
@@ -1301,7 +1301,7 @@
* @return LY_ERR values.
*/
static LY_ERR
-parse_revision(struct lys_yang_parser_ctx *ctx, struct lysp_revision **revs)
+parse_revision(struct lysp_yang_ctx *ctx, struct lysp_revision **revs)
{
LY_ERR ret = LY_SUCCESS;
char *buf, *word;
@@ -1315,7 +1315,7 @@
LY_CHECK_RET(get_argument(ctx, Y_STR_ARG, NULL, &word, &buf, &word_len));
/* check value */
- if (lysp_check_date((struct lys_parser_ctx *)ctx, word, word_len, "revision")) {
+ if (lysp_check_date((struct lysp_ctx *)ctx, word, word_len, "revision")) {
free(buf);
return LY_EVALID;
}
@@ -1357,7 +1357,7 @@
* @return LY_ERR values.
*/
static LY_ERR
-parse_text_fields(struct lys_yang_parser_ctx *ctx, enum ly_stmt substmt, const char ***texts, enum yang_arg arg,
+parse_text_fields(struct lysp_yang_ctx *ctx, enum ly_stmt substmt, const char ***texts, enum yang_arg arg,
struct lysp_ext_instance **exts)
{
LY_ERR ret = LY_SUCCESS;
@@ -1401,7 +1401,7 @@
* @return LY_ERR values.
*/
static LY_ERR
-parse_qnames(struct lys_yang_parser_ctx *ctx, enum ly_stmt substmt, struct lysp_qname **qnames,
+parse_qnames(struct lysp_yang_ctx *ctx, enum ly_stmt substmt, struct lysp_qname **qnames,
enum yang_arg arg, struct lysp_ext_instance **exts)
{
LY_ERR ret = LY_SUCCESS;
@@ -1444,7 +1444,7 @@
* @return LY_ERR values.
*/
static LY_ERR
-parse_config(struct lys_yang_parser_ctx *ctx, uint16_t *flags, struct lysp_ext_instance **exts)
+parse_config(struct lysp_yang_ctx *ctx, uint16_t *flags, struct lysp_ext_instance **exts)
{
LY_ERR ret = LY_SUCCESS;
char *buf, *word;
@@ -1496,7 +1496,7 @@
* @return LY_ERR values.
*/
static LY_ERR
-parse_mandatory(struct lys_yang_parser_ctx *ctx, uint16_t *flags, struct lysp_ext_instance **exts)
+parse_mandatory(struct lysp_yang_ctx *ctx, uint16_t *flags, struct lysp_ext_instance **exts)
{
LY_ERR ret = LY_SUCCESS;
char *buf, *word;
@@ -1548,7 +1548,7 @@
* @return LY_ERR values.
*/
static LY_ERR
-parse_restr(struct lys_yang_parser_ctx *ctx, enum ly_stmt restr_kw, struct lysp_restr *restr)
+parse_restr(struct lysp_yang_ctx *ctx, enum ly_stmt restr_kw, struct lysp_restr *restr)
{
LY_ERR ret = LY_SUCCESS;
char *buf, *word;
@@ -1599,7 +1599,7 @@
* @return LY_ERR values.
*/
static LY_ERR
-parse_restrs(struct lys_yang_parser_ctx *ctx, enum ly_stmt restr_kw, struct lysp_restr **restrs)
+parse_restrs(struct lysp_yang_ctx *ctx, enum ly_stmt restr_kw, struct lysp_restr **restrs)
{
struct lysp_restr *restr;
@@ -1617,7 +1617,7 @@
* @return LY_ERR values.
*/
static LY_ERR
-parse_status(struct lys_yang_parser_ctx *ctx, uint16_t *flags, struct lysp_ext_instance **exts)
+parse_status(struct lysp_yang_ctx *ctx, uint16_t *flags, struct lysp_ext_instance **exts)
{
LY_ERR ret = LY_SUCCESS;
char *buf, *word;
@@ -1670,7 +1670,7 @@
* @return LY_ERR values.
*/
LY_ERR
-parse_when(struct lys_yang_parser_ctx *ctx, struct lysp_when **when_p)
+parse_when(struct lysp_yang_ctx *ctx, struct lysp_when **when_p)
{
LY_ERR ret = LY_SUCCESS;
char *buf, *word;
@@ -1731,7 +1731,7 @@
* @return LY_ERR values.
*/
LY_ERR
-parse_any(struct lys_yang_parser_ctx *ctx, enum ly_stmt any_kw, struct lysp_node *parent, struct lysp_node **siblings)
+parse_any(struct lysp_yang_ctx *ctx, enum ly_stmt any_kw, struct lysp_node *parent, struct lysp_node **siblings)
{
LY_ERR ret = LY_SUCCESS;
char *buf, *word;
@@ -1802,7 +1802,7 @@
* @return LY_ERR values.
*/
LY_ERR
-parse_type_enum_value_pos(struct lys_yang_parser_ctx *ctx, enum ly_stmt val_kw, int64_t *value, uint16_t *flags,
+parse_type_enum_value_pos(struct lysp_yang_ctx *ctx, enum ly_stmt val_kw, int64_t *value, uint16_t *flags,
struct lysp_ext_instance **exts)
{
LY_ERR ret = LY_SUCCESS;
@@ -1890,7 +1890,7 @@
* @return LY_ERR values.
*/
static LY_ERR
-parse_type_enum(struct lys_yang_parser_ctx *ctx, enum ly_stmt enum_kw, struct lysp_type_enum **enums)
+parse_type_enum(struct lysp_yang_ctx *ctx, enum ly_stmt enum_kw, struct lysp_type_enum **enums)
{
LY_ERR ret = LY_SUCCESS;
char *buf, *word;
@@ -1903,7 +1903,7 @@
/* get value */
LY_CHECK_RET(get_argument(ctx, enum_kw == LY_STMT_ENUM ? Y_STR_ARG : Y_IDENTIF_ARG, NULL, &word, &buf, &word_len));
if (enum_kw == LY_STMT_ENUM) {
- ret = lysp_check_enum_name((struct lys_parser_ctx *)ctx, (const char *)word, word_len);
+ ret = lysp_check_enum_name((struct lysp_ctx *)ctx, (const char *)word, word_len);
LY_CHECK_ERR_RET(ret, free(buf), ret);
} /* else nothing specific for YANG_BIT */
@@ -1959,7 +1959,7 @@
* @return LY_ERR values.
*/
static LY_ERR
-parse_type_fracdigits(struct lys_yang_parser_ctx *ctx, uint8_t *fracdig, struct lysp_ext_instance **exts)
+parse_type_fracdigits(struct lysp_yang_ctx *ctx, uint8_t *fracdig, struct lysp_ext_instance **exts)
{
LY_ERR ret = LY_SUCCESS;
char *buf = NULL, *word, *ptr;
@@ -2025,7 +2025,7 @@
* @return LY_ERR values.
*/
static LY_ERR
-parse_type_reqinstance(struct lys_yang_parser_ctx *ctx, uint8_t *reqinst, uint16_t *flags,
+parse_type_reqinstance(struct lysp_yang_ctx *ctx, uint8_t *reqinst, uint16_t *flags,
struct lysp_ext_instance **exts)
{
LY_ERR ret = LY_SUCCESS;
@@ -2078,7 +2078,7 @@
* @return LY_ERR values.
*/
static LY_ERR
-parse_type_pattern_modifier(struct lys_yang_parser_ctx *ctx, const char **pat, struct lysp_ext_instance **exts)
+parse_type_pattern_modifier(struct lysp_yang_ctx *ctx, const char **pat, struct lysp_ext_instance **exts)
{
LY_ERR ret = LY_SUCCESS;
char *buf = NULL, *word;
@@ -2137,7 +2137,7 @@
* @return LY_ERR values.
*/
static LY_ERR
-parse_type_pattern(struct lys_yang_parser_ctx *ctx, struct lysp_restr **patterns)
+parse_type_pattern(struct lysp_yang_ctx *ctx, struct lysp_restr **patterns)
{
LY_ERR ret = LY_SUCCESS;
char *buf, *word;
@@ -2207,7 +2207,7 @@
* @return LY_ERR values.
*/
static LY_ERR
-parse_type(struct lys_yang_parser_ctx *ctx, struct lysp_type *type)
+parse_type(struct lysp_yang_ctx *ctx, struct lysp_type *type)
{
LY_ERR ret = LY_SUCCESS;
char *buf, *word;
@@ -2324,7 +2324,7 @@
* @return LY_ERR values.
*/
LY_ERR
-parse_leaf(struct lys_yang_parser_ctx *ctx, struct lysp_node *parent, struct lysp_node **siblings)
+parse_leaf(struct lysp_yang_ctx *ctx, struct lysp_node *parent, struct lysp_node **siblings)
{
LY_ERR ret = LY_SUCCESS;
char *buf, *word;
@@ -2409,7 +2409,7 @@
* @return LY_ERR values.
*/
LY_ERR
-parse_maxelements(struct lys_yang_parser_ctx *ctx, uint32_t *max, uint16_t *flags, struct lysp_ext_instance **exts)
+parse_maxelements(struct lysp_yang_ctx *ctx, uint32_t *max, uint16_t *flags, struct lysp_ext_instance **exts)
{
LY_ERR ret = LY_SUCCESS;
char *buf = NULL, *word, *ptr;
@@ -2483,7 +2483,7 @@
* @return LY_ERR values.
*/
LY_ERR
-parse_minelements(struct lys_yang_parser_ctx *ctx, uint32_t *min, uint16_t *flags, struct lysp_ext_instance **exts)
+parse_minelements(struct lysp_yang_ctx *ctx, uint32_t *min, uint16_t *flags, struct lysp_ext_instance **exts)
{
LY_ERR ret = LY_SUCCESS;
char *buf = NULL, *word, *ptr;
@@ -2549,7 +2549,7 @@
* @return LY_ERR values.
*/
static LY_ERR
-parse_orderedby(struct lys_yang_parser_ctx *ctx, uint16_t *flags, struct lysp_ext_instance **exts)
+parse_orderedby(struct lysp_yang_ctx *ctx, uint16_t *flags, struct lysp_ext_instance **exts)
{
LY_ERR ret = LY_SUCCESS;
char *buf = NULL, *word;
@@ -2601,7 +2601,7 @@
* @return LY_ERR values.
*/
LY_ERR
-parse_leaflist(struct lys_yang_parser_ctx *ctx, struct lysp_node *parent, struct lysp_node **siblings)
+parse_leaflist(struct lysp_yang_ctx *ctx, struct lysp_node *parent, struct lysp_node **siblings)
{
LY_ERR ret = LY_SUCCESS;
char *buf, *word;
@@ -2690,7 +2690,7 @@
* @return LY_ERR values.
*/
static LY_ERR
-parse_refine(struct lys_yang_parser_ctx *ctx, struct lysp_refine **refines)
+parse_refine(struct lysp_yang_ctx *ctx, struct lysp_refine **refines)
{
LY_ERR ret = LY_SUCCESS;
char *buf, *word;
@@ -2761,7 +2761,7 @@
* @return LY_ERR values.
*/
static LY_ERR
-parse_typedef(struct lys_yang_parser_ctx *ctx, struct lysp_node *parent, struct lysp_tpdf **typedefs)
+parse_typedef(struct lysp_yang_ctx *ctx, struct lysp_node *parent, struct lysp_tpdf **typedefs)
{
LY_ERR ret = LY_SUCCESS;
char *buf, *word;
@@ -2833,7 +2833,7 @@
* @return LY_ERR values.
*/
static LY_ERR
-parse_inout(struct lys_yang_parser_ctx *ctx, enum ly_stmt inout_kw, struct lysp_node *parent,
+parse_inout(struct lysp_yang_ctx *ctx, enum ly_stmt inout_kw, struct lysp_node *parent,
struct lysp_node_action_inout *inout_p)
{
LY_ERR ret = LY_SUCCESS;
@@ -2917,7 +2917,7 @@
* @return LY_ERR values.
*/
LY_ERR
-parse_action(struct lys_yang_parser_ctx *ctx, struct lysp_node *parent, struct lysp_node_action **actions)
+parse_action(struct lysp_yang_ctx *ctx, struct lysp_node *parent, struct lysp_node_action **actions)
{
LY_ERR ret = LY_SUCCESS;
char *buf, *word;
@@ -2996,7 +2996,7 @@
* @return LY_ERR values.
*/
LY_ERR
-parse_notif(struct lys_yang_parser_ctx *ctx, struct lysp_node *parent, struct lysp_node_notif **notifs)
+parse_notif(struct lysp_yang_ctx *ctx, struct lysp_node *parent, struct lysp_node_notif **notifs)
{
LY_ERR ret = LY_SUCCESS;
char *buf, *word;
@@ -3085,7 +3085,7 @@
* @return LY_ERR values.
*/
LY_ERR
-parse_grouping(struct lys_yang_parser_ctx *ctx, struct lysp_node *parent, struct lysp_node_grp **groupings)
+parse_grouping(struct lysp_yang_ctx *ctx, struct lysp_node *parent, struct lysp_node_grp **groupings)
{
LY_ERR ret = LY_SUCCESS;
char *buf, *word;
@@ -3181,7 +3181,7 @@
* @return LY_ERR values.
*/
LY_ERR
-parse_augment(struct lys_yang_parser_ctx *ctx, struct lysp_node *parent, struct lysp_node_augment **augments)
+parse_augment(struct lysp_yang_ctx *ctx, struct lysp_node *parent, struct lysp_node_augment **augments)
{
LY_ERR ret = LY_SUCCESS;
char *buf, *word;
@@ -3275,7 +3275,7 @@
* @return LY_ERR values.
*/
LY_ERR
-parse_uses(struct lys_yang_parser_ctx *ctx, struct lysp_node *parent, struct lysp_node **siblings)
+parse_uses(struct lysp_yang_ctx *ctx, struct lysp_node *parent, struct lysp_node **siblings)
{
LY_ERR ret = LY_SUCCESS;
char *buf, *word;
@@ -3340,7 +3340,7 @@
* @return LY_ERR values.
*/
LY_ERR
-parse_case(struct lys_yang_parser_ctx *ctx, struct lysp_node *parent, struct lysp_node **siblings)
+parse_case(struct lysp_yang_ctx *ctx, struct lysp_node *parent, struct lysp_node **siblings)
{
LY_ERR ret = LY_SUCCESS;
char *buf, *word;
@@ -3423,7 +3423,7 @@
* @return LY_ERR values.
*/
LY_ERR
-parse_choice(struct lys_yang_parser_ctx *ctx, struct lysp_node *parent, struct lysp_node **siblings)
+parse_choice(struct lysp_yang_ctx *ctx, struct lysp_node *parent, struct lysp_node **siblings)
{
LY_ERR ret = LY_SUCCESS;
char *buf, *word;
@@ -3518,7 +3518,7 @@
* @return LY_ERR values.
*/
LY_ERR
-parse_container(struct lys_yang_parser_ctx *ctx, struct lysp_node *parent, struct lysp_node **siblings)
+parse_container(struct lysp_yang_ctx *ctx, struct lysp_node *parent, struct lysp_node **siblings)
{
LY_ERR ret = 0;
char *buf, *word;
@@ -3625,7 +3625,7 @@
* @return LY_ERR values.
*/
LY_ERR
-parse_list(struct lys_yang_parser_ctx *ctx, struct lysp_node *parent, struct lysp_node **siblings)
+parse_list(struct lysp_yang_ctx *ctx, struct lysp_node *parent, struct lysp_node **siblings)
{
LY_ERR ret = LY_SUCCESS;
char *buf, *word;
@@ -3745,7 +3745,7 @@
* @return LY_ERR values.
*/
static LY_ERR
-parse_yinelement(struct lys_yang_parser_ctx *ctx, uint16_t *flags, struct lysp_ext_instance **exts)
+parse_yinelement(struct lysp_yang_ctx *ctx, uint16_t *flags, struct lysp_ext_instance **exts)
{
LY_ERR ret = LY_SUCCESS;
char *buf, *word;
@@ -3799,7 +3799,7 @@
* @return LY_ERR values.
*/
static LY_ERR
-parse_argument(struct lys_yang_parser_ctx *ctx, const char **argument, uint16_t *flags, struct lysp_ext_instance **exts)
+parse_argument(struct lysp_yang_ctx *ctx, const char **argument, uint16_t *flags, struct lysp_ext_instance **exts)
{
LY_ERR ret = LY_SUCCESS;
char *buf, *word;
@@ -3843,7 +3843,7 @@
* @return LY_ERR values.
*/
static LY_ERR
-parse_extension(struct lys_yang_parser_ctx *ctx, struct lysp_ext **extensions)
+parse_extension(struct lysp_yang_ctx *ctx, struct lysp_ext **extensions)
{
LY_ERR ret = LY_SUCCESS;
char *buf, *word;
@@ -3894,7 +3894,7 @@
* @return LY_ERR values.
*/
LY_ERR
-parse_deviate(struct lys_yang_parser_ctx *ctx, struct lysp_deviate **deviates)
+parse_deviate(struct lysp_yang_ctx *ctx, struct lysp_deviate **deviates)
{
LY_ERR ret = LY_SUCCESS;
char *buf = NULL, *word;
@@ -4124,7 +4124,7 @@
* @return LY_ERR values.
*/
LY_ERR
-parse_deviation(struct lys_yang_parser_ctx *ctx, struct lysp_deviation **deviations)
+parse_deviation(struct lysp_yang_ctx *ctx, struct lysp_deviation **deviations)
{
LY_ERR ret = LY_SUCCESS;
char *buf, *word;
@@ -4186,7 +4186,7 @@
* @return LY_ERR values.
*/
LY_ERR
-parse_feature(struct lys_yang_parser_ctx *ctx, struct lysp_feature **features)
+parse_feature(struct lysp_yang_ctx *ctx, struct lysp_feature **features)
{
LY_ERR ret = LY_SUCCESS;
char *buf, *word;
@@ -4237,7 +4237,7 @@
* @return LY_ERR values.
*/
LY_ERR
-parse_identity(struct lys_yang_parser_ctx *ctx, struct lysp_ident **identities)
+parse_identity(struct lysp_yang_ctx *ctx, struct lysp_ident **identities)
{
LY_ERR ret = LY_SUCCESS;
char *buf, *word;
@@ -4296,7 +4296,7 @@
* @return LY_ERR values.
*/
LY_ERR
-parse_module(struct lys_yang_parser_ctx *ctx, struct lysp_module *mod)
+parse_module(struct lysp_yang_ctx *ctx, struct lysp_module *mod)
{
LY_ERR ret = 0;
char *buf, *word;
@@ -4505,7 +4505,7 @@
* @return LY_ERR values.
*/
LY_ERR
-parse_submodule(struct lys_yang_parser_ctx *ctx, struct lysp_submodule *submod)
+parse_submodule(struct lysp_yang_ctx *ctx, struct lysp_submodule *submod)
{
LY_ERR ret = 0;
char *buf, *word;
@@ -4711,7 +4711,7 @@
* @return LY_EVALID on invalid comment.
*/
static LY_ERR
-skip_redundant_chars(struct lys_yang_parser_ctx *ctx)
+skip_redundant_chars(struct lysp_yang_ctx *ctx)
{
/* read some trailing spaces, new lines, or comments */
while (ctx->in->current[0]) {
@@ -4738,7 +4738,7 @@
}
LY_ERR
-yang_parse_submodule(struct lys_yang_parser_ctx **context, struct ly_ctx *ly_ctx, struct lys_parser_ctx *main_ctx,
+yang_parse_submodule(struct lysp_yang_ctx **context, struct ly_ctx *ly_ctx, struct lysp_ctx *main_ctx,
struct ly_in *in, struct lysp_submodule **submod)
{
LY_ERR ret = LY_SUCCESS;
@@ -4806,7 +4806,7 @@
LOG_LOCBACK(0, 0, 0, 1);
if (ret) {
lysp_module_free(&fctx, (struct lysp_module *)mod_p);
- yang_parser_ctx_free(*context);
+ lysp_yang_ctx_free(*context);
*context = NULL;
}
@@ -4814,7 +4814,7 @@
}
LY_ERR
-yang_parse_module(struct lys_yang_parser_ctx **context, struct ly_in *in, struct lys_module *mod)
+yang_parse_module(struct lysp_yang_ctx **context, struct ly_in *in, struct lys_module *mod)
{
LY_ERR ret = LY_SUCCESS;
char *word;
@@ -4829,7 +4829,7 @@
(*context)->format = LYS_IN_YANG;
LY_CHECK_ERR_RET(ly_set_new(&(*context)->parsed_mods), free(*context); LOGMEM(mod->ctx), LY_EMEM);
(*context)->in = in;
- (*context)->main_ctx = (struct lys_parser_ctx *)(*context);
+ (*context)->main_ctx = (struct lysp_ctx *)(*context);
mod_p = calloc(1, sizeof *mod_p);
LY_CHECK_ERR_GOTO(!mod_p, LOGMEM(mod->ctx), cleanup);
@@ -4875,7 +4875,7 @@
LOG_LOCBACK(0, 0, 0, 1);
if (ret) {
lysp_module_free(&fctx, mod_p);
- yang_parser_ctx_free(*context);
+ lysp_yang_ctx_free(*context);
*context = NULL;
}
diff --git a/src/parser_yin.c b/src/parser_yin.c
index 964fdd9..50f2b66 100644
--- a/src/parser_yin.c
+++ b/src/parser_yin.c
@@ -157,7 +157,7 @@
struct lysp_ext_instance **exts; /**< extension instances to add to. */
};
-LY_ERR yin_parse_content(struct lys_yin_parser_ctx *ctx, struct yin_subelement *subelem_info, size_t subelem_info_size,
+LY_ERR yin_parse_content(struct lysp_yin_ctx *ctx, struct yin_subelement *subelem_info, size_t subelem_info_size,
enum ly_stmt current_element, const char **text_content, struct lysp_ext_instance **exts);
/**
@@ -173,7 +173,7 @@
* @return yang_keyword values.
*/
enum ly_stmt
-yin_match_keyword(struct lys_yin_parser_ctx *ctx, const char *name, size_t name_len,
+yin_match_keyword(struct lysp_yin_ctx *ctx, const char *name, size_t name_len,
const char *prefix, size_t prefix_len, enum ly_stmt parent)
{
const char *start = NULL;
@@ -341,7 +341,7 @@
* @return LY_SUCCESS on success LY_EMEM on memmory allocation failure.
*/
static LY_ERR
-subelems_allocator(struct lys_yin_parser_ctx *ctx, size_t count, struct lysp_node *parent,
+subelems_allocator(struct lysp_yin_ctx *ctx, size_t count, struct lysp_node *parent,
struct yin_subelement **result, ...)
{
va_list ap;
@@ -412,7 +412,7 @@
* @return LY_ERR values.
*/
LY_ERR
-yin_validate_value(struct lys_yin_parser_ctx *ctx, enum yang_arg val_type)
+yin_validate_value(struct lysp_yin_ctx *ctx, enum yang_arg val_type)
{
uint8_t prefix = 0;
uint32_t c;
@@ -424,18 +424,18 @@
val = ctx->xmlctx->value;
while (already_read < ctx->xmlctx->value_len) {
LY_CHECK_ERR_RET(ly_getutf8((const char **)&val, &c, &utf8_char_len),
- LOGVAL_PARSER((struct lys_parser_ctx *)ctx, LY_VCODE_INCHAR, (val)[-utf8_char_len]), LY_EVALID);
+ LOGVAL_PARSER((struct lysp_ctx *)ctx, LY_VCODE_INCHAR, (val)[-utf8_char_len]), LY_EVALID);
switch (val_type) {
case Y_IDENTIF_ARG:
- LY_CHECK_RET(lysp_check_identifierchar((struct lys_parser_ctx *)ctx, c, already_read ? 0 : 1, NULL));
+ LY_CHECK_RET(lysp_check_identifierchar((struct lysp_ctx *)ctx, c, already_read ? 0 : 1, NULL));
break;
case Y_PREF_IDENTIF_ARG:
- LY_CHECK_RET(lysp_check_identifierchar((struct lys_parser_ctx *)ctx, c, already_read ? 0 : 1, &prefix));
+ LY_CHECK_RET(lysp_check_identifierchar((struct lysp_ctx *)ctx, c, already_read ? 0 : 1, &prefix));
break;
case Y_STR_ARG:
case Y_MAYBE_STR_ARG:
- LY_CHECK_RET(lysp_check_stringchar((struct lys_parser_ctx *)ctx, c));
+ LY_CHECK_RET(lysp_check_stringchar((struct lysp_ctx *)ctx, c));
break;
}
@@ -466,7 +466,7 @@
* @return LY_ERR values.
*/
static LY_ERR
-yin_parse_attribute(struct lys_yin_parser_ctx *ctx, enum yin_argument arg_type, const char **arg_val, enum yang_arg val_type,
+yin_parse_attribute(struct lysp_yin_ctx *ctx, enum yin_argument arg_type, const char **arg_val, enum yang_arg val_type,
enum ly_stmt current_element)
{
enum yin_argument arg = YIN_ARG_UNKNOWN;
@@ -481,7 +481,7 @@
/* skip it */
LY_CHECK_RET(lyxml_ctx_next(ctx->xmlctx));
} else if (arg == arg_type) {
- LY_CHECK_ERR_RET(found, LOGVAL_PARSER((struct lys_parser_ctx *)ctx, LY_VCODE_DUP_ATTR,
+ LY_CHECK_ERR_RET(found, LOGVAL_PARSER((struct lysp_ctx *)ctx, LY_VCODE_DUP_ATTR,
yin_attr2str(arg), ly_stmt2str(current_element)), LY_EVALID);
found = true;
@@ -491,7 +491,7 @@
INSERT_STRING_RET(ctx->xmlctx->ctx, ctx->xmlctx->value, ctx->xmlctx->value_len, ctx->xmlctx->dynamic, *arg_val);
LY_CHECK_RET(!(*arg_val), LY_EMEM);
} else {
- LOGVAL_PARSER((struct lys_parser_ctx *)ctx, LY_VCODE_UNEXP_ATTR, ctx->xmlctx->name_len,
+ LOGVAL_PARSER((struct lysp_ctx *)ctx, LY_VCODE_UNEXP_ATTR, ctx->xmlctx->name_len,
ctx->xmlctx->name, ly_stmt2str(current_element));
return LY_EVALID;
}
@@ -506,7 +506,7 @@
/* anything else than Y_MAYBE_STR_ARG is mandatory */
if ((val_type != Y_MAYBE_STR_ARG) && !found) {
- LOGVAL_PARSER((struct lys_parser_ctx *)ctx, LYVE_SYNTAX_YIN, "Missing mandatory attribute %s of %s element.",
+ LOGVAL_PARSER((struct lysp_ctx *)ctx, LYVE_SYNTAX_YIN, "Missing mandatory attribute %s of %s element.",
yin_attr2str(arg_type), ly_stmt2str(current_element));
return LY_EVALID;
}
@@ -545,13 +545,13 @@
* @return LY_ERR values.
*/
static LY_ERR
-yin_check_subelem_mandatory_constraint(struct lys_yin_parser_ctx *ctx, struct yin_subelement *subelem_info,
+yin_check_subelem_mandatory_constraint(struct lysp_yin_ctx *ctx, struct yin_subelement *subelem_info,
signed char subelem_info_size, enum ly_stmt current_element)
{
for (signed char i = 0; i < subelem_info_size; ++i) {
/* if there is element that is mandatory and isn't parsed log error and return LY_EVALID */
if ((subelem_info[i].flags & YIN_SUBELEM_MANDATORY) && !(subelem_info[i].flags & YIN_SUBELEM_PARSED)) {
- LOGVAL_PARSER((struct lys_parser_ctx *)ctx, LY_VCODE_MAND_SUBELEM,
+ LOGVAL_PARSER((struct lysp_ctx *)ctx, LY_VCODE_MAND_SUBELEM,
ly_stmt2str(subelem_info[i].type), ly_stmt2str(current_element));
return LY_EVALID;
}
@@ -572,13 +572,13 @@
* @return LY_ERR values.
*/
static LY_ERR
-yin_check_subelem_first_constraint(struct lys_yin_parser_ctx *ctx, struct yin_subelement *subelem_info,
+yin_check_subelem_first_constraint(struct lysp_yin_ctx *ctx, struct yin_subelement *subelem_info,
signed char subelem_info_size, enum ly_stmt current_element,
struct yin_subelement *exp_first)
{
for (signed char i = 0; i < subelem_info_size; ++i) {
if (subelem_info[i].flags & YIN_SUBELEM_PARSED) {
- LOGVAL_PARSER((struct lys_parser_ctx *)ctx, LY_VCODE_FIRT_SUBELEM,
+ LOGVAL_PARSER((struct lysp_ctx *)ctx, LY_VCODE_FIRT_SUBELEM,
ly_stmt2str(exp_first->type), ly_stmt2str(current_element));
return LY_EVALID;
}
@@ -600,7 +600,7 @@
* @return LY_ERR values.
*/
static LY_ERR
-yin_parse_simple_element(struct lys_yin_parser_ctx *ctx, enum ly_stmt kw, const char **value,
+yin_parse_simple_element(struct lysp_yin_ctx *ctx, enum ly_stmt kw, const char **value,
enum yin_argument arg_type, enum yang_arg arg_val_type, struct lysp_ext_instance **exts)
{
LY_CHECK_RET(lyxml_ctx_next(ctx->xmlctx));
@@ -621,7 +621,7 @@
* @return LY_ERR values.
*/
static LY_ERR
-yin_parse_path(struct lys_yin_parser_ctx *ctx, enum ly_stmt kw, struct lysp_type *type)
+yin_parse_path(struct lysp_yin_ctx *ctx, enum ly_stmt kw, struct lysp_type *type)
{
LY_ERR ret;
const char *str_path;
@@ -644,7 +644,7 @@
* @return LY_ERR values.
*/
static LY_ERR
-yin_parse_pattern(struct lys_yin_parser_ctx *ctx, struct lysp_type *type)
+yin_parse_pattern(struct lysp_yin_ctx *ctx, struct lysp_type *type)
{
const char *real_value = NULL;
char *saved_value = NULL;
@@ -690,7 +690,7 @@
* @return LY_ERR values.
*/
static LY_ERR
-yin_parse_fracdigits(struct lys_yin_parser_ctx *ctx, struct lysp_type *type)
+yin_parse_fracdigits(struct lysp_yin_ctx *ctx, struct lysp_type *type)
{
const char *temp_val = NULL;
char *ptr;
@@ -700,7 +700,7 @@
LY_CHECK_RET(yin_parse_attribute(ctx, YIN_ARG_VALUE, &temp_val, Y_STR_ARG, LY_STMT_FRACTION_DIGITS));
if ((temp_val[0] == '\0') || (temp_val[0] == '0') || !isdigit(temp_val[0])) {
- LOGVAL_PARSER((struct lys_parser_ctx *)ctx, LY_VCODE_INVAL_YIN, temp_val, "value", "fraction-digits");
+ LOGVAL_PARSER((struct lysp_ctx *)ctx, LY_VCODE_INVAL_YIN, temp_val, "value", "fraction-digits");
lydict_remove(ctx->xmlctx->ctx, temp_val);
return LY_EVALID;
}
@@ -708,12 +708,12 @@
errno = 0;
num = strtoull(temp_val, &ptr, LY_BASE_DEC);
if (*ptr != '\0') {
- LOGVAL_PARSER((struct lys_parser_ctx *)ctx, LY_VCODE_INVAL_YIN, temp_val, "value", "fraction-digits");
+ LOGVAL_PARSER((struct lysp_ctx *)ctx, LY_VCODE_INVAL_YIN, temp_val, "value", "fraction-digits");
lydict_remove(ctx->xmlctx->ctx, temp_val);
return LY_EVALID;
}
if ((errno == ERANGE) || (num > LY_TYPE_DEC64_FD_MAX)) {
- LOGVAL_PARSER((struct lys_parser_ctx *)ctx, LY_VCODE_INVAL_YIN, temp_val, "value", "fraction-digits");
+ LOGVAL_PARSER((struct lysp_ctx *)ctx, LY_VCODE_INVAL_YIN, temp_val, "value", "fraction-digits");
lydict_remove(ctx->xmlctx->ctx, temp_val);
return LY_EVALID;
}
@@ -740,7 +740,7 @@
* @return LY_ERR values.
*/
static LY_ERR
-yin_parse_enum(struct lys_yin_parser_ctx *ctx, struct lysp_type *type)
+yin_parse_enum(struct lysp_yin_ctx *ctx, struct lysp_type *type)
{
struct lysp_type_enum *en;
@@ -748,9 +748,9 @@
type->flags |= LYS_SET_ENUM;
LY_CHECK_RET(lyxml_ctx_next(ctx->xmlctx));
LY_CHECK_RET(yin_parse_attribute(ctx, YIN_ARG_NAME, &en->name, Y_STR_ARG, LY_STMT_ENUM));
- LY_CHECK_RET(lysp_check_enum_name((struct lys_parser_ctx *)ctx, en->name, strlen(en->name)));
- CHECK_NONEMPTY((struct lys_parser_ctx *)ctx, strlen(en->name), "enum");
- CHECK_UNIQUENESS((struct lys_parser_ctx *)ctx, type->enums, name, "enum", en->name);
+ LY_CHECK_RET(lysp_check_enum_name((struct lysp_ctx *)ctx, en->name, strlen(en->name)));
+ CHECK_NONEMPTY((struct lysp_ctx *)ctx, strlen(en->name), "enum");
+ CHECK_UNIQUENESS((struct lysp_ctx *)ctx, type->enums, name, "enum", en->name);
struct yin_subelement subelems[] = {
{LY_STMT_DESCRIPTION, &en->dsc, YIN_SUBELEM_UNIQUE},
@@ -777,7 +777,7 @@
* @return LY_ERR values.
*/
static LY_ERR
-yin_parse_bit(struct lys_yin_parser_ctx *ctx, struct lysp_type *type)
+yin_parse_bit(struct lysp_yin_ctx *ctx, struct lysp_type *type)
{
struct lysp_type_enum *en;
@@ -785,7 +785,7 @@
type->flags |= LYS_SET_BIT;
LY_CHECK_RET(lyxml_ctx_next(ctx->xmlctx));
LY_CHECK_RET(yin_parse_attribute(ctx, YIN_ARG_NAME, &en->name, Y_IDENTIF_ARG, LY_STMT_BIT));
- CHECK_UNIQUENESS((struct lys_parser_ctx *)ctx, type->bits, name, "bit", en->name);
+ CHECK_UNIQUENESS((struct lysp_ctx *)ctx, type->bits, name, "bit", en->name);
struct yin_subelement subelems[] = {
{LY_STMT_DESCRIPTION, &en->dsc, YIN_SUBELEM_UNIQUE},
@@ -817,7 +817,7 @@
* @return LY_ERR values.
*/
static LY_ERR
-yin_parse_simple_elements(struct lys_yin_parser_ctx *ctx, enum ly_stmt kw, const char ***values, enum yin_argument arg_type,
+yin_parse_simple_elements(struct lysp_yin_ctx *ctx, enum ly_stmt kw, const char ***values, enum yin_argument arg_type,
enum yang_arg arg_val_type, struct lysp_ext_instance **exts)
{
const char **value;
@@ -848,7 +848,7 @@
* @return LY_ERR values.
*/
static LY_ERR
-yin_parse_simple_elem(struct lys_yin_parser_ctx *ctx, enum ly_stmt kw, struct yin_subelement *subinfo,
+yin_parse_simple_elem(struct lysp_yin_ctx *ctx, enum ly_stmt kw, struct yin_subelement *subinfo,
enum yin_argument arg_type, enum yang_arg arg_val_type, struct lysp_ext_instance **exts)
{
if (subinfo->flags & YIN_SUBELEM_UNIQUE) {
@@ -872,7 +872,7 @@
* @return LY_ERR values.
*/
static LY_ERR
-yin_parse_base(struct lys_yin_parser_ctx *ctx, enum ly_stmt parent, void *dest, struct lysp_ext_instance **exts)
+yin_parse_base(struct lysp_yin_ctx *ctx, enum ly_stmt parent, void *dest, struct lysp_ext_instance **exts)
{
struct lysp_type *type = NULL;
@@ -900,7 +900,7 @@
* @return LY_ERR values.
*/
static LY_ERR
-yin_pasrse_reqinstance(struct lys_yin_parser_ctx *ctx, struct lysp_type *type)
+yin_pasrse_reqinstance(struct lysp_yin_ctx *ctx, struct lysp_type *type)
{
const char *temp_val = NULL;
struct yin_subelement subelems[] = {
@@ -913,7 +913,7 @@
if (strcmp(temp_val, "true") == 0) {
type->require_instance = 1;
} else if (strcmp(temp_val, "false") != 0) {
- LOGVAL_PARSER((struct lys_parser_ctx *)ctx, LY_VCODE_INVAL_YIN VALID_VALS2, temp_val, "value",
+ LOGVAL_PARSER((struct lysp_ctx *)ctx, LY_VCODE_INVAL_YIN VALID_VALS2, temp_val, "value",
"require-instance", "true", "false");
lydict_remove(ctx->xmlctx->ctx, temp_val);
return LY_EVALID;
@@ -938,7 +938,7 @@
* @return LY_ERR values.
*/
static LY_ERR
-yin_parse_modifier(struct lys_yin_parser_ctx *ctx, const char **pat, struct lysp_ext_instance **exts)
+yin_parse_modifier(struct lysp_yin_ctx *ctx, const char **pat, struct lysp_ext_instance **exts)
{
assert(**pat == 0x06);
const char *temp_val;
@@ -950,7 +950,7 @@
LY_CHECK_RET(lyxml_ctx_next(ctx->xmlctx));
LY_CHECK_RET(yin_parse_attribute(ctx, YIN_ARG_VALUE, &temp_val, Y_STR_ARG, LY_STMT_MODIFIER));
if (strcmp(temp_val, "invert-match") != 0) {
- LOGVAL_PARSER((struct lys_parser_ctx *)ctx, LY_VCODE_INVAL_YIN VALID_VALS1, temp_val, "value",
+ LOGVAL_PARSER((struct lysp_ctx *)ctx, LY_VCODE_INVAL_YIN VALID_VALS1, temp_val, "value",
"modifier", "invert-match");
lydict_remove(ctx->xmlctx->ctx, temp_val);
return LY_EVALID;
@@ -980,7 +980,7 @@
* @param[in] restr Value to write to.
*/
static LY_ERR
-yin_parse_restriction(struct lys_yin_parser_ctx *ctx, enum ly_stmt restr_kw, struct lysp_restr *restr)
+yin_parse_restriction(struct lysp_yin_ctx *ctx, enum ly_stmt restr_kw, struct lysp_restr *restr)
{
assert(restr_kw == LY_STMT_MUST || restr_kw == LY_STMT_LENGTH || restr_kw == LY_STMT_RANGE);
struct yin_subelement subelems[] = {
@@ -1014,7 +1014,7 @@
* @return LY_ERR values.
*/
static LY_ERR
-yin_parse_range(struct lys_yin_parser_ctx *ctx, struct lysp_type *type)
+yin_parse_range(struct lysp_yin_ctx *ctx, struct lysp_type *type)
{
type->range = calloc(1, sizeof *type->range);
LY_CHECK_ERR_RET(!type->range, LOGMEM(ctx->xmlctx->ctx), LY_EMEM);
@@ -1033,7 +1033,7 @@
* @return LY_ERR values.
*/
static LY_ERR
-yin_parse_length(struct lys_yin_parser_ctx *ctx, struct lysp_type *type)
+yin_parse_length(struct lysp_yin_ctx *ctx, struct lysp_type *type)
{
type->length = calloc(1, sizeof *type->length);
LY_CHECK_ERR_RET(!type->length, LOGMEM(ctx->xmlctx->ctx), LY_EMEM);
@@ -1052,7 +1052,7 @@
* @return LY_ERR values.
*/
static LY_ERR
-yin_parse_must(struct lys_yin_parser_ctx *ctx, struct lysp_restr **restrs)
+yin_parse_must(struct lysp_yin_ctx *ctx, struct lysp_restr **restrs)
{
struct lysp_restr *restr;
@@ -1071,7 +1071,7 @@
* @return LY_ERR values.
*/
static LY_ERR
-yin_parse_qname(struct lys_yin_parser_ctx *ctx, enum ly_stmt kw, struct yin_subelement *subinfo,
+yin_parse_qname(struct lysp_yin_ctx *ctx, enum ly_stmt kw, struct yin_subelement *subinfo,
struct lysp_ext_instance **exts)
{
struct lysp_qname *qname, **qnames;
@@ -1116,7 +1116,7 @@
* @return LY_ERR values.
*/
static LY_ERR
-yin_parse_value_pos(struct lys_yin_parser_ctx *ctx, enum ly_stmt kw, struct lysp_type_enum *enm)
+yin_parse_value_pos(struct lysp_yin_ctx *ctx, enum ly_stmt kw, struct lysp_type_enum *enm)
{
LY_ERR ret = LY_SUCCESS;
const char *temp_val = NULL;
@@ -1134,7 +1134,7 @@
LY_CHECK_GOTO(ret = yin_parse_attribute(ctx, YIN_ARG_VALUE, &temp_val, Y_STR_ARG, kw), cleanup);
if (!temp_val || (temp_val[0] == '\0') || (temp_val[0] == '+') ||
((temp_val[0] == '0') && (temp_val[1] != '\0')) || ((kw == LY_STMT_POSITION) && !strcmp(temp_val, "-0"))) {
- LOGVAL_PARSER((struct lys_parser_ctx *)ctx, LY_VCODE_INVAL_YIN, temp_val, "value", ly_stmt2str(kw));
+ LOGVAL_PARSER((struct lysp_ctx *)ctx, LY_VCODE_INVAL_YIN, temp_val, "value", ly_stmt2str(kw));
ret = LY_EVALID;
goto cleanup;
}
@@ -1144,26 +1144,26 @@
if (kw == LY_STMT_VALUE) {
num = strtoll(temp_val, &ptr, LY_BASE_DEC);
if ((num < INT64_C(-2147483648)) || (num > INT64_C(2147483647))) {
- LOGVAL_PARSER((struct lys_parser_ctx *)ctx, LY_VCODE_INVAL_YIN, temp_val, "value", ly_stmt2str(kw));
+ LOGVAL_PARSER((struct lysp_ctx *)ctx, LY_VCODE_INVAL_YIN, temp_val, "value", ly_stmt2str(kw));
ret = LY_EVALID;
goto cleanup;
}
} else {
unum = strtoull(temp_val, &ptr, LY_BASE_DEC);
if (unum > UINT64_C(4294967295)) {
- LOGVAL_PARSER((struct lys_parser_ctx *)ctx, LY_VCODE_INVAL_YIN, temp_val, "value", ly_stmt2str(kw));
+ LOGVAL_PARSER((struct lysp_ctx *)ctx, LY_VCODE_INVAL_YIN, temp_val, "value", ly_stmt2str(kw));
ret = LY_EVALID;
goto cleanup;
}
}
/* check if whole argument value was converted */
if (*ptr != '\0') {
- LOGVAL_PARSER((struct lys_parser_ctx *)ctx, LY_VCODE_INVAL_YIN, temp_val, "value", ly_stmt2str(kw));
+ LOGVAL_PARSER((struct lysp_ctx *)ctx, LY_VCODE_INVAL_YIN, temp_val, "value", ly_stmt2str(kw));
ret = LY_EVALID;
goto cleanup;
}
if (errno == ERANGE) {
- LOGVAL_PARSER((struct lys_parser_ctx *)ctx, LY_VCODE_OOB_YIN, temp_val, "value", ly_stmt2str(kw));
+ LOGVAL_PARSER((struct lysp_ctx *)ctx, LY_VCODE_OOB_YIN, temp_val, "value", ly_stmt2str(kw));
ret = LY_EVALID;
goto cleanup;
}
@@ -1199,7 +1199,7 @@
* @return LY_ERR values
*/
static LY_ERR
-yin_parse_belongs_to(struct lys_yin_parser_ctx *ctx, struct lysp_submodule *submod, struct lysp_ext_instance **exts)
+yin_parse_belongs_to(struct lysp_yin_ctx *ctx, struct lysp_submodule *submod, struct lysp_ext_instance **exts)
{
const char *belongsto;
struct yin_subelement subelems[] = {
@@ -1234,7 +1234,7 @@
* @return LY_ERR values.
*/
static LY_ERR
-yin_parse_meta(struct lys_yin_parser_ctx *ctx, enum ly_stmt elem_type, const char **value, struct lysp_ext_instance **exts)
+yin_parse_meta(struct lysp_yin_ctx *ctx, enum ly_stmt elem_type, const char **value, struct lysp_ext_instance **exts)
{
assert(elem_type == LY_STMT_ORGANIZATION || elem_type == LY_STMT_CONTACT || elem_type == LY_STMT_DESCRIPTION || elem_type == LY_STMT_REFERENCE);
@@ -1263,7 +1263,7 @@
* @return LY_ERR values.
*/
static LY_ERR
-yin_parse_err_msg(struct lys_yin_parser_ctx *ctx, const char **value, struct lysp_ext_instance **exts)
+yin_parse_err_msg(struct lysp_yin_ctx *ctx, const char **value, struct lysp_ext_instance **exts)
{
struct yin_subelement subelems[] = {
{LY_STMT_EXTENSION_INSTANCE, NULL, 0},
@@ -1289,7 +1289,7 @@
* @return LY_ERR values.
*/
static LY_ERR
-yin_parse_type(struct lys_yin_parser_ctx *ctx, enum ly_stmt parent, struct yin_subelement *subinfo)
+yin_parse_type(struct lysp_yin_ctx *ctx, enum ly_stmt parent, struct yin_subelement *subinfo)
{
struct lysp_type *type = NULL;
@@ -1347,7 +1347,7 @@
* @return LY_ERR values.
*/
static LY_ERR
-yin_parse_maxelements(struct lys_yin_parser_ctx *ctx, uint32_t *max, uint16_t *flags, struct lysp_ext_instance **exts)
+yin_parse_maxelements(struct lysp_yin_ctx *ctx, uint32_t *max, uint16_t *flags, struct lysp_ext_instance **exts)
{
LY_ERR ret = LY_SUCCESS;
const char *temp_val = NULL;
@@ -1361,7 +1361,7 @@
LY_CHECK_GOTO(ret = lyxml_ctx_next(ctx->xmlctx), cleanup);
LY_CHECK_GOTO(ret = yin_parse_attribute(ctx, YIN_ARG_VALUE, &temp_val, Y_STR_ARG, LY_STMT_MAX_ELEMENTS), cleanup);
if (!temp_val || (temp_val[0] == '\0') || (temp_val[0] == '0') || ((temp_val[0] != 'u') && !isdigit(temp_val[0]))) {
- LOGVAL_PARSER((struct lys_parser_ctx *)ctx, LY_VCODE_INVAL_YIN, temp_val, "value", "max-elements");
+ LOGVAL_PARSER((struct lysp_ctx *)ctx, LY_VCODE_INVAL_YIN, temp_val, "value", "max-elements");
ret = LY_EVALID;
goto cleanup;
}
@@ -1370,12 +1370,12 @@
errno = 0;
num = strtoull(temp_val, &ptr, LY_BASE_DEC);
if (*ptr != '\0') {
- LOGVAL_PARSER((struct lys_parser_ctx *)ctx, LY_VCODE_INVAL_YIN, temp_val, "value", "max-elements");
+ LOGVAL_PARSER((struct lysp_ctx *)ctx, LY_VCODE_INVAL_YIN, temp_val, "value", "max-elements");
ret = LY_EVALID;
goto cleanup;
}
if ((errno == ERANGE) || (num > UINT32_MAX)) {
- LOGVAL_PARSER((struct lys_parser_ctx *)ctx, LY_VCODE_OOB_YIN, temp_val, "value", "max-elements");
+ LOGVAL_PARSER((struct lysp_ctx *)ctx, LY_VCODE_OOB_YIN, temp_val, "value", "max-elements");
ret = LY_EVALID;
goto cleanup;
}
@@ -1400,7 +1400,7 @@
* @return LY_ERR values.
*/
static LY_ERR
-yin_parse_minelements(struct lys_yin_parser_ctx *ctx, uint32_t *min, uint16_t *flags, struct lysp_ext_instance **exts)
+yin_parse_minelements(struct lysp_yin_ctx *ctx, uint32_t *min, uint16_t *flags, struct lysp_ext_instance **exts)
{
const char *temp_val = NULL;
char *ptr;
@@ -1414,7 +1414,7 @@
LY_CHECK_RET(yin_parse_attribute(ctx, YIN_ARG_VALUE, &temp_val, Y_STR_ARG, LY_STMT_MIN_ELEMENTS));
if (!temp_val || (temp_val[0] == '\0') || ((temp_val[0] == '0') && (temp_val[1] != '\0'))) {
- LOGVAL_PARSER((struct lys_parser_ctx *)ctx, LY_VCODE_INVAL_YIN, temp_val, "value", "min-elements");
+ LOGVAL_PARSER((struct lysp_ctx *)ctx, LY_VCODE_INVAL_YIN, temp_val, "value", "min-elements");
lydict_remove(ctx->xmlctx->ctx, temp_val);
return LY_EVALID;
}
@@ -1422,12 +1422,12 @@
errno = 0;
num = strtoull(temp_val, &ptr, LY_BASE_DEC);
if (ptr[0] != 0) {
- LOGVAL_PARSER((struct lys_parser_ctx *)ctx, LY_VCODE_INVAL_YIN, temp_val, "value", "min-elements");
+ LOGVAL_PARSER((struct lysp_ctx *)ctx, LY_VCODE_INVAL_YIN, temp_val, "value", "min-elements");
lydict_remove(ctx->xmlctx->ctx, temp_val);
return LY_EVALID;
}
if ((errno == ERANGE) || (num > UINT32_MAX)) {
- LOGVAL_PARSER((struct lys_parser_ctx *)ctx, LY_VCODE_OOB_YIN, temp_val, "value", "min-elements");
+ LOGVAL_PARSER((struct lysp_ctx *)ctx, LY_VCODE_OOB_YIN, temp_val, "value", "min-elements");
lydict_remove(ctx->xmlctx->ctx, temp_val);
return LY_EVALID;
}
@@ -1449,7 +1449,7 @@
* @return LY_ERR values.
*/
static LY_ERR
-yin_parse_minmax(struct lys_yin_parser_ctx *ctx, enum ly_stmt parent, enum ly_stmt current, void *dest)
+yin_parse_minmax(struct lysp_yin_ctx *ctx, enum ly_stmt parent, enum ly_stmt current, void *dest)
{
assert(current == LY_STMT_MAX_ELEMENTS || current == LY_STMT_MIN_ELEMENTS);
assert(parent == LY_STMT_LEAF_LIST || parent == LY_STMT_REFINE || parent == LY_STMT_LIST || parent == LY_STMT_DEVIATE);
@@ -1494,7 +1494,7 @@
* @return LY_ERR values.
*/
static LY_ERR
-yin_parse_orderedby(struct lys_yin_parser_ctx *ctx, uint16_t *flags, struct lysp_ext_instance **exts)
+yin_parse_orderedby(struct lysp_yin_ctx *ctx, uint16_t *flags, struct lysp_ext_instance **exts)
{
const char *temp_val;
struct yin_subelement subelems[] = {
@@ -1508,7 +1508,7 @@
} else if (strcmp(temp_val, "user") == 0) {
*flags |= LYS_ORDBY_USER;
} else {
- LOGVAL_PARSER((struct lys_parser_ctx *)ctx, LY_VCODE_INVAL_YIN VALID_VALS2, temp_val, "value",
+ LOGVAL_PARSER((struct lysp_ctx *)ctx, LY_VCODE_INVAL_YIN VALID_VALS2, temp_val, "value",
"ordered-by", "system", "user");
lydict_remove(ctx->xmlctx->ctx, temp_val);
return LY_EVALID;
@@ -1530,7 +1530,7 @@
* @return LY_ERR values.
*/
static LY_ERR
-yin_parse_any(struct lys_yin_parser_ctx *ctx, enum ly_stmt any_kw, struct tree_node_meta *node_meta)
+yin_parse_any(struct lysp_yin_ctx *ctx, enum ly_stmt any_kw, struct tree_node_meta *node_meta)
{
struct lysp_node_anydata *any;
@@ -1572,7 +1572,7 @@
* @return LY_ERR values.
*/
static LY_ERR
-yin_parse_leaf(struct lys_yin_parser_ctx *ctx, struct tree_node_meta *node_meta)
+yin_parse_leaf(struct lysp_yin_ctx *ctx, struct tree_node_meta *node_meta)
{
struct lysp_node_leaf *leaf;
@@ -1618,7 +1618,7 @@
* @return LY_ERR values.
*/
static LY_ERR
-yin_parse_leaflist(struct lys_yin_parser_ctx *ctx, struct tree_node_meta *node_meta)
+yin_parse_leaflist(struct lysp_yin_ctx *ctx, struct tree_node_meta *node_meta)
{
struct lysp_node_leaflist *llist;
@@ -1656,11 +1656,11 @@
/* check invalid combination of subelements */
if ((llist->min) && (llist->dflts)) {
- LOGVAL_PARSER((struct lys_parser_ctx *)ctx, LY_VCODE_INCHILDSTMSCOMB_YIN, "min-elements", "default", "leaf-list");
+ LOGVAL_PARSER((struct lysp_ctx *)ctx, LY_VCODE_INCHILDSTMSCOMB_YIN, "min-elements", "default", "leaf-list");
return LY_EVALID;
}
if (llist->max && (llist->min > llist->max)) {
- LOGVAL_PARSER((struct lys_parser_ctx *)ctx, LY_VCODE_INVAL_MINMAX, llist->min, llist->max);
+ LOGVAL_PARSER((struct lysp_ctx *)ctx, LY_VCODE_INVAL_MINMAX, llist->min, llist->max);
return LY_EVALID;
}
@@ -1676,7 +1676,7 @@
* @return LY_ERR values.
*/
static LY_ERR
-yin_parse_typedef(struct lys_yin_parser_ctx *ctx, struct tree_node_meta *typedef_meta)
+yin_parse_typedef(struct lysp_yin_ctx *ctx, struct tree_node_meta *typedef_meta)
{
struct lysp_tpdf *tpdf;
struct lysp_tpdf **tpdfs = (struct lysp_tpdf **)typedef_meta->nodes;
@@ -1721,7 +1721,7 @@
* @return LY_ERR values.
*/
static LY_ERR
-yin_parse_refine(struct lys_yin_parser_ctx *ctx, struct lysp_refine **refines)
+yin_parse_refine(struct lysp_yin_ctx *ctx, struct lysp_refine **refines)
{
struct lysp_refine *rf;
@@ -1765,7 +1765,7 @@
* @return LY_ERR values.
*/
static LY_ERR
-yin_parse_uses(struct lys_yin_parser_ctx *ctx, struct tree_node_meta *node_meta)
+yin_parse_uses(struct lysp_yin_ctx *ctx, struct tree_node_meta *node_meta)
{
struct lysp_node_uses *uses;
@@ -1808,7 +1808,7 @@
* @return LY_ERR values.
*/
static LY_ERR
-yin_parse_revision(struct lys_yin_parser_ctx *ctx, struct lysp_revision **revs)
+yin_parse_revision(struct lysp_yin_ctx *ctx, struct lysp_revision **revs)
{
struct lysp_revision *rev;
const char *temp_date = NULL;
@@ -1820,7 +1820,7 @@
LY_CHECK_RET(lyxml_ctx_next(ctx->xmlctx));
LY_CHECK_RET(yin_parse_attribute(ctx, YIN_ARG_DATE, &temp_date, Y_STR_ARG, LY_STMT_REVISION));
/* check value */
- if (lysp_check_date((struct lys_parser_ctx *)ctx, temp_date, strlen(temp_date), "revision")) {
+ if (lysp_check_date((struct lysp_ctx *)ctx, temp_date, strlen(temp_date), "revision")) {
lydict_remove(ctx->xmlctx->ctx, temp_date);
return LY_EVALID;
}
@@ -1851,7 +1851,7 @@
* @return LY_ERR values.
*/
static LY_ERR
-yin_parse_include(struct lys_yin_parser_ctx *ctx, struct include_meta *inc_meta)
+yin_parse_include(struct lysp_yin_ctx *ctx, struct include_meta *inc_meta)
{
struct lysp_include *inc;
@@ -1865,7 +1865,7 @@
/* submodules share the namespace with the module names, so there must not be
* a module of the same name in the context, no need for revision matching */
if (!strcmp(inc_meta->name, inc->name) || ly_ctx_get_module_latest(ctx->xmlctx->ctx, inc->name)) {
- LOGVAL_PARSER((struct lys_parser_ctx *)ctx, LY_VCODE_NAME2_COL, "module", "submodule", inc->name);
+ LOGVAL_PARSER((struct lysp_ctx *)ctx, LY_VCODE_NAME2_COL, "module", "submodule", inc->name);
return LY_EVALID;
}
@@ -1895,7 +1895,7 @@
* @return LY_ERR values.
*/
static LY_ERR
-yin_parse_revision_date(struct lys_yin_parser_ctx *ctx, char *rev, struct lysp_ext_instance **exts)
+yin_parse_revision_date(struct lysp_yin_ctx *ctx, char *rev, struct lysp_ext_instance **exts)
{
const char *temp_rev;
struct yin_subelement subelems[] = {
@@ -1904,7 +1904,7 @@
LY_CHECK_RET(lyxml_ctx_next(ctx->xmlctx));
LY_CHECK_RET(yin_parse_attribute(ctx, YIN_ARG_DATE, &temp_rev, Y_STR_ARG, LY_STMT_REVISION_DATE));
- LY_CHECK_ERR_RET(lysp_check_date((struct lys_parser_ctx *)ctx, temp_rev, strlen(temp_rev), "revision-date") != LY_SUCCESS,
+ LY_CHECK_ERR_RET(lysp_check_date((struct lysp_ctx *)ctx, temp_rev, strlen(temp_rev), "revision-date") != LY_SUCCESS,
lydict_remove(ctx->xmlctx->ctx, temp_rev), LY_EVALID);
strcpy(rev, temp_rev);
@@ -1925,7 +1925,7 @@
* @return LY_ERR values.
*/
static LY_ERR
-yin_parse_config(struct lys_yin_parser_ctx *ctx, uint16_t *flags, struct lysp_ext_instance **exts)
+yin_parse_config(struct lysp_yin_ctx *ctx, uint16_t *flags, struct lysp_ext_instance **exts)
{
const char *temp_val = NULL;
struct yin_subelement subelems[] = {
@@ -1939,7 +1939,7 @@
} else if (strcmp(temp_val, "false") == 0) {
*flags |= LYS_CONFIG_R;
} else {
- LOGVAL_PARSER((struct lys_parser_ctx *)ctx, LY_VCODE_INVAL_YIN VALID_VALS2, temp_val, "value", "config",
+ LOGVAL_PARSER((struct lysp_ctx *)ctx, LY_VCODE_INVAL_YIN VALID_VALS2, temp_val, "value", "config",
"true", "false");
lydict_remove(ctx->xmlctx->ctx, temp_val);
return LY_EVALID;
@@ -1961,7 +1961,7 @@
* @return LY_ERR values.
*/
static LY_ERR
-yin_parse_yangversion(struct lys_yin_parser_ctx *ctx, uint8_t *version, struct lysp_ext_instance **exts)
+yin_parse_yangversion(struct lysp_yin_ctx *ctx, uint8_t *version, struct lysp_ext_instance **exts)
{
const char *temp_version = NULL;
struct yin_subelement subelems[] = {
@@ -1975,7 +1975,7 @@
} else if (strcmp(temp_version, "1.1") == 0) {
*version = LYS_VERSION_1_1;
} else {
- LOGVAL_PARSER((struct lys_parser_ctx *)ctx, LY_VCODE_INVAL_YIN VALID_VALS2, temp_version, "value",
+ LOGVAL_PARSER((struct lysp_ctx *)ctx, LY_VCODE_INVAL_YIN VALID_VALS2, temp_version, "value",
"yang-version", "1", "1.1");
lydict_remove(ctx->xmlctx->ctx, temp_version);
return LY_EVALID;
@@ -1996,7 +1996,7 @@
* @return LY_ERR values.
*/
static LY_ERR
-yin_parse_import(struct lys_yin_parser_ctx *ctx, struct import_meta *imp_meta)
+yin_parse_import(struct lysp_yin_ctx *ctx, struct import_meta *imp_meta)
{
struct lysp_import *imp;
@@ -2020,7 +2020,7 @@
LY_CHECK_RET(ly_set_add(&ctx->ext_inst, imp->exts, 1, NULL));
/* check prefix validity */
- LY_CHECK_RET(lysp_check_prefix((struct lys_parser_ctx *)ctx, *imp_meta->imports, imp_meta->prefix, &imp->prefix), LY_EVALID);
+ LY_CHECK_RET(lysp_check_prefix((struct lysp_ctx *)ctx, *imp_meta->imports, imp_meta->prefix, &imp->prefix), LY_EVALID);
return LY_SUCCESS;
}
@@ -2035,7 +2035,7 @@
* @return LY_ERR values.
*/
static LY_ERR
-yin_parse_mandatory(struct lys_yin_parser_ctx *ctx, uint16_t *flags, struct lysp_ext_instance **exts)
+yin_parse_mandatory(struct lysp_yin_ctx *ctx, uint16_t *flags, struct lysp_ext_instance **exts)
{
const char *temp_val = NULL;
struct yin_subelement subelems[] = {
@@ -2049,7 +2049,7 @@
} else if (strcmp(temp_val, "false") == 0) {
*flags |= LYS_MAND_FALSE;
} else {
- LOGVAL_PARSER((struct lys_parser_ctx *)ctx, LY_VCODE_INVAL_YIN VALID_VALS2, temp_val, "value",
+ LOGVAL_PARSER((struct lysp_ctx *)ctx, LY_VCODE_INVAL_YIN VALID_VALS2, temp_val, "value",
"mandatory", "true", "false");
lydict_remove(ctx->xmlctx->ctx, temp_val);
return LY_EVALID;
@@ -2071,7 +2071,7 @@
* @return LY_ERR values.
*/
static LY_ERR
-yin_parse_status(struct lys_yin_parser_ctx *ctx, uint16_t *flags, struct lysp_ext_instance **exts)
+yin_parse_status(struct lysp_yin_ctx *ctx, uint16_t *flags, struct lysp_ext_instance **exts)
{
const char *value = NULL;
struct yin_subelement subelems[] = {
@@ -2087,7 +2087,7 @@
} else if (strcmp(value, "obsolete") == 0) {
*flags |= LYS_STATUS_OBSLT;
} else {
- LOGVAL_PARSER((struct lys_parser_ctx *)ctx, LY_VCODE_INVAL_YIN VALID_VALS3, value, "value",
+ LOGVAL_PARSER((struct lysp_ctx *)ctx, LY_VCODE_INVAL_YIN VALID_VALS3, value, "value",
"status", "current", "deprecated", "obsolete");
lydict_remove(ctx->xmlctx->ctx, value);
return LY_EVALID;
@@ -2106,7 +2106,7 @@
* @param[out] when_p When pointer to parse to.
*/
static LY_ERR
-yin_parse_when(struct lys_yin_parser_ctx *ctx, struct lysp_when **when_p)
+yin_parse_when(struct lysp_yin_ctx *ctx, struct lysp_when **when_p)
{
struct lysp_when *when;
LY_ERR ret = LY_SUCCESS;
@@ -2146,7 +2146,7 @@
* @return LY_ERR values.
*/
static LY_ERR
-yin_parse_yin_element(struct lys_yin_parser_ctx *ctx, uint16_t *flags, struct lysp_ext_instance **exts)
+yin_parse_yin_element(struct lysp_yin_ctx *ctx, uint16_t *flags, struct lysp_ext_instance **exts)
{
const char *temp_val = NULL;
struct yin_subelement subelems[] = {
@@ -2160,7 +2160,7 @@
} else if (strcmp(temp_val, "false") == 0) {
*flags |= LYS_YINELEM_FALSE;
} else {
- LOGVAL_PARSER((struct lys_parser_ctx *)ctx, LY_VCODE_INVAL_YIN VALID_VALS2, temp_val, "value",
+ LOGVAL_PARSER((struct lysp_ctx *)ctx, LY_VCODE_INVAL_YIN VALID_VALS2, temp_val, "value",
"yin-element", "true", "false");
lydict_remove(ctx->xmlctx->ctx, temp_val);
return LY_EVALID;
@@ -2182,7 +2182,7 @@
* @return LY_ERR values.
*/
static LY_ERR
-yin_parse_argument(struct lys_yin_parser_ctx *ctx, struct yin_argument_meta *arg_meta, struct lysp_ext_instance **exts)
+yin_parse_argument(struct lysp_yin_ctx *ctx, struct yin_argument_meta *arg_meta, struct lysp_ext_instance **exts)
{
struct yin_subelement subelems[] = {
{LY_STMT_YIN_ELEMENT, arg_meta->flags, YIN_SUBELEM_UNIQUE},
@@ -2206,7 +2206,7 @@
* @return LY_ERR values.
*/
static LY_ERR
-yin_parse_extension(struct lys_yin_parser_ctx *ctx, struct lysp_ext **extensions)
+yin_parse_extension(struct lysp_yin_ctx *ctx, struct lysp_ext **extensions)
{
struct lysp_ext *ex;
@@ -2240,7 +2240,7 @@
* @return LY_ERR values.
*/
static LY_ERR
-yin_parse_feature(struct lys_yin_parser_ctx *ctx, struct lysp_feature **features)
+yin_parse_feature(struct lysp_yin_ctx *ctx, struct lysp_feature **features)
{
struct lysp_feature *feat;
@@ -2277,7 +2277,7 @@
* @return LY_ERR values.
*/
static LY_ERR
-yin_parse_identity(struct lys_yin_parser_ctx *ctx, struct lysp_ident **identities)
+yin_parse_identity(struct lysp_yin_ctx *ctx, struct lysp_ident **identities)
{
struct lysp_ident *ident;
@@ -2315,7 +2315,7 @@
* @return LY_ERR values.
*/
static LY_ERR
-yin_parse_list(struct lys_yin_parser_ctx *ctx, struct tree_node_meta *node_meta)
+yin_parse_list(struct lysp_yin_ctx *ctx, struct tree_node_meta *node_meta)
{
struct lysp_node_list *list;
LY_ERR ret = LY_SUCCESS;
@@ -2365,7 +2365,7 @@
LY_CHECK_RET(ly_set_add(&ctx->ext_inst, list->exts, 1, NULL));
if (list->max && (list->min > list->max)) {
- LOGVAL_PARSER((struct lys_parser_ctx *)ctx, LY_VCODE_INVAL_MINMAX, list->min, list->max);
+ LOGVAL_PARSER((struct lysp_ctx *)ctx, LY_VCODE_INVAL_MINMAX, list->min, list->max);
return LY_EVALID;
}
@@ -2381,7 +2381,7 @@
* @return LY_ERR values.
*/
static LY_ERR
-yin_parse_notification(struct lys_yin_parser_ctx *ctx, struct tree_node_meta *notif_meta)
+yin_parse_notification(struct lysp_yin_ctx *ctx, struct tree_node_meta *notif_meta)
{
struct lysp_node_notif *notif;
struct lysp_node_notif **notifs = (struct lysp_node_notif **)notif_meta->nodes;
@@ -2436,7 +2436,7 @@
* @return LY_ERR values.
*/
static LY_ERR
-yin_parse_grouping(struct lys_yin_parser_ctx *ctx, struct tree_node_meta *gr_meta)
+yin_parse_grouping(struct lysp_yin_ctx *ctx, struct tree_node_meta *gr_meta)
{
struct lysp_node_grp *grp;
struct lysp_node_grp **grps = (struct lysp_node_grp **)gr_meta->nodes;
@@ -2495,7 +2495,7 @@
* @return LY_ERR values.
*/
static LY_ERR
-yin_parse_container(struct lys_yin_parser_ctx *ctx, struct tree_node_meta *node_meta)
+yin_parse_container(struct lysp_yin_ctx *ctx, struct tree_node_meta *node_meta)
{
struct lysp_node_container *cont;
LY_ERR ret = LY_SUCCESS;
@@ -2553,7 +2553,7 @@
* @return LY_ERR values.
*/
static LY_ERR
-yin_parse_case(struct lys_yin_parser_ctx *ctx, struct tree_node_meta *node_meta)
+yin_parse_case(struct lysp_yin_ctx *ctx, struct tree_node_meta *node_meta)
{
struct lysp_node_case *cas;
LY_ERR ret = LY_SUCCESS;
@@ -2604,7 +2604,7 @@
* @return LY_ERR values.
*/
LY_ERR
-yin_parse_choice(struct lys_yin_parser_ctx *ctx, struct tree_node_meta *node_meta)
+yin_parse_choice(struct lysp_yin_ctx *ctx, struct tree_node_meta *node_meta)
{
LY_ERR ret = LY_SUCCESS;
struct yin_subelement *subelems = NULL;
@@ -2660,7 +2660,7 @@
* @return LY_ERR values.
*/
static LY_ERR
-yin_parse_inout(struct lys_yin_parser_ctx *ctx, enum ly_stmt inout_kw, struct inout_meta *inout_meta)
+yin_parse_inout(struct lysp_yin_ctx *ctx, enum ly_stmt inout_kw, struct inout_meta *inout_meta)
{
LY_ERR ret = LY_SUCCESS;
struct yin_subelement *subelems = NULL;
@@ -2697,7 +2697,7 @@
LY_CHECK_RET(ly_set_add(&ctx->ext_inst, inout_meta->inout_p->exts, 1, NULL));
if (!inout_meta->inout_p->child) {
- LOGVAL_PARSER((struct lys_parser_ctx *)ctx, LY_VCODE_MISSTMT, "data-def-stmt", ly_stmt2str(inout_kw));
+ LOGVAL_PARSER((struct lysp_ctx *)ctx, LY_VCODE_MISSTMT, "data-def-stmt", ly_stmt2str(inout_kw));
return LY_EVALID;
}
@@ -2713,7 +2713,7 @@
* @return LY_ERR values.
*/
static LY_ERR
-yin_parse_action(struct lys_yin_parser_ctx *ctx, struct tree_node_meta *act_meta)
+yin_parse_action(struct lysp_yin_ctx *ctx, struct tree_node_meta *act_meta)
{
struct lysp_node_action *act, **acts = (struct lysp_node_action **)act_meta->nodes;
LY_ERR ret = LY_SUCCESS;
@@ -2769,7 +2769,7 @@
* @return LY_ERR values.
*/
static LY_ERR
-yin_parse_augment(struct lys_yin_parser_ctx *ctx, struct tree_node_meta *aug_meta)
+yin_parse_augment(struct lysp_yin_ctx *ctx, struct tree_node_meta *aug_meta)
{
struct lysp_node_augment *aug;
struct lysp_node_augment **augs = (struct lysp_node_augment **)aug_meta->nodes;
@@ -2785,7 +2785,7 @@
/* parse argument */
LY_CHECK_RET(lyxml_ctx_next(ctx->xmlctx));
LY_CHECK_RET(yin_parse_attribute(ctx, YIN_ARG_TARGET_NODE, &aug->nodeid, Y_STR_ARG, LY_STMT_AUGMENT));
- CHECK_NONEMPTY((struct lys_parser_ctx *)ctx, strlen(aug->nodeid), "augment");
+ CHECK_NONEMPTY((struct lysp_ctx *)ctx, strlen(aug->nodeid), "augment");
/* parser augment content */
LY_CHECK_RET(subelems_allocator(ctx, subelems_size = 17, (struct lysp_node *)aug, &subelems,
@@ -2825,7 +2825,7 @@
* @return LY_ERR values.
*/
static LY_ERR
-yin_parse_deviate(struct lys_yin_parser_ctx *ctx, struct lysp_deviate **deviates)
+yin_parse_deviate(struct lysp_yin_ctx *ctx, struct lysp_deviate **deviates)
{
LY_ERR ret = LY_SUCCESS;
uint8_t dev_mod;
@@ -2848,7 +2848,7 @@
} else if (strcmp(temp_val, "delete") == 0) {
dev_mod = LYS_DEV_DELETE;
} else {
- LOGVAL_PARSER((struct lys_parser_ctx *)ctx, LY_VCODE_INVAL_YIN VALID_VALS4, temp_val, "value", "deviate",
+ LOGVAL_PARSER((struct lysp_ctx *)ctx, LY_VCODE_INVAL_YIN VALID_VALS4, temp_val, "value", "deviate",
"not-supported", "add", "replace", "delete");
lydict_remove(ctx->xmlctx->ctx, temp_val);
return LY_EVALID;
@@ -2941,7 +2941,7 @@
* @return LY_ERR values.
*/
static LY_ERR
-yin_parse_deviation(struct lys_yin_parser_ctx *ctx, struct lysp_deviation **deviations)
+yin_parse_deviation(struct lysp_yin_ctx *ctx, struct lysp_deviation **deviations)
{
LY_ERR ret = LY_SUCCESS;
struct lysp_deviation *dev = NULL;
@@ -2953,7 +2953,7 @@
/* parse argument */
LY_CHECK_GOTO(ret = lyxml_ctx_next(ctx->xmlctx), cleanup);
LY_CHECK_GOTO(ret = yin_parse_attribute(ctx, YIN_ARG_TARGET_NODE, &dev->nodeid, Y_STR_ARG, LY_STMT_DEVIATION), cleanup);
- CHECK_NONEMPTY((struct lys_parser_ctx *)ctx, strlen(dev->nodeid), "deviation");
+ CHECK_NONEMPTY((struct lysp_ctx *)ctx, strlen(dev->nodeid), "deviation");
struct yin_subelement subelems[] = {
{LY_STMT_DESCRIPTION, &dev->dsc, YIN_SUBELEM_UNIQUE},
{LY_STMT_DEVIATE, &dev->deviates, YIN_SUBELEM_MANDATORY},
@@ -2983,7 +2983,7 @@
* @return LY_SUCCESS on success LY_EINT if kw can't be mapped to kw_group, should not happen if called correctly.
*/
static LY_ERR
-kw2kw_group(struct lys_yin_parser_ctx *ctx, enum ly_stmt kw, enum yang_module_stmt *group)
+kw2kw_group(struct lysp_yin_ctx *ctx, enum ly_stmt kw, enum yang_module_stmt *group)
{
switch (kw) {
/* module header */
@@ -3050,7 +3050,7 @@
* @return LY_SUCCESS on success and LY_EVALID if relative order is invalid.
*/
static LY_ERR
-yin_check_relative_order(struct lys_yin_parser_ctx *ctx, enum ly_stmt kw, enum ly_stmt next_kw, enum ly_stmt parrent)
+yin_check_relative_order(struct lysp_yin_ctx *ctx, enum ly_stmt kw, enum ly_stmt next_kw, enum ly_stmt parrent)
{
assert(parrent == LY_STMT_MODULE || parrent == LY_STMT_SUBMODULE);
enum yang_module_stmt gr, next_gr;
@@ -3064,7 +3064,7 @@
LY_CHECK_RET(kw2kw_group(ctx, next_kw, &next_gr));
if (gr > next_gr) {
- LOGVAL_PARSER((struct lys_parser_ctx *)ctx, LY_VCODE_INORDER_YIN, ly_stmt2str(parrent), ly_stmt2str(next_kw), ly_stmt2str(kw));
+ LOGVAL_PARSER((struct lysp_ctx *)ctx, LY_VCODE_INORDER_YIN, ly_stmt2str(parrent), ly_stmt2str(next_kw), ly_stmt2str(kw));
return LY_EVALID;
}
@@ -3080,7 +3080,7 @@
* @return LY_ERR values.
*/
static LY_ERR
-yin_parse_extension_instance_arg(struct lys_yin_parser_ctx *ctx, enum ly_stmt elem_type, const char **arg)
+yin_parse_extension_instance_arg(struct lysp_yin_ctx *ctx, enum ly_stmt elem_type, const char **arg)
{
enum ly_stmt child;
@@ -3183,7 +3183,7 @@
LY_CHECK_RET(lyxml_ctx_next(ctx->xmlctx));
}
if (((ctx->xmlctx->status == LYXML_ELEM_CONTENT) && !ctx->xmlctx->ws_only) || (ctx->xmlctx->status != LYXML_ELEMENT)) {
- LOGVAL_PARSER((struct lys_parser_ctx *)ctx, LY_VCODE_FIRT_SUBELEM,
+ LOGVAL_PARSER((struct lysp_ctx *)ctx, LY_VCODE_FIRT_SUBELEM,
elem_type == LY_STMT_ERROR_MESSAGE ? "value" : "text", ly_stmt2str(elem_type));
return LY_EVALID;
}
@@ -3192,7 +3192,7 @@
child = yin_match_keyword(ctx, ctx->xmlctx->name, ctx->xmlctx->name_len, ctx->xmlctx->prefix, ctx->xmlctx->prefix_len, elem_type);
if (((elem_type == LY_STMT_ERROR_MESSAGE) && (child != LY_STMT_ARG_VALUE)) ||
((elem_type != LY_STMT_ERROR_MESSAGE) && (child != LY_STMT_ARG_TEXT))) {
- LOGVAL_PARSER((struct lys_parser_ctx *)ctx, LY_VCODE_UNEXP_SUBELEM, ctx->xmlctx->name_len, ctx->xmlctx->name,
+ LOGVAL_PARSER((struct lysp_ctx *)ctx, LY_VCODE_UNEXP_SUBELEM, ctx->xmlctx->name_len, ctx->xmlctx->name,
ly_stmt2str(elem_type));
return LY_EVALID;
}
@@ -3233,7 +3233,7 @@
* @return LY_ERR values.
*/
LY_ERR
-yin_parse_element_generic(struct lys_yin_parser_ctx *ctx, enum ly_stmt parent, struct lysp_stmt **element)
+yin_parse_element_generic(struct lysp_yin_ctx *ctx, enum ly_stmt parent, struct lysp_stmt **element)
{
LY_ERR ret = LY_SUCCESS;
struct lysp_stmt *last = NULL, *new = NULL;
@@ -3268,7 +3268,7 @@
last = (*element)->child;
if ((*element)->kw == LY_STMT_NONE) {
/* unrecognized element */
- LOGVAL_PARSER((struct lys_parser_ctx *)ctx, LY_VCODE_UNEXP_SUBELEM, ctx->xmlctx->name_len, ctx->xmlctx->name,
+ LOGVAL_PARSER((struct lysp_ctx *)ctx, LY_VCODE_UNEXP_SUBELEM, ctx->xmlctx->name_len, ctx->xmlctx->name,
ly_stmt2str(parent));
ret = LY_EVALID;
goto cleanup;
@@ -3353,7 +3353,7 @@
* @return LY_ERR values.
*/
LY_ERR
-yin_parse_extension_instance(struct lys_yin_parser_ctx *ctx, enum ly_stmt subelem, LY_ARRAY_COUNT_TYPE subelem_index,
+yin_parse_extension_instance(struct lysp_yin_ctx *ctx, enum ly_stmt subelem, LY_ARRAY_COUNT_TYPE subelem_index,
struct lysp_ext_instance **exts)
{
struct lysp_ext_instance *e;
@@ -3460,7 +3460,7 @@
* @return LY_ERR values.
*/
LY_ERR
-yin_parse_content(struct lys_yin_parser_ctx *ctx, struct yin_subelement *subelem_info, size_t subelem_info_size,
+yin_parse_content(struct lysp_yin_ctx *ctx, struct yin_subelement *subelem_info, size_t subelem_info_size,
enum ly_stmt current_element, const char **text_content, struct lysp_ext_instance **exts)
{
LY_ERR ret = LY_SUCCESS;
@@ -3492,9 +3492,9 @@
subelem = get_record(kw, subelem_info_size, subelem_info);
if (!subelem) {
if ((current_element == LY_STMT_DEVIATE) && isdevsub(kw)) {
- LOGVAL_PARSER((struct lys_parser_ctx *)ctx, LY_VCODE_INDEV_YIN, ly_stmt2str(kw));
+ LOGVAL_PARSER((struct lysp_ctx *)ctx, LY_VCODE_INDEV_YIN, ly_stmt2str(kw));
} else {
- LOGVAL_PARSER((struct lys_parser_ctx *)ctx, LY_VCODE_UNEXP_SUBELEM, ctx->xmlctx->name_len,
+ LOGVAL_PARSER((struct lysp_ctx *)ctx, LY_VCODE_UNEXP_SUBELEM, ctx->xmlctx->name_len,
ctx->xmlctx->name, ly_stmt2str(current_element));
}
ret = LY_EVALID;
@@ -3510,7 +3510,7 @@
/* flag check */
if ((subelem->flags & YIN_SUBELEM_UNIQUE) && (subelem->flags & YIN_SUBELEM_PARSED)) {
/* subelement uniquenes */
- LOGVAL_PARSER((struct lys_parser_ctx *)ctx, LY_VCODE_SUBELEM_REDEF, ly_stmt2str(kw), ly_stmt2str(current_element));
+ LOGVAL_PARSER((struct lysp_ctx *)ctx, LY_VCODE_SUBELEM_REDEF, ly_stmt2str(kw), ly_stmt2str(current_element));
return LY_EVALID;
}
if (subelem->flags & YIN_SUBELEM_FIRST) {
@@ -3521,7 +3521,7 @@
if (subelem->flags & YIN_SUBELEM_VER2) {
/* subelement is supported only in version 1.1 or higher */
if (PARSER_CUR_PMOD(ctx)->version < LYS_VERSION_1_1) {
- LOGVAL_PARSER((struct lys_parser_ctx *)ctx, LY_VCODE_INSUBELEM2, ly_stmt2str(kw), ly_stmt2str(current_element));
+ LOGVAL_PARSER((struct lysp_ctx *)ctx, LY_VCODE_INSUBELEM2, ly_stmt2str(kw), ly_stmt2str(current_element));
ret = LY_EVALID;
goto cleanup;
}
@@ -3763,7 +3763,7 @@
* @return LY_ERR values.
*/
LY_ERR
-yin_parse_mod(struct lys_yin_parser_ctx *ctx, struct lysp_module *mod)
+yin_parse_mod(struct lysp_yin_ctx *ctx, struct lysp_module *mod)
{
LY_ERR ret = LY_SUCCESS;
struct yin_subelement *subelems = NULL;
@@ -3815,7 +3815,7 @@
* a submodule of the same name in the context, no need for revision matching */
dup = ly_ctx_get_submodule_latest(ctx->xmlctx->ctx, mod->mod->name);
if (dup) {
- LOGVAL_PARSER((struct lys_parser_ctx *)ctx, LY_VCODE_NAME2_COL, "module", "submodule", mod->mod->name);
+ LOGVAL_PARSER((struct lysp_ctx *)ctx, LY_VCODE_NAME2_COL, "module", "submodule", mod->mod->name);
return LY_EVALID;
}
@@ -3831,7 +3831,7 @@
* @return LY_ERR values.
*/
LY_ERR
-yin_parse_submod(struct lys_yin_parser_ctx *ctx, struct lysp_submodule *submod)
+yin_parse_submod(struct lysp_yin_ctx *ctx, struct lysp_submodule *submod)
{
LY_ERR ret = LY_SUCCESS;
struct yin_subelement *subelems = NULL;
@@ -3882,7 +3882,7 @@
* a submodule of the same name in the context, no need for revision matching */
dup = ly_ctx_get_submodule_latest(ctx->xmlctx->ctx, submod->name);
if (dup && strcmp(dup->mod->name, submod->mod->name)) {
- LOGVAL_PARSER((struct lys_parser_ctx *)ctx, LY_VCODE_NAME_COL, "submodules", dup->name);
+ LOGVAL_PARSER((struct lysp_ctx *)ctx, LY_VCODE_NAME_COL, "submodules", dup->name);
return LY_EVALID;
}
@@ -3890,7 +3890,7 @@
}
LY_ERR
-yin_parse_submodule(struct lys_yin_parser_ctx **yin_ctx, struct ly_ctx *ctx, struct lys_parser_ctx *main_ctx,
+yin_parse_submodule(struct lysp_yin_ctx **yin_ctx, struct ly_ctx *ctx, struct lysp_ctx *main_ctx,
struct ly_in *in, struct lysp_submodule **submod)
{
enum ly_stmt kw = LY_STMT_NONE;
@@ -3924,7 +3924,7 @@
ret = LY_EINVAL;
goto cleanup;
} else if (kw != LY_STMT_SUBMODULE) {
- LOGVAL_PARSER((struct lys_parser_ctx *)*yin_ctx, LY_VCODE_MOD_SUBOMD, ly_stmt2str(kw));
+ LOGVAL_PARSER((struct lysp_ctx *)*yin_ctx, LY_VCODE_MOD_SUBOMD, ly_stmt2str(kw));
ret = LY_EVALID;
goto cleanup;
}
@@ -3940,7 +3940,7 @@
ly_in_skip(in, 1);
}
if (in->current[0]) {
- LOGVAL_PARSER((struct lys_parser_ctx *)*yin_ctx, LY_VCODE_TRAILING_SUBMOD, 15, in->current,
+ LOGVAL_PARSER((struct lysp_ctx *)*yin_ctx, LY_VCODE_TRAILING_SUBMOD, 15, in->current,
strlen(in->current) > 15 ? "..." : "");
ret = LY_EVALID;
goto cleanup;
@@ -3952,14 +3952,14 @@
cleanup:
if (ret) {
lysp_module_free(&fctx, (struct lysp_module *)mod_p);
- yin_parser_ctx_free(*yin_ctx);
+ lysp_yin_ctx_free(*yin_ctx);
*yin_ctx = NULL;
}
return ret;
}
LY_ERR
-yin_parse_module(struct lys_yin_parser_ctx **yin_ctx, struct ly_in *in, struct lys_module *mod)
+yin_parse_module(struct lysp_yin_ctx **yin_ctx, struct ly_in *in, struct lys_module *mod)
{
LY_ERR ret = LY_SUCCESS;
enum ly_stmt kw = LY_STMT_NONE;
@@ -3972,7 +3972,7 @@
(*yin_ctx)->format = LYS_IN_YIN;
LY_CHECK_ERR_RET(ly_set_new(&(*yin_ctx)->parsed_mods), free(*yin_ctx); LOGMEM(mod->ctx), LY_EMEM);
LY_CHECK_RET(lyxml_ctx_new(mod->ctx, in, &(*yin_ctx)->xmlctx));
- (*yin_ctx)->main_ctx = (struct lys_parser_ctx *)(*yin_ctx);
+ (*yin_ctx)->main_ctx = (struct lysp_ctx *)(*yin_ctx);
mod_p = calloc(1, sizeof *mod_p);
LY_CHECK_ERR_GOTO(!mod_p, LOGMEM(mod->ctx), cleanup);
@@ -3987,7 +3987,7 @@
ret = LY_EINVAL;
goto cleanup;
} else if (kw != LY_STMT_MODULE) {
- LOGVAL_PARSER((struct lys_parser_ctx *)*yin_ctx, LY_VCODE_MOD_SUBOMD, ly_stmt2str(kw));
+ LOGVAL_PARSER((struct lysp_ctx *)*yin_ctx, LY_VCODE_MOD_SUBOMD, ly_stmt2str(kw));
ret = LY_EVALID;
goto cleanup;
}
@@ -4004,7 +4004,7 @@
ly_in_skip(in, 1);
}
if (in->current[0]) {
- LOGVAL_PARSER((struct lys_parser_ctx *)*yin_ctx, LY_VCODE_TRAILING_MOD, 15, in->current,
+ LOGVAL_PARSER((struct lysp_ctx *)*yin_ctx, LY_VCODE_TRAILING_MOD, 15, in->current,
strlen(in->current) > 15 ? "..." : "");
ret = LY_EVALID;
goto cleanup;
@@ -4015,7 +4015,7 @@
cleanup:
if (ret != LY_SUCCESS) {
lysp_module_free(&fctx, mod_p);
- yin_parser_ctx_free(*yin_ctx);
+ lysp_yin_ctx_free(*yin_ctx);
*yin_ctx = NULL;
}
return ret;
diff --git a/src/tree_schema.c b/src/tree_schema.c
index b0be387..3e6d5d2 100644
--- a/src/tree_schema.c
+++ b/src/tree_schema.c
@@ -1260,7 +1260,7 @@
* @return LY_ERR value.
*/
static LY_ERR
-lysp_resolve_import_include(struct lys_parser_ctx *pctx, struct lysp_module *pmod, struct ly_set *new_mods)
+lysp_resolve_import_include(struct lysp_ctx *pctx, struct lysp_module *pmod, struct ly_set *new_mods)
{
struct lysp_import *imp;
LY_ARRAY_COUNT_TYPE u, v;
@@ -1300,7 +1300,7 @@
* @return LY_ERR value.
*/
static LY_ERR
-lysp_resolve_ext_instance_records(struct lys_parser_ctx *pctx)
+lysp_resolve_ext_instance_records(struct lysp_ctx *pctx)
{
struct lysp_ext_instance *exts, *ext;
const struct lys_module *mod;
@@ -1333,15 +1333,15 @@
}
LY_ERR
-lys_parse_submodule(struct ly_ctx *ctx, struct ly_in *in, LYS_INFORMAT format, struct lys_parser_ctx *main_ctx,
+lys_parse_submodule(struct ly_ctx *ctx, struct ly_in *in, LYS_INFORMAT format, struct lysp_ctx *main_ctx,
LY_ERR (*custom_check)(const struct ly_ctx *, struct lysp_module *, struct lysp_submodule *, void *),
void *check_data, struct ly_set *new_mods, struct lysp_submodule **submodule)
{
LY_ERR ret;
struct lysp_submodule *submod = NULL, *latest_sp;
- struct lys_yang_parser_ctx *yangctx = NULL;
- struct lys_yin_parser_ctx *yinctx = NULL;
- struct lys_parser_ctx *pctx;
+ struct lysp_yang_ctx *yangctx = NULL;
+ struct lysp_yin_ctx *yinctx = NULL;
+ struct lysp_ctx *pctx;
struct lysf_ctx fctx = {.ctx = ctx};
LY_CHECK_ARG_RET(ctx, ctx, in, LY_EINVAL);
@@ -1349,11 +1349,11 @@
switch (format) {
case LYS_IN_YIN:
ret = yin_parse_submodule(&yinctx, ctx, main_ctx, in, &submod);
- pctx = (struct lys_parser_ctx *)yinctx;
+ pctx = (struct lysp_ctx *)yinctx;
break;
case LYS_IN_YANG:
ret = yang_parse_submodule(&yangctx, ctx, main_ctx, in, &submod);
- pctx = (struct lys_parser_ctx *)yangctx;
+ pctx = (struct lysp_ctx *)yangctx;
break;
default:
LOGERR(ctx, LY_EINVAL, "Invalid schema input format.");
@@ -1404,9 +1404,9 @@
LY_CHECK_GOTO(ret = lysp_resolve_ext_instance_records(pctx), error);
if (format == LYS_IN_YANG) {
- yang_parser_ctx_free(yangctx);
+ lysp_yang_ctx_free(yangctx);
} else {
- yin_parser_ctx_free(yinctx);
+ lysp_yin_ctx_free(yinctx);
}
*submodule = submod;
return LY_SUCCESS;
@@ -1419,9 +1419,9 @@
}
lysp_module_free(&fctx, (struct lysp_module *)submod);
if (format == LYS_IN_YANG) {
- yang_parser_ctx_free(yangctx);
+ lysp_yang_ctx_free(yangctx);
} else {
- yin_parser_ctx_free(yinctx);
+ lysp_yin_ctx_free(yinctx);
}
return ret;
}
@@ -1646,9 +1646,9 @@
{
struct lys_module *mod = NULL, *latest, *mod_dup = NULL;
LY_ERR ret;
- struct lys_yang_parser_ctx *yangctx = NULL;
- struct lys_yin_parser_ctx *yinctx = NULL;
- struct lys_parser_ctx *pctx = NULL;
+ struct lysp_yang_ctx *yangctx = NULL;
+ struct lysp_yin_ctx *yinctx = NULL;
+ struct lysp_ctx *pctx = NULL;
struct lysf_ctx fctx = {.ctx = ctx};
char *filename, *rev, *dot;
size_t len;
@@ -1668,11 +1668,11 @@
switch (format) {
case LYS_IN_YIN:
ret = yin_parse_module(&yinctx, in, mod);
- pctx = (struct lys_parser_ctx *)yinctx;
+ pctx = (struct lysp_ctx *)yinctx;
break;
case LYS_IN_YANG:
ret = yang_parse_module(&yangctx, in, mod);
- pctx = (struct lys_parser_ctx *)yangctx;
+ pctx = (struct lysp_ctx *)yangctx;
break;
default:
LOGERR(ctx, LY_EINVAL, "Invalid schema input format.");
@@ -1828,9 +1828,9 @@
}
if (format == LYS_IN_YANG) {
- yang_parser_ctx_free(yangctx);
+ lysp_yang_ctx_free(yangctx);
} else {
- yin_parser_ctx_free(yinctx);
+ lysp_yin_ctx_free(yinctx);
}
if (!ret && module) {
diff --git a/src/tree_schema_common.c b/src/tree_schema_common.c
index fe7b741..427d404 100644
--- a/src/tree_schema_common.c
+++ b/src/tree_schema_common.c
@@ -41,7 +41,7 @@
#include "tree_schema_internal.h"
LY_ERR
-lysp_check_prefix(struct lys_parser_ctx *ctx, struct lysp_import *imports, const char *module_prefix, const char **value)
+lysp_check_prefix(struct lysp_ctx *ctx, struct lysp_import *imports, const char *module_prefix, const char **value)
{
struct lysp_import *i;
@@ -59,7 +59,7 @@
}
LY_ERR
-lysp_check_date(struct lys_parser_ctx *ctx, const char *date, size_t date_len, const char *stmt)
+lysp_check_date(struct lysp_ctx *ctx, const char *date, size_t date_len, const char *stmt)
{
struct tm tm, tm_;
char *r;
@@ -126,7 +126,7 @@
}
LY_ERR
-lysp_check_enum_name(struct lys_parser_ctx *ctx, const char *name, size_t name_len)
+lysp_check_enum_name(struct lysp_ctx *ctx, const char *name, size_t name_len)
{
if (!name_len) {
LOGVAL_PARSER(ctx, LYVE_SYNTAX_YANG, "Enum name must not be zero-length.");
@@ -352,7 +352,7 @@
* @return LY_ERR, but LY_EEXIST is mapped to LY_EVALID.
*/
static LY_ERR
-lysp_check_dup_ht_insert(struct lys_parser_ctx *ctx, struct hash_table *ht,
+lysp_check_dup_ht_insert(struct lysp_ctx *ctx, struct hash_table *ht,
const char *name, const char *statement, const char *err_detail)
{
LY_ERR ret;
@@ -383,7 +383,7 @@
* @return LY_EVALID in case of collision, LY_SUCCESS otherwise.
*/
static LY_ERR
-lysp_check_dup_typedef(struct lys_parser_ctx *ctx, struct lysp_node *node, const struct lysp_tpdf *tpdf,
+lysp_check_dup_typedef(struct lysp_ctx *ctx, struct lysp_node *node, const struct lysp_tpdf *tpdf,
struct hash_table *tpdfs_global)
{
struct lysp_node *parent;
@@ -463,7 +463,7 @@
}
LY_ERR
-lysp_check_dup_typedefs(struct lys_parser_ctx *ctx, struct lysp_module *mod)
+lysp_check_dup_typedefs(struct lysp_ctx *ctx, struct lysp_module *mod)
{
struct hash_table *ids_global;
const struct lysp_tpdf *typedefs;
@@ -523,7 +523,7 @@
* @return LY_EVALID in case of collision, LY_SUCCESS otherwise.
*/
static LY_ERR
-lysp_check_dup_grouping(struct lys_parser_ctx *ctx, struct lysp_node *node, const struct lysp_node_grp *grp,
+lysp_check_dup_grouping(struct lysp_ctx *ctx, struct lysp_node *node, const struct lysp_node_grp *grp,
struct hash_table *grps_global)
{
struct lysp_node *parent;
@@ -578,7 +578,7 @@
}
LY_ERR
-lysp_check_dup_groupings(struct lys_parser_ctx *ctx, struct lysp_module *mod)
+lysp_check_dup_groupings(struct lysp_ctx *ctx, struct lysp_module *mod)
{
struct hash_table *ids_global;
const struct lysp_node_grp *groupings, *grp_iter;
@@ -619,7 +619,7 @@
}
LY_ERR
-lysp_check_dup_features(struct lys_parser_ctx *ctx, struct lysp_module *mod)
+lysp_check_dup_features(struct lysp_ctx *ctx, struct lysp_module *mod)
{
LY_ARRAY_COUNT_TYPE u;
struct hash_table *ht;
@@ -651,7 +651,7 @@
}
LY_ERR
-lysp_check_dup_identities(struct lys_parser_ctx *ctx, struct lysp_module *mod)
+lysp_check_dup_identities(struct lysp_ctx *ctx, struct lysp_module *mod)
{
LY_ARRAY_COUNT_TYPE u;
struct hash_table *ht;
@@ -782,7 +782,7 @@
* @return LY_ERR on error.
*/
static LY_ERR
-lys_parse_localfile(struct ly_ctx *ctx, const char *name, const char *revision, struct lys_parser_ctx *main_ctx,
+lys_parse_localfile(struct ly_ctx *ctx, const char *name, const char *revision, struct lysp_ctx *main_ctx,
const char *main_name, ly_bool required, struct ly_set *new_mods, void **result)
{
struct ly_in *in;
@@ -1017,7 +1017,7 @@
}
LY_ERR
-lysp_check_stringchar(struct lys_parser_ctx *ctx, uint32_t c)
+lysp_check_stringchar(struct lysp_ctx *ctx, uint32_t c)
{
if (!is_yangutf8char(c)) {
LOGVAL_PARSER(ctx, LY_VCODE_INCHAR, c);
@@ -1027,7 +1027,7 @@
}
LY_ERR
-lysp_check_identifierchar(struct lys_parser_ctx *ctx, uint32_t c, ly_bool first, uint8_t *prefix)
+lysp_check_identifierchar(struct lysp_ctx *ctx, uint32_t c, ly_bool first, uint8_t *prefix)
{
if (first || (prefix && ((*prefix) == 1))) {
if (!is_yangidentstartchar(c)) {
@@ -1072,7 +1072,7 @@
* @return LY_EVALID - YANG rule violation
*/
static LY_ERR
-lysp_main_pmod_get_submodule(struct lys_parser_ctx *pctx, struct lysp_include *inc)
+lysp_main_pmod_get_submodule(struct lysp_ctx *pctx, struct lysp_include *inc)
{
LY_ARRAY_COUNT_TYPE i;
struct lysp_module *main_pmod = PARSER_CUR_PMOD(pctx)->mod->parsed;
@@ -1115,7 +1115,7 @@
* @return LY_EVALID - YANG rule violation
*/
static LY_ERR
-lysp_parsed_mods_get_submodule(struct lys_parser_ctx *pctx, struct lysp_include *inc)
+lysp_parsed_mods_get_submodule(struct lysp_ctx *pctx, struct lysp_include *inc)
{
uint32_t i;
struct lysp_submodule *submod;
@@ -1156,7 +1156,7 @@
* @return LY_ERR value.
*/
static LY_ERR
-lysp_inject_submodule(struct lys_parser_ctx *pctx, struct lysp_include *inc)
+lysp_inject_submodule(struct lysp_ctx *pctx, struct lysp_include *inc)
{
LY_ARRAY_COUNT_TYPE i;
struct lysp_include *inc_new, *inc_tofill = NULL;
@@ -1188,7 +1188,7 @@
}
LY_ERR
-lysp_load_submodules(struct lys_parser_ctx *pctx, struct lysp_module *pmod, struct ly_set *new_mods)
+lysp_load_submodules(struct lysp_ctx *pctx, struct lysp_module *pmod, struct ly_set *new_mods)
{
LY_ARRAY_COUNT_TYPE u;
struct ly_ctx *ctx = PARSER_CTX(pctx);
diff --git a/src/tree_schema_free.c b/src/tree_schema_free.c
index 77f9751..d35d8a4 100644
--- a/src/tree_schema_free.c
+++ b/src/tree_schema_free.c
@@ -1488,10 +1488,10 @@
}
void
-yang_parser_ctx_free(struct lys_yang_parser_ctx *ctx)
+lysp_yang_ctx_free(struct lysp_yang_ctx *ctx)
{
if (ctx) {
- if (ctx->main_ctx == (struct lys_parser_ctx *)ctx) {
+ if (ctx->main_ctx == (struct lysp_ctx *)ctx) {
ly_set_erase(&ctx->tpdfs_nodes, NULL);
ly_set_erase(&ctx->grps_nodes, NULL);
}
@@ -1506,10 +1506,10 @@
}
void
-yin_parser_ctx_free(struct lys_yin_parser_ctx *ctx)
+lysp_yin_ctx_free(struct lysp_yin_ctx *ctx)
{
if (ctx) {
- if (ctx->main_ctx == (struct lys_parser_ctx *)ctx) {
+ if (ctx->main_ctx == (struct lysp_ctx *)ctx) {
ly_set_erase(&ctx->tpdfs_nodes, NULL);
ly_set_erase(&ctx->grps_nodes, NULL);
}
diff --git a/src/tree_schema_free.h b/src/tree_schema_free.h
index ba5167f..778190b 100644
--- a/src/tree_schema_free.h
+++ b/src/tree_schema_free.h
@@ -18,8 +18,8 @@
#include "set.h"
#include "tree_schema.h"
-struct lys_yang_parser_ctx;
-struct lys_yin_parser_ctx;
+struct lysp_yang_ctx;
+struct lysp_yin_ctx;
struct lysf_ctx {
struct ly_ctx *ctx;
@@ -209,13 +209,13 @@
*
* @param[in] ctx Context to free.
*/
-void yang_parser_ctx_free(struct lys_yang_parser_ctx *ctx);
+void lysp_yang_ctx_free(struct lysp_yang_ctx *ctx);
/**
* @brief Free yin parser context
*
* @param[in] ctx Context to free.
*/
-void yin_parser_ctx_free(struct lys_yin_parser_ctx *ctx);
+void lysp_yin_ctx_free(struct lysp_yin_ctx *ctx);
#endif /* LY_TREE_SCHEMA_FREE_H_ */
diff --git a/src/tree_schema_internal.h b/src/tree_schema_internal.h
index e16f815..a72ae74 100644
--- a/src/tree_schema_internal.h
+++ b/src/tree_schema_internal.h
@@ -143,15 +143,15 @@
#define PARSER_CTX(CTX) (PARSER_CUR_PMOD(CTX)->mod->ctx)
#define LOGVAL_PARSER(CTX, ...) LOGVAL((CTX) ? PARSER_CTX(CTX) : NULL, __VA_ARGS__)
-struct lys_parser_ctx {
+struct lysp_ctx {
LYS_INFORMAT format; /**< parser format */
struct ly_set tpdfs_nodes; /**< Set of nodes that contain typedef(s). Invalid in case of
- submodule, use ::lys_parser_ctx.main_ctx instead. */
+ submodule, use ::lysp_ctx.main_ctx instead. */
struct ly_set grps_nodes; /**< Set of nodes that contain grouping(s). Invalid in case of
- submodule, use ::lys_parser_ctx.main_ctx instead. */
+ submodule, use ::lysp_ctx.main_ctx instead. */
struct ly_set ext_inst; /**< parsed extension instances to finish parsing */
struct ly_set *parsed_mods; /**< (sub)modules being parsed, the last one is the current */
- struct lys_parser_ctx *main_ctx; /**< This pointer must not be NULL. If this context deals with the submodule,
+ struct lysp_ctx *main_ctx; /**< This pointer must not be NULL. If this context deals with the submodule,
then should be set to the context of the module to which it belongs,
otherwise it points to the beginning of this structure. */
};
@@ -159,15 +159,15 @@
/**
* @brief Internal context for yang schema parser.
*/
-struct lys_yang_parser_ctx {
+struct lysp_yang_ctx {
LYS_INFORMAT format; /**< parser format */
struct ly_set tpdfs_nodes; /**< Set of nodes that contain typedef(s). Invalid in case of
- submodule, use ::lys_parser_ctx.main_ctx instead. */
+ submodule, use ::lysp_ctx.main_ctx instead. */
struct ly_set grps_nodes; /**< Set of nodes that contain grouping(s). Invalid in case of
- submodule, use ::lys_parser_ctx.main_ctx instead. */
+ submodule, use ::lysp_ctx.main_ctx instead. */
struct ly_set ext_inst; /**< parsed extension instances to finish parsing */
struct ly_set *parsed_mods; /**< (sub)modules being parsed, the last one is the current */
- struct lys_parser_ctx *main_ctx; /**< This pointer must not be NULL. If this context deals with the submodule,
+ struct lysp_ctx *main_ctx; /**< This pointer must not be NULL. If this context deals with the submodule,
then should be set to the context of the module to which it belongs,
otherwise it points to the beginning of this structure. */
struct ly_in *in; /**< input handler for the parser */
@@ -178,15 +178,15 @@
/**
* @brief Internal context for yin schema parser.
*/
-struct lys_yin_parser_ctx {
+struct lysp_yin_ctx {
LYS_INFORMAT format; /**< parser format */
struct ly_set tpdfs_nodes; /**< Set of nodes that contain typedef(s). Invalid in case of
- submodule, use ::lys_parser_ctx.main_ctx instead. */
+ submodule, use ::lysp_ctx.main_ctx instead. */
struct ly_set grps_nodes; /**< Set of nodes that contain grouping(s). Invalid in case of
- submodule, use ::lys_parser_ctx.main_ctx instead. */
+ submodule, use ::lysp_ctx.main_ctx instead. */
struct ly_set ext_inst; /**< parsed extension instances to finish parsing */
struct ly_set *parsed_mods; /**< (sub)modules being parsed, the last one is the current */
- struct lys_parser_ctx *main_ctx; /**< This pointer must not be NULL. If this context deals with the submodule,
+ struct lysp_ctx *main_ctx; /**< This pointer must not be NULL. If this context deals with the submodule,
then should be set to the context of the module to which it belongs,
otherwise it points to the beginning of this structure. */
struct lyxml_ctx *xmlctx; /**< context for xml parser */
@@ -199,7 +199,7 @@
* @param[in] c UTF8 code point of a character to check.
* @return LY_ERR values.
*/
-LY_ERR lysp_check_stringchar(struct lys_parser_ctx *ctx, uint32_t c);
+LY_ERR lysp_check_stringchar(struct lysp_ctx *ctx, uint32_t c);
/**
* @brief Check that \p c is valid UTF8 code point for YANG identifier.
@@ -215,7 +215,7 @@
* If the identifier cannot be prefixed, NULL is expected.
* @return LY_ERR values.
*/
-LY_ERR lysp_check_identifierchar(struct lys_parser_ctx *ctx, uint32_t c, ly_bool first, uint8_t *prefix);
+LY_ERR lysp_check_identifierchar(struct lysp_ctx *ctx, uint32_t c, ly_bool first, uint8_t *prefix);
/**
* @brief Check the currently present prefixes in the module for collision with the new one.
@@ -226,7 +226,7 @@
* @param[in] value Newly added prefix value (including its location to distinguish collision with itself).
* @return LY_EEXIST when prefix is already used in the module, LY_SUCCESS otherwise
*/
-LY_ERR lysp_check_prefix(struct lys_parser_ctx *ctx, struct lysp_import *imports, const char *module_prefix, const char **value);
+LY_ERR lysp_check_prefix(struct lysp_ctx *ctx, struct lysp_import *imports, const char *module_prefix, const char **value);
/**
* @brief Check date string (4DIGIT "-" 2DIGIT "-" 2DIGIT)
@@ -237,7 +237,7 @@
* @param[in] stmt Statement name for error message.
* @return LY_ERR value.
*/
-LY_ERR lysp_check_date(struct lys_parser_ctx *ctx, const char *date, size_t date_len, const char *stmt);
+LY_ERR lysp_check_date(struct lysp_ctx *ctx, const char *date, size_t date_len, const char *stmt);
/**
* @brief Find type specified type definition.
@@ -261,7 +261,7 @@
* @param[in] mod Module where the type is being defined.
* @return LY_ERR value.
*/
-LY_ERR lysp_check_dup_typedefs(struct lys_parser_ctx *ctx, struct lysp_module *mod);
+LY_ERR lysp_check_dup_typedefs(struct lysp_ctx *ctx, struct lysp_module *mod);
/**
* @brief Check names of groupings in the parsed module to detect collisions.
@@ -270,7 +270,7 @@
* @param[in] mod Module where the type is being defined.
* @return LY_ERR value.
*/
-LY_ERR lysp_check_dup_groupings(struct lys_parser_ctx *ctx, struct lysp_module *mod);
+LY_ERR lysp_check_dup_groupings(struct lysp_ctx *ctx, struct lysp_module *mod);
/**
* @brief Check names of features in the parsed module and submodules to detect collisions.
@@ -279,7 +279,7 @@
* @param[in] mod Module where the type is being defined.
* @return LY_ERR value.
*/
-LY_ERR lysp_check_dup_features(struct lys_parser_ctx *ctx, struct lysp_module *mod);
+LY_ERR lysp_check_dup_features(struct lysp_ctx *ctx, struct lysp_module *mod);
/**
* @brief Check names of identities in the parsed module and submodules to detect collisions.
@@ -288,7 +288,7 @@
* @param[in] mod Module where the type is being defined.
* @return LY_ERR value.
*/
-LY_ERR lysp_check_dup_identities(struct lys_parser_ctx *ctx, struct lysp_module *mod);
+LY_ERR lysp_check_dup_identities(struct lysp_ctx *ctx, struct lysp_module *mod);
/**
* @brief Just move the newest revision into the first position, does not sort the rest
@@ -305,7 +305,7 @@
*
* @return LY_ERR values
*/
-LY_ERR lysp_check_enum_name(struct lys_parser_ctx *ctx, const char *name, size_t name_len);
+LY_ERR lysp_check_enum_name(struct lysp_ctx *ctx, const char *name, size_t name_len);
/**
* @brief Find source data for a specific module, parse it, and add into the context.
@@ -332,7 +332,7 @@
* @param[in,out] new_mods Set of all the new mods added to the context. Includes this module and all of its imports.
* @return LY_ERR value.
*/
-LY_ERR lysp_load_submodules(struct lys_parser_ctx *pctx, struct lysp_module *pmod, struct ly_set *new_mods);
+LY_ERR lysp_load_submodules(struct lysp_ctx *pctx, struct lysp_module *pmod, struct ly_set *new_mods);
/**
* @brief Get address of a node's actions list if any.
@@ -578,7 +578,7 @@
* @param[out] submodule Parsed submodule.
* @return LY_ERR value.
*/
-LY_ERR lys_parse_submodule(struct ly_ctx *ctx, struct ly_in *in, LYS_INFORMAT format, struct lys_parser_ctx *main_ctx,
+LY_ERR lys_parse_submodule(struct ly_ctx *ctx, struct ly_in *in, LYS_INFORMAT format, struct lysp_ctx *main_ctx,
lys_custom_check custom_check, void *check_data, struct ly_set *new_mods, struct lysp_submodule **submodule);
/**