From d97c1a6497cc41c30edb6d5322a6deac56fd2293 Mon Sep 17 00:00:00 2001 From: Benji Dial Date: Tue, 30 May 2023 14:02:35 -0400 Subject: rewrite compiler, add for/rof support --- tabulator-mpi/main.cpp | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'tabulator-mpi') diff --git a/tabulator-mpi/main.cpp b/tabulator-mpi/main.cpp index f76ed70..959cd8c 100644 --- a/tabulator-mpi/main.cpp +++ b/tabulator-mpi/main.cpp @@ -16,14 +16,14 @@ const lib94::warrior *load_warrior(const char *file) { std::string source(std::istreambuf_iterator(stream), {}); - auto w = lib94::compile_warrior(source); + try { + return lib94::compile_warrior(source); + } - if (std::holds_alternative(w)) { - fprintf(stderr, "error compiling %s: %s\n", file, std::get(w).c_str()); + catch (const lib94::compiler_exception &ex) { + fprintf(stderr, "error in %s on line %u: %s\n", file, ex.line_number, ex.message.c_str()); exit(1); } - - return std::get(w); } int main(int argc, char **argv) { -- cgit v1.2.3