Skip to content

Commit

Permalink
[cpp] attempt to fix clang/gcc compile errors that dont reproduce on …
Browse files Browse the repository at this point in the history
…windows
  • Loading branch information
harrand committed May 15, 2024
1 parent ad86f7a commit 7083144
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion cpp/src/lex.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,8 @@ namespace lex
std::size_t snippet_begin = this->cursor > snippet_width ? (this->cursor - snippet_width) : 0;
std::size_t snippet_end = (this->cursor + snippet_width) >= this->source.size() ? this->source.size() : (this->cursor + snippet_width);
std::string_view snippet = this->source.substr(snippet_begin, snippet_end - snippet_begin);
diag::error(errcode, "at {}, {}", curloc.to_string(), std::vformat(msg, std::make_format_args(dodgy_part.substr(0, std::min(dodgy_part.size(), static_cast<std::size_t>(2u))), snippet)));
std::string_view dodgy_snippet = dodgy_part.substr(0, std::min(dodgy_part.size(), static_cast<std::size_t>(2u)));
diag::error(errcode, "at {}, {}", curloc.to_string(), std::vformat(msg, std::make_format_args(dodgy_snippet, snippet)));
}

void unrecognised_tokens(std::string_view dodgy_part)
Expand Down

0 comments on commit 7083144

Please sign in to comment.