summaryrefslogtreecommitdiff
path: root/Source/cmExprParserHelper.cxx
diff options
context:
space:
mode:
Diffstat (limited to 'Source/cmExprParserHelper.cxx')
-rw-r--r--Source/cmExprParserHelper.cxx16
1 files changed, 7 insertions, 9 deletions
diff --git a/Source/cmExprParserHelper.cxx b/Source/cmExprParserHelper.cxx
index 80c78a38c..56dfc6c1d 100644
--- a/Source/cmExprParserHelper.cxx
+++ b/Source/cmExprParserHelper.cxx
@@ -2,13 +2,14 @@
file Copyright.txt or https://cmake.org/licensing for details. */
#include "cmExprParserHelper.h"
-#include "cmExprLexer.h"
-
#include <iostream>
#include <sstream>
#include <stdexcept>
#include <utility>
+#include "cmExprLexer.h"
+#include "cmStringAlgorithms.h"
+
int cmExpr_yyparse(yyscan_t yyscanner);
//
cmExprParserHelper::cmExprParserHelper()
@@ -41,16 +42,13 @@ int cmExprParserHelper::ParseString(const char* str, int verb)
try {
int res = cmExpr_yyparse(yyscanner);
if (res != 0) {
- std::string e = "cannot parse the expression: \"" + InputBuffer + "\": ";
- e += ErrorString;
- e += ".";
+ std::string e = cmStrCat("cannot parse the expression: \"", InputBuffer,
+ "\": ", ErrorString, '.');
this->SetError(std::move(e));
}
} catch (std::runtime_error const& fail) {
- std::string e =
- "cannot evaluate the expression: \"" + InputBuffer + "\": ";
- e += fail.what();
- e += ".";
+ std::string e = cmStrCat("cannot evaluate the expression: \"", InputBuffer,
+ "\": ", fail.what(), '.');
this->SetError(std::move(e));
} catch (std::out_of_range const&) {
std::string e = "cannot evaluate the expression: \"" + InputBuffer +