From 5e2c14e7be2c603330caa1ede0c4fe754b6a559d Mon Sep 17 00:00:00 2001 From: Kurtis Rader Date: Tue, 18 Jul 2017 20:50:54 -0700 Subject: [PATCH] fix a regression involving parser error output The code for reporting parser errors needs a major overhaul. But rather than do that I'm going to add another hack in the hope that this doesn't introduce yet another problem. Fixes #4221 --- src/parse_tree.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/parse_tree.cpp b/src/parse_tree.cpp index 792229475..f2ebe1303 100644 --- a/src/parse_tree.cpp +++ b/src/parse_tree.cpp @@ -29,9 +29,10 @@ static bool production_is_empty(const production_element_t *production) { /// Returns a string description of this parse error. wcstring parse_error_t::describe_with_prefix(const wcstring &src, const wcstring &prefix, bool is_interactive, bool skip_caret) const { + if (skip_caret && this->text.empty()) return L""; + wcstring result = prefix; result.append(this->text); - if (skip_caret || source_start >= src.size() || source_start + source_length > src.size()) { return result; }