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
This commit is contained in:
Kurtis Rader 2017-07-18 20:50:54 -07:00
parent ed38db3370
commit 5e2c14e7be

View File

@ -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;
}