FEATURE patterns evaluation support

Includes yangre(1) tool and support for parsing and validating string value
including evaluation of their restrictions.
diff --git a/src/tree_data_helpers.c b/src/tree_data_helpers.c
index 3f385a2..fb9c3da 100644
--- a/src/tree_data_helpers.c
+++ b/src/tree_data_helpers.c
@@ -84,14 +84,14 @@
 }
 
 LY_ERR
-lyd_value_validate(struct lyd_node_term *node, const char *value, size_t value_len, int options)
+lyd_value_parse(struct lyd_node_term *node, const char *value, size_t value_len, int dynamic)
 {
     LY_ERR ret = LY_SUCCESS;
     struct ly_err_item *err = NULL;
     struct ly_ctx *ctx;
     struct lysc_type *type;
     void *priv = NULL;
-
+    int options = LY_TYPE_OPTS_VALIDATE | LY_TYPE_OPTS_CANONIZE | LY_TYPE_OPTS_STORE | (dynamic ? LY_TYPE_OPTS_DYNAMIC : 0);
     assert(node);
 
     ctx = node->schema->module->ctx;
@@ -104,11 +104,13 @@
             ly_err_free(err);
             goto error;
         }
-    } else if (options & LY_TYPE_OPTS_CANONIZE) {
+    } else if (dynamic) {
+        node->value.canonized = lydict_insert_zc(ctx, (char*)value);
+    } else {
         node->value.canonized = lydict_insert(ctx, value, value_len);
     }
 
-    if ((options & LY_TYPE_OPTS_STORE) && type->plugin->store) {
+    if (type->plugin->store) {
         ret = type->plugin->store(ctx, type, options, &node->value, &err, &priv);
         if (ret) {
             ly_err_print(err);