parser: add mmap and string parser
[m6w6/ext-psi] / src / context.c
index 3ac26c70d81e100dfb856f304a90ebb4c90f7d4c..1090e98f83ac830115e72d6540566eccbda0ea9d 100644 (file)
@@ -250,11 +250,16 @@ void psi_context_build(struct psi_context *C, const char *paths)
                                        C->error(PSI_DATA(C), NULL, PSI_WARNING, "Path to PSI file too long: %s/%s",
                                                ptr, entries[i]->d_name);
                                }
                                        C->error(PSI_DATA(C), NULL, PSI_WARNING, "Path to PSI file too long: %s/%s",
                                                ptr, entries[i]->d_name);
                                }
-                               if (!psi_parser_init(&P, psi, C->error, C->flags)) {
+                               if (!psi_parser_init(&P, C->error, C->flags)) {
                                        C->error(PSI_DATA(C), NULL, PSI_WARNING, "Failed to init PSI parser (%s): %s",
                                                psi, strerror(errno));
                                        continue;
                                }
                                        C->error(PSI_DATA(C), NULL, PSI_WARNING, "Failed to init PSI parser (%s): %s",
                                                psi, strerror(errno));
                                        continue;
                                }
+                               if (!psi_parser_open_file(&P, psi)) {
+                                       C->error(PSI_DATA(C), NULL, PSI_WARNING, "Failed to open PSI file (%s): %s",
+                                               psi, strerror(errno));
+                                       continue;
+                               }
 
                                while (0 < psi_parser_scan(&P)) {
                                        psi_parser_parse(&P, psi_token_alloc(&P));
 
                                while (0 < psi_parser_scan(&P)) {
                                        psi_parser_parse(&P, psi_token_alloc(&P));