diff options
Diffstat (limited to 'yy/main.c')
-rw-r--r-- | yy/main.c | 19 |
1 files changed, 3 insertions, 16 deletions
@@ -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); |