lyb FEATURE print/parse node flags

To allow completely transparent printing
and loading data.
diff --git a/src/parser_lyb.c b/src/parser_lyb.c
index 1076bdc..74519a7 100644
--- a/src/parser_lyb.c
+++ b/src/parser_lyb.c
@@ -685,7 +685,7 @@
     char *value = NULL, *name = NULL, *prefix = NULL, *module_key = NULL;
     ly_bool dynamic = 0;
     LYD_FORMAT format = 0;
-    uint32_t prev_lo;
+    uint32_t prev_lo, flags;
     const struct ly_ctx *ctx = lybctx->lybctx->ctx;
 
     /* register a new subtree */
@@ -720,6 +720,9 @@
         LY_CHECK_GOTO(ret, cleanup);
     }
 
+    /* read flags */
+    lyb_read_number(&flags, sizeof flags, sizeof flags, lybctx->lybctx);
+
     if (!snode) {
         /* parse prefix */
         ret = lyb_read_string(&prefix, 1, lybctx->lybctx);
@@ -836,10 +839,8 @@
     }
     assert(node);
 
-    /* add/correct flags */
-    if (snode) {
-        lyd_parse_set_data_flags(node, &lybctx->when_check, &meta, lybctx->parse_options);
-    }
+    /* set flags */
+    node->flags = flags;
 
     /* add metadata/attributes */
     if (snode) {
diff --git a/src/printer_lyb.c b/src/printer_lyb.c
index 860d5a0..df7a1c5 100644
--- a/src/printer_lyb.c
+++ b/src/printer_lyb.c
@@ -914,6 +914,9 @@
         LY_CHECK_RET(lyb_print_attributes(out, (struct lyd_node_opaq *)node, lybctx->lybctx));
     }
 
+    /* write node flags */
+    LY_CHECK_RET(lyb_write_number(node->flags, sizeof node->flags, out, lybctx->lybctx));
+
     /* write node content */
     if (!node->schema) {
         LY_CHECK_RET(lyb_print_opaq((struct lyd_node_opaq *)node, out, lybctx->lybctx));