From bac75f1c7aa9e7d1a2e1a1a7c5db02b2dabefc44 Mon Sep 17 00:00:00 2001 From: John Firebaugh Date: Mon, 12 Jan 2015 10:17:01 -0800 Subject: [PATCH] Allow characters outside \w to be used in token https://github.com/mapbox/mapbox-gl-js/pull/926 --- src/mbgl/util/token.hpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/mbgl/util/token.hpp b/src/mbgl/util/token.hpp index 64192a99f..455190aab 100644 --- a/src/mbgl/util/token.hpp +++ b/src/mbgl/util/token.hpp @@ -8,6 +8,8 @@ namespace mbgl { namespace util { +const static std::string tokenReservedChars = "{}()[]<>$=:;.,^"; + // Replaces {tokens} in a string by calling the lookup function. template std::string replaceTokens(const std::string &source, const Lookup &lookup) { @@ -22,7 +24,7 @@ std::string replaceTokens(const std::string &source, const Lookup &lookup) { result.append(pos, brace); pos = brace; if (pos != end) { - for (brace++; brace != end && (std::isalnum(*brace) || *brace == '_'); brace++); + for (brace++; brace != end && tokenReservedChars.find(*brace) == std::string::npos; brace++); if (brace != end && *brace == '}') { result.append(lookup({ pos + 1, brace })); pos = brace + 1;