NumericEvaluator: return false for invalid expressions

Clearing bClError flag in NumericEvaluator::parseOk() made the
expression look valid, even if the flag has been set for a previous
token. Now it is cleared before an expression is parsed and verified
after parser finishes.

Fixes: lp:1756995
* https://bugs.launchpad.net/kicad/+bug/1756995
This commit is contained in:
Maciej Suminski 2018-03-21 17:08:54 +01:00
parent 7b4a8d7eb5
commit dfd2a8fc48
1 changed files with 2 additions and 1 deletions

View File

@ -121,7 +121,6 @@ NumericEvaluator :: parseError(const char* s)
void
NumericEvaluator :: parseOk()
{
bClError = false;
bClParseFinished = true;
}
@ -150,6 +149,7 @@ NumericEvaluator :: process(const char* s)
newString(s);
if (pClParser == nullptr) init();
bClError = false;
bClParseFinished = false;
Token tok;
@ -320,6 +320,7 @@ NumericEvaluator :: getToken()
case ')' : retval.token = PARENR; break;
case '=' : retval.token = ASSIGN; break;
case ';' : retval.token = SEMCOL; break;
default: bClError = true; break; /* invalid character */
}
clToken.pos++;
}