Build the parser's syntax error prefix with one concat() (#6013)
Since #6004 made the "while parsing" part unconditional, the three appends at the start of exception_message() are one fixed string around the context. Review follow-up to #6004. Signed-off-by: Niels Lohmann <mail@nlohmann.me>
This commit is contained in:
1 parent
6d5581c4e8
commit
b18b6fc7e6
2 files changed
+2
-10
No files matched your search
@@ -573,11 +573,7 @@ class parser
|
|||||||
|
|
||||||
std::string exception_message(const token_type expected, const std::string& context)
|
std::string exception_message(const token_type expected, const std::string& context)
|
||||||
{
|
{
|
||||||
std::string error_msg = "syntax error ";
|
std::string error_msg = concat("syntax error while parsing ", context, " - ");
|
||||||
|
|
||||||
error_msg += concat("while parsing ", context, ' ');
|
|
||||||
|
|
||||||
error_msg += "- ";
|
|
||||||
|
|
||||||
if (last_token == token_type::parse_error)
|
if (last_token == token_type::parse_error)
|
||||||
{
|
{
|
||||||
|
|||||||
Generated
+1
-5
@@ -23802,11 +23802,7 @@ class parser
|
|||||||
|
|
||||||
std::string exception_message(const token_type expected, const std::string& context)
|
std::string exception_message(const token_type expected, const std::string& context)
|
||||||
{
|
{
|
||||||
std::string error_msg = "syntax error ";
|
std::string error_msg = concat("syntax error while parsing ", context, " - ");
|
||||||
|
|
||||||
error_msg += concat("while parsing ", context, ' ');
|
|
||||||
|
|
||||||
error_msg += "- ";
|
|
||||||
|
|
||||||
if (last_token == token_type::parse_error)
|
if (last_token == token_type::parse_error)
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in new issue
Block a user