diff options
Diffstat (limited to 'main.cpp')
-rw-r--r-- | main.cpp | 14 |
1 files changed, 7 insertions, 7 deletions
@@ -37,10 +37,10 @@ constinit static sforth::native_word<".", [](auto) { if (neg) *--ptr = '-'; std::cout << ptr << ' '; }> dot; -constinit static sforth::native_word<"emit", [](auto) { +constinit static sforth::native_word<"EMIT", [](auto) { std::cout << static_cast<char>(forth.pop()); }, &dot> emit; -constinit static sforth::native_word<"type", [](auto) { +constinit static sforth::native_word<"TYPE", [](auto) { const unsigned u = forth.pop(); const auto caddr = reinterpret_cast<const char *>(forth.pop()); std::cout << std::string_view{caddr, u}; @@ -69,14 +69,14 @@ bool parse_stream(auto &fth, std::istream& str, bool say_okay) while (str.good()) { std::getline(str, line); if (!line.empty()) { - if (line == "bye") - return true; - for (auto& ch : line) { - if (ch >= 'A' && ch <= 'Z') - ch = ch - 'A' + 'a'; + if (ch >= 'a' && ch <= 'z') + ch = ch - 'a' + 'A'; } + if (line == "BYE") + return true; + try { fth.parse_line(line); } catch (sforth::error e) { |