diff options
Diffstat (limited to 'main.cpp')
-rw-r--r-- | main.cpp | 19 |
1 files changed, 13 insertions, 6 deletions
@@ -23,7 +23,7 @@ #include <span> #include <string> -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; + } } } |