data parsers CHANGE refactor data type resolving

avoid code duplication and fix resolving leafrefs and unions. There
were some complex use cases where the leafrefs were not correctly
resolved because of incorrect value conversion into the target data
type.

Fixes #174
diff --git a/src/parser.h b/src/parser.h
index 6bfb0f8..5dbde36 100644
--- a/src/parser.h
+++ b/src/parser.h
@@ -62,9 +62,9 @@
 
 struct lys_type *lyp_get_next_union_type(struct lys_type *type, struct lys_type *prev_type, int *found);
 
-int lyp_parse_value(struct lyd_node_leaf_list *leaf, struct lyxml_elem *xml, int resolve, int dflt);
-int lyp_parse_value_type(struct lyd_node_leaf_list *node, struct lys_type *stype, struct lyxml_elem *xml, int resolve,
-                         int dflt);
+struct lys_type *lyp_parse_value(struct lys_type *type, const char **value_, struct lyxml_elem *xml,
+                                         struct lyd_node *tree, struct lyd_node_leaf_list *leaf, int resolvable,
+                                         int dflt);
 
 int lyp_check_length_range(const char *expr, struct lys_type *type);