From b04364cdbc2144661a28f78e0aa4e5e337254c50 Mon Sep 17 00:00:00 2001 From: Andreas Stöckel Date: Sun, 15 Feb 2015 00:10:16 +0100 Subject: Added isNamespacedIdentifier method to Utils --- src/core/common/Utils.cpp | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 'src/core/common/Utils.cpp') diff --git a/src/core/common/Utils.cpp b/src/core/common/Utils.cpp index 3739c61..fc8ee00 100644 --- a/src/core/common/Utils.cpp +++ b/src/core/common/Utils.cpp @@ -40,6 +40,21 @@ bool Utils::isIdentifier(const std::string &name) return true; } +bool Utils::isNamespaceIdentifier(const std::string &name) +{ + bool first = true; + for (char c : name) { + if (first && !isIdentifierStartCharacter(c)) { + return false; + } + if (!first && (!isIdentifierCharacter(c) || c == ':')) { + return false; + } + first = (c == ':'); + } + return true; +} + bool Utils::hasNonWhitepaceChar(const std::string &s) { for (char c : s) { -- cgit v1.2.3