yin parser: FEATURE: support submodules (via include statement)
includes some refactoring and renaming since submodules are very
similar to modules and it was needed to differentiate between them.
diff --git a/src/printer/yang.c b/src/printer/yang.c
index 087fc07..869f43d 100644
--- a/src/printer/yang.c
+++ b/src/printer/yang.c
@@ -353,6 +353,18 @@
fprintf(f, "%*s}\n", LEVEL, INDENT);
}
+ for (i = 0; i < module->inc_size; i++) {
+ if (module->inc[i].rev[0]) {
+ fprintf(f, "%*sinclude \"%s\" {\n", LEVEL, INDENT,
+ module->inc[i].submodule->name);
+ yang_print_text(f, level + 1, "revision-date", module->imp[i].rev);
+ fprintf(f, "%*s}\n", LEVEL, INDENT);
+ } else {
+ fprintf(f, "%*sinclude \"%s\";\n", LEVEL, INDENT,
+ module->inc[i].submodule->name);
+ }
+ }
+
if (module->org) {
yang_print_text(f, level, "organization", module->org);
}