diff options
author | Andreas Stöckel <astoecke@techfak.uni-bielefeld.de> | 2015-03-02 18:09:11 +0100 |
---|---|---|
committer | Andreas Stöckel <andreas@somweyr.de> | 2015-03-02 18:09:11 +0100 |
commit | 6f85642ed2a76701dc1811aaa0616180ac01a9fa (patch) | |
tree | 958a792585829c0caefd0522eb34e95da8c74ff2 /src/core/common/Utils.cpp | |
parent | 3cc6ebf406c53b0c82a52f0daf1ce14c62f7b521 (diff) | |
parent | 24c7a8d1e62dc52298ea1abdc8b44d70fff94b54 (diff) |
Merge branch 'astoecke_tokens' of ssh://somweyr.de/var/local/git/ousia into astoecke_tokens
Conflicts:
application/src/core/parser/stack/Handler.hpp
Diffstat (limited to 'src/core/common/Utils.cpp')
-rw-r--r-- | src/core/common/Utils.cpp | 15 |
1 files changed, 11 insertions, 4 deletions
diff --git a/src/core/common/Utils.cpp b/src/core/common/Utils.cpp index 219b437..a87ff6d 100644 --- a/src/core/common/Utils.cpp +++ b/src/core/common/Utils.cpp @@ -124,7 +124,8 @@ bool Utils::isUserDefinedToken(const std::string &token) // Make sure the token meets is neither empty, nor starts or ends with an // alphanumeric character const size_t len = token.size(); - if (len == 0 || isAlphanumeric(token[0]) || isAlphanumeric(token[len - 1])) { + if (len == 0 || isAlphanumeric(token[0]) || + isAlphanumeric(token[len - 1])) { return false; } @@ -134,13 +135,19 @@ bool Utils::isUserDefinedToken(const std::string &token) return false; } + // Make sure the token does not contain any whitespaces. + for (char c : token) { + if (isWhitespace(c)) { + return false; + } + } + // Make sure the token contains other characters but { and } - for (char c: token) { + for (char c : token) { if (c != '{' && c != '}') { return true; } } return false; } -} - +}
\ No newline at end of file |