yin parser CHANGE add support for bit element
diff --git a/src/parser_yin.c b/src/parser_yin.c
index 84f5b1b..e8ec242 100644
--- a/src/parser_yin.c
+++ b/src/parser_yin.c
@@ -470,6 +470,27 @@
return yin_parse_content(ctx, subelems, 6, data, YANG_PATTERN, NULL, &restr->exts);
}
+static LY_ERR
+yin_parse_bit(struct yin_parser_ctx *ctx, struct yin_arg_record *attrs, const char **data,
+ struct lysp_type *type)
+{
+ struct lysp_type_enum *bit;
+ LY_ARRAY_NEW_RET(ctx->xml_ctx.ctx, type->bits, bit, LY_EMEM);
+ LY_CHECK_RET(yin_parse_attribute(ctx, attrs, YIN_ARG_NAME, &bit->name, Y_IDENTIF_ARG, YANG_BIT));
+ type->flags |= LYS_SET_BIT;
+ CHECK_UNIQUENESS((struct lys_parser_ctx *)ctx, type->bits, name, "bit", bit->name);
+
+ struct yin_subelement subelems[6] = {
+ {YANG_DESCRIPTION, &bit->dsc, YIN_SUBELEM_UNIQUE},
+ {YANG_IF_FEATURE, &bit->iffeatures, 0},
+ {YANG_POSITION, &bit->value, YIN_SUBELEM_UNIQUE},
+ {YANG_REFERENCE, &bit->ref, YIN_SUBELEM_UNIQUE},
+ {YANG_STATUS, &bit->flags, YIN_SUBELEM_UNIQUE},
+ {YANG_CUSTOM, NULL, 0}
+ };
+ return yin_parse_content(ctx, subelems, 6, data, YANG_BIT, NULL, &bit->exts);
+}
+
/**
* @brief Parse simple element without any special constraints and argument mapped to yin attribute, that can have
* more instances, such as base or if-feature.
@@ -937,6 +958,7 @@
ret = yin_parse_belongs_to(ctx, subelem_attrs, data, (struct lysp_submodule *)subelem_info_rec->dest, exts);
break;
case YANG_BIT:
+ ret = yin_parse_bit(ctx, subelem_attrs, data, (struct lysp_type *)subelem_info_rec->dest);
break;
case YANG_CASE:
break;