mirror of
https://github.com/fish-shell/fish-shell
synced 2024-12-25 20:33:08 +00:00
parent
4fde67fa50
commit
65c762f1e1
2 changed files with 6 additions and 8 deletions
|
@ -29,13 +29,13 @@ 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 || source_start >= src.size() || source_start + source_length > src.size()) {
|
||||
return L"";
|
||||
}
|
||||
|
||||
wcstring result = prefix;
|
||||
result.append(this->text);
|
||||
|
||||
if (skip_caret || source_start >= src.size() || source_start + source_length > src.size()) {
|
||||
return result;
|
||||
}
|
||||
|
||||
// Locate the beginning of this line of source.
|
||||
size_t line_start = 0;
|
||||
|
||||
|
@ -64,15 +64,12 @@ wcstring parse_error_t::describe_with_prefix(const wcstring &src, const wcstring
|
|||
// Don't include the caret and line if we're interactive this is the first line, because
|
||||
// then it's obvious.
|
||||
bool interactive_skip_caret = is_interactive && source_start == 0;
|
||||
|
||||
if (interactive_skip_caret) {
|
||||
return result;
|
||||
}
|
||||
|
||||
// Append the line of text.
|
||||
if (!result.empty()) {
|
||||
result.push_back(L'\n');
|
||||
}
|
||||
result.push_back(L'\n');
|
||||
result.append(src, line_start, line_end - line_start);
|
||||
|
||||
// Append the caret line. The input source may include tabs; for that reason we
|
||||
|
|
|
@ -3,6 +3,7 @@
|
|||
#define FISH_PARSER_H
|
||||
|
||||
#include <stddef.h>
|
||||
#include <unistd.h>
|
||||
|
||||
#include <csignal>
|
||||
#include <list>
|
||||
|
|
Loading…
Reference in a new issue