diff options
author | Benji Dial <benji@benjidial.net> | 2023-05-30 14:02:35 -0400 |
---|---|---|
committer | Benji Dial <benji@benjidial.net> | 2023-05-30 14:02:35 -0400 |
commit | d97c1a6497cc41c30edb6d5322a6deac56fd2293 (patch) | |
tree | 07920c6b83e687b75b268db44937f5fa362febd0 /tabulator-mpi/main.cpp | |
parent | 6678dccccdfffb9c40f64a828fd769c53bb2d29f (diff) | |
download | lib94-d97c1a6497cc41c30edb6d5322a6deac56fd2293.tar.gz |
rewrite compiler, add for/rof support
Diffstat (limited to 'tabulator-mpi/main.cpp')
-rw-r--r-- | tabulator-mpi/main.cpp | 10 |
1 files changed, 5 insertions, 5 deletions
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<char>(stream), {}); - auto w = lib94::compile_warrior(source); + try { + return lib94::compile_warrior(source); + } - if (std::holds_alternative<std::string>(w)) { - fprintf(stderr, "error compiling %s: %s\n", file, std::get<std::string>(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<lib94::warrior *>(w); } int main(int argc, char **argv) { |