summaryrefslogtreecommitdiff
path: root/yy/main.c
diff options
context:
space:
mode:
Diffstat (limited to 'yy/main.c')
-rw-r--r--yy/main.c19
1 files changed, 3 insertions, 16 deletions
diff --git a/yy/main.c b/yy/main.c
index 5bc5508..52058d3 100644
--- a/yy/main.c
+++ b/yy/main.c
@@ -50,23 +50,10 @@ int main(int argc, char **argv)
fprintf(stderr, "You must specify a file to parse!\n");
return -1;
}
- FILE *in = fopen(argv[1], "r");
- if (in == NULL) {
- fprintf(stderr, "Could not open file \"%s\"\n", argv[1]);
- return -1;
- }
-
- struct kai_tag_t *document;
- yyscan_t scanner;
- kalmialex_init(&scanner);
- kalmiaset_in(in, scanner);
- int result = kalmiaparse(scanner, &document);
- kalmialex_destroy(scanner);
- fclose(in);
-
- if (result != 0) {
- return result;
+ struct kai_tag_t *document = kai_parse_file(argv[1]);
+ if (document == NULL) {
+ return -1;
}
print_tag("", document);