/** ** \file parse/tasks.cc ** \brief Parse module related tasks' implementation. **/ #include #include #include #include #include #include #include #include #include #define DEFINE_TASKS 1 #include #undef DEFINE_TASKS namespace parse::tasks { const char* tc_pkgdatadir = getenv("TC_PKGDATADIR"); misc::file_library l = misc::file_library(tc_pkgdatadir ? tc_pkgdatadir : PKGDATADIR); void no_prelude() { prelude = ""; } void parse() { precondition(filename != nullptr); bool scan_trace = scan_trace_p || getenv("SCAN"); bool parse_trace = parse_trace_p || getenv("PARSE"); std::pair result = ::parse::parse(prelude, filename, l, scan_trace, parse_trace, object::tasks::enable_object_extensions_p, assert::tasks::enable_assert_extensions_p); // If the parsing completely failed, stop. task_error() << result.second; if (!result.first) task_error().exit(); // FIXME DONE: Some code was deleted here (Set `the_program' to the result of parsing). ast::tasks::the_program = std::unique_ptr{result.first}; } void library_display() { std::cout << l << '\n'; } void library_append(const std::string& dir) { l.append_dir(dir); } void library_prepend(const std::string& dir) { l.prepend_dir(dir); } } // namespace parse::tasks