parser yang CHANGE support extension in meta_stmts and revision_stmts
diff --git a/src/parser_yang.c b/src/parser_yang.c
index fbb624c..d342c11 100644
--- a/src/parser_yang.c
+++ b/src/parser_yang.c
@@ -216,22 +216,20 @@
return ret;
}
-void
+void *
yang_read_revision(struct lys_module *module, char *value, struct lys_revision *retval)
{
/* first member of array is last revision */
if ((module->rev_size - 1) && strcmp(module->rev[0].date, value) < 0) {
- memcpy(retval->date, module->rev[0].date, LY_REV_SIZE);
+ memcpy(retval, &module->rev[0], sizeof *retval);
+ memset(&module->rev[0], 0, sizeof *retval);
memcpy(module->rev[0].date, value, LY_REV_SIZE);
- retval->dsc = module->rev[0].dsc;
- retval->ref = module->rev[0].ref;
retval = module->rev;
- retval->dsc = NULL;
- retval->ref = NULL;
} else {
memcpy(retval->date, value, LY_REV_SIZE);
}
free(value);
+ return retval;
}
int
@@ -2111,6 +2109,11 @@
size = &((struct lys_include *)node)->ext_size;
parent_type = LYEXT_PAR_INCLUDE;
break;
+ case REVISION_KEYWORD:
+ ext = &((struct lys_revision *)node)->ext;
+ size = &((struct lys_revision *)node)->ext_size;
+ parent_type = LYEXT_PAR_REVISION;
+ break;
default:
LOGINT;
return NULL;
@@ -2166,6 +2169,12 @@
case REFERENCE_KEYWORD:
instance->substmt = LYEXT_SUBSTMT_REFERENCE;
break;
+ case CONTACT_KEYWORD:
+ instance->substmt = LYEXT_SUBSTMT_CONTACT;
+ break;
+ case ORGANIZATION_KEYWORD:
+ instance->substmt = LYEXT_SUBSTMT_ORGANIZATION;
+ break;
default:
LOGINT;
return NULL;
@@ -3985,6 +3994,13 @@
goto error;
}
+ /* check extension in revision */
+ for (i = 0; i < module->rev_size; ++i) {
+ if (yang_check_ext_instance(module, &module->rev[i].ext, module->rev[i].ext_size, &module->rev[i], unres)) {
+ goto error;
+ }
+ }
+
if (yang_check_typedef(module, NULL, unres)) {
goto error;
}