From a97ca224f23b4101e44c099dbe29d1cc4a72c758 Mon Sep 17 00:00:00 2001 From: Li Jin Date: Thu, 26 Mar 2020 14:12:43 +0800 Subject: add REPL support for moonp. --- src/MoonP/moon_parser.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/MoonP') diff --git a/src/MoonP/moon_parser.cpp b/src/MoonP/moon_parser.cpp index 872e30e..58f8fb3 100644 --- a/src/MoonP/moon_parser.cpp +++ b/src/MoonP/moon_parser.cpp @@ -646,7 +646,7 @@ std::string ParseInfo::errorMessage(std::string_view msg, const input_range* loc int oldCol = loc->m_begin.m_col; int col = std::max(0, oldCol - 1); auto it = begin; - for (int i = 0; i < oldCol; ++i) { + for (int i = 0; i < oldCol && it != end; ++i) { if (*it > ASCII) { ++col; } -- cgit v1.2.3-55-g6feb