mirror of
https://github.com/Kitware/CMake.git
synced 2026-01-06 05:40:54 -06:00
math: Reject unexpected expression input explicitly
Switch to C++ exceptions for lexer/parser error handling. Teach the lexer/parser to fail on unexpected input.
This commit is contained in:
@@ -36,11 +36,11 @@ bool cmMathCommand::HandleExprCommand(std::vector<std::string> const& args)
|
||||
const std::string& outputVariable = args[1];
|
||||
const std::string& expression = args[2];
|
||||
|
||||
this->Makefile->AddDefinition(outputVariable, "ERROR");
|
||||
|
||||
cmExprParserHelper helper;
|
||||
if (!helper.ParseString(expression.c_str(), 0)) {
|
||||
std::string e = "cannot parse the expression: \"" + expression + "\": ";
|
||||
e += helper.GetError();
|
||||
this->SetError(e);
|
||||
this->SetError(helper.GetError());
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user