* Prevent naming properties with reserved words (Fix #16846) * Prevent using reserved constant names for properties or aliases * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * App: Add unit test for isTokenAConstant --------- Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> Co-authored-by: Chris Hennes <chennes@pioneerlibrarysystem.org>
This commit is contained in:
@@ -3855,6 +3855,13 @@ bool ExpressionParser::isTokenAnIndentifier(const std::string & str)
|
||||
return (status == 0 && (token == IDENTIFIER || token == CELLADDRESS));
|
||||
}
|
||||
|
||||
bool ExpressionParser::isTokenAConstant(const std::string & str)
|
||||
{
|
||||
int token{}, status{};
|
||||
std::tie(token, status) = getTokenAndStatus(str);
|
||||
return (status == 0 && token == CONSTANT);
|
||||
}
|
||||
|
||||
bool ExpressionParser::isTokenAUnit(const std::string & str)
|
||||
{
|
||||
int token{}, status{};
|
||||
|
||||
@@ -500,6 +500,7 @@ AppExport Expression * parse(const App::DocumentObject *owner, const char *buffe
|
||||
AppExport UnitExpression * parseUnit(const App::DocumentObject *owner, const char *buffer);
|
||||
AppExport ObjectIdentifier parsePath(const App::DocumentObject *owner, const char* buffer);
|
||||
AppExport bool isTokenAnIndentifier(const std::string & str);
|
||||
AppExport bool isTokenAConstant(const std::string & str);
|
||||
AppExport bool isTokenAUnit(const std::string & str);
|
||||
AppExport std::vector<std::tuple<int, int, std::string> > tokenize(const std::string & str);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user