From 87dfa67b5ac95e1f41cb2be3507cc47da26caef0 Mon Sep 17 00:00:00 2001 From: Andreas Stöckel Date: Mon, 13 Apr 2015 01:30:57 +0200 Subject: Adapt isNamespacededIdentifier to most recent identifier format --- src/core/common/Utils.cpp | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'src/core/common/Utils.cpp') diff --git a/src/core/common/Utils.cpp b/src/core/common/Utils.cpp index 67920c2..f665db5 100644 --- a/src/core/common/Utils.cpp +++ b/src/core/common/Utils.cpp @@ -47,16 +47,18 @@ bool Utils::isIdentifierOrEmpty(const std::string &name) bool Utils::isNamespacedIdentifier(const std::string &name) { bool first = true; - for (char c : name) { + for (size_t i = 0; i < name.size(); i++) { + const char c = name[i]; if (first && !isIdentifierStartCharacter(c)) { return false; } - if (!first && (!isIdentifierCharacter(c) && c != ':')) { + if (!first && (!(isIdentifierCharacter(c) || c == ':') || + (c == ':' && !isIdentifierEndCharacter(name[i - 1])))) { return false; } first = (c == ':'); } - return !first; + return !first && isIdentifierEndCharacter(name.back()); } bool Utils::hasNonWhitepaceChar(const std::string &s) -- cgit v1.2.3