From 334a2a0727a71aa4c4cf953a4689cd22cf943ff6 Mon Sep 17 00:00:00 2001 From: Clyne Sullivan Date: Mon, 30 Dec 2024 15:08:49 -0500 Subject: finish exceptionless impl; fix sp@ and pick --- main.cpp | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) (limited to 'main.cpp') diff --git a/main.cpp b/main.cpp index e51f702..697f2d2 100644 --- a/main.cpp +++ b/main.cpp @@ -23,7 +23,7 @@ #include #include -constinit static sforth::forth<4096> forth {sforth::initialize<&forth>()}; +constinit static sforth::forth<8192> forth {sforth::initialize<&forth>()}; static bool parse_stream(auto&, std::istream&, bool say_okay = false); @@ -71,11 +71,18 @@ bool parse_stream(auto &fth, std::istream& str, bool say_okay) if (sforth::isequal(line, "bye")) return true; - try { - fth.parse_line(line); - } catch (sforth::error e) { - std::cerr << sforth::error_string(e) << " in " << line << std::endl; - continue; + if constexpr (sforth::enable_exceptions) { + try { + fth.parse_line(line); + } catch (sforth::error e) { + std::cerr << sforth::error_string(e) << " in " << line << std::endl; + continue; + } + } else { + if (auto e = fth.parse_line(line); e) { + std::cerr << sforth::error_string(*e) << " in " << line << std::endl; + continue; + } } } -- cgit v1.2.3