parser FEATURE added collision check for grouping
Collision checking of names is similar to typedef checking.
diff --git a/src/parser_yang.c b/src/parser_yang.c
index 8147a7f..b62c54a 100644
--- a/src/parser_yang.c
+++ b/src/parser_yang.c
@@ -2977,7 +2977,7 @@
grp->nodetype = LYS_GROUPING;
grp->parent = parent;
- YANG_READ_SUBSTMT_FOR(ctx, kw, word, word_len, ret, return LY_SUCCESS, return ret) {
+ YANG_READ_SUBSTMT_FOR(ctx, kw, word, word_len, ret, goto checks, return ret) {
switch (kw) {
case LY_STMT_DESCRIPTION:
LY_CHECK_RET(parse_text_field(ctx, LY_STMT_DESCRIPTION, 0, &grp->dsc, Y_STR_ARG, &grp->exts));
@@ -3036,6 +3036,13 @@
return LY_EVALID;
}
}
+ LY_CHECK_RET(ret);
+checks:
+ /* store data for collision check */
+ if (parent) {
+ assert(ctx->main_ctx);
+ LY_CHECK_RET(ly_set_add(&ctx->main_ctx->grps_nodes, parent, 0, NULL));
+ }
return ret;
}