schema parsers BUGFIX checking default values

Default values of leafs/leaf-lists are supposed to be checked only in data tree,
not inside a grouping. Default values defined in typedefs are checked even in
typedefs inside groupings with exception of leafrefs where we might not have the
target leaf.

Fixes #279
diff --git a/src/parser_yin.c b/src/parser_yin.c
index e7fe6c4..5614f94 100644
--- a/src/parser_yin.c
+++ b/src/parser_yin.c
@@ -1601,7 +1601,7 @@
 
     /* check default value (if not defined, there still could be some restrictions
      * that need to be checked against a default value from a derived type) */
-    if (unres_schema_add_node(module, unres, &tpdf->type, UNRES_TYPE_DFLT, (struct lys_node *)(&tpdf->dflt)) == -1) {
+    if (unres_schema_add_node(module, unres, &tpdf->type, UNRES_TYPEDEF_DFLT, (struct lys_node *)(&tpdf->dflt)) == -1) {
         goto error;
     }
 
@@ -4663,7 +4663,9 @@
 
     /* check default value (if not defined, there still could be some restrictions
      * that need to be checked against a default value from a derived type) */
-    if (unres_schema_add_node(module, unres, &leaf->type, UNRES_TYPE_DFLT, (struct lys_node *)(&leaf->dflt)) == -1) {
+    if (!(options & LYS_PARSE_OPT_INGRP) &&
+            (unres_schema_add_node(module, unres, &leaf->type, UNRES_TYPE_DFLT,
+                                   (struct lys_node *)(&leaf->dflt)) == -1)) {
         goto error;
     }
 
@@ -4969,8 +4971,9 @@
     /* check default value (if not defined, there still could be some restrictions
      * that need to be checked against a default value from a derived type) */
     for (r = 0; r < llist->dflt_size; r++) {
-        if (unres_schema_add_node(module, unres, &llist->type, UNRES_TYPE_DFLT,
-                                  (struct lys_node *)(&llist->dflt[r])) == -1) {
+        if (!(options & LYS_PARSE_OPT_INGRP) &&
+                (unres_schema_add_node(module, unres, &llist->type, UNRES_TYPE_DFLT,
+                                       (struct lys_node *)(&llist->dflt[r])) == -1)) {
             goto error;
         }
     }