summaryrefslogtreecommitdiff
path: root/yy/main.c
diff options
context:
space:
mode:
Diffstat (limited to 'yy/main.c')
-rw-r--r--yy/main.c15
1 files changed, 11 insertions, 4 deletions
diff --git a/yy/main.c b/yy/main.c
index 823db5a..5bc5508 100644
--- a/yy/main.c
+++ b/yy/main.c
@@ -56,16 +56,23 @@ int main(int argc, char **argv)
return -1;
}
- struct kalmia_t result;
+ struct kai_tag_t *document;
yyscan_t scanner;
kalmialex_init(&scanner);
kalmiaset_in(in, scanner);
- kalmiaparse(scanner, &result);
+ int result = kalmiaparse(scanner, &document);
kalmialex_destroy(scanner);
+ fclose(in);
- print_tag("", result.tag);
- print_level(1, result.tag->children);
+ if (result != 0) {
+ return result;
+ }
+
+ print_tag("", document);
+ print_level(1, document->children);
+
+ kai_tag_destroy(document);
return 0;
}