From 3899cd3c8fb3eccb73a43208e90d88cfcc64c41c Mon Sep 17 00:00:00 2001 From: Andreas Stöckel Date: Fri, 3 Apr 2015 22:24:35 +0200 Subject: Identifiers may not end with an underscore --- src/core/common/Utils.cpp | 4 ++-- src/core/common/Utils.hpp | 8 ++++++++ 2 files changed, 10 insertions(+), 2 deletions(-) (limited to 'src/core') diff --git a/src/core/common/Utils.cpp b/src/core/common/Utils.cpp index a87ff6d..67920c2 100644 --- a/src/core/common/Utils.cpp +++ b/src/core/common/Utils.cpp @@ -36,7 +36,7 @@ bool Utils::isIdentifier(const std::string &name) } first = false; } - return !first; + return !first && isIdentifierEndCharacter(name.back()); } bool Utils::isIdentifierOrEmpty(const std::string &name) @@ -150,4 +150,4 @@ bool Utils::isUserDefinedToken(const std::string &token) } return false; } -} \ No newline at end of file +} diff --git a/src/core/common/Utils.hpp b/src/core/common/Utils.hpp index d9e26da..c3b49a0 100644 --- a/src/core/common/Utils.hpp +++ b/src/core/common/Utils.hpp @@ -65,6 +65,14 @@ public: return isAlphabetic(c); } + /** + * Returns true if the given character is in [A-Za-z0-9]. + */ + static bool isIdentifierEndCharacter(const char c) + { + return isAlphanumeric(c); + } + /** * Returns true if the given character is in [A-Za-z0-9_-]. */ -- cgit v1.2.3