summaryrefslogtreecommitdiff
path: root/yy/main.c
diff options
context:
space:
mode:
authorsanine <sanine.not@pm.me>2023-02-01 00:16:08 -0600
committersanine <sanine.not@pm.me>2023-02-01 00:16:08 -0600
commit0710a40e50d12cd731b0372d79d0ccdfbaee10d4 (patch)
tree271f9626d3eea71165bcfa6f515940e90a85f56c /yy/main.c
parenteacf29f8342a4d759fa70b4d7217e86aa2fb4a15 (diff)
add kalmia_parse_file()
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);