diff options
| author | Andreas Stöckel <astoecke@techfak.uni-bielefeld.de> | 2015-04-13 01:30:57 +0200 | 
|---|---|---|
| committer | Andreas Stöckel <astoecke@techfak.uni-bielefeld.de> | 2016-04-25 22:24:17 +0200 | 
| commit | 87dfa67b5ac95e1f41cb2be3507cc47da26caef0 (patch) | |
| tree | 19f4ec85e46a6741a48cc69c32e4622bb631b86c /src | |
| parent | 57b738e0008ca7ba0a6cf17d746a3ea2e389d20b (diff) | |
Adapt isNamespacededIdentifier to most recent identifier format
Diffstat (limited to 'src')
| -rw-r--r-- | src/core/common/Utils.cpp | 8 | ||||
| -rw-r--r-- | src/core/common/Utils.hpp | 3 | 
2 files changed, 7 insertions, 4 deletions
| 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) diff --git a/src/core/common/Utils.hpp b/src/core/common/Utils.hpp index c3b49a0..16bc5a1 100644 --- a/src/core/common/Utils.hpp +++ b/src/core/common/Utils.hpp @@ -101,7 +101,8 @@ public:  	/**  	 * Returns true if the given string is in  	 * \code{.txt} -	 * ([A-Za-z][A-Za-z0-9_-]*)(:[A-Za-z][A-Za-z0-9_-]*)* +	 * ([A-Za-z]([A-Za-z0-9_-][A-Za-z0-9])?) +	 * (:[A-Za-z]([A-Za-z0-9_-][A-Za-z0-9])?)*  	 * \endCode  	 *  	 * @param name is the string that should be tested. | 
