diff options
author | sanine <sanine.not@pm.me> | 2023-02-01 00:16:08 -0600 |
---|---|---|
committer | sanine <sanine.not@pm.me> | 2023-02-01 00:16:08 -0600 |
commit | 0710a40e50d12cd731b0372d79d0ccdfbaee10d4 (patch) | |
tree | 271f9626d3eea71165bcfa6f515940e90a85f56c /yy/main.c | |
parent | eacf29f8342a4d759fa70b4d7217e86aa2fb4a15 (diff) |
add kalmia_parse_file()
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); |