make hex parser strict (expecting two characters after \x) to avoid greedy parsing of trailing characters as in
"\xF0\x9F\x8D\xB7abc" ==> ... + "\xB7" + "abc" not "\xB7abc"
This commit is contained in:
parent
87c619cdc2
commit
570126bd76
1 changed files with 3 additions and 3 deletions
|
@ -63,7 +63,7 @@ namespace mapnik { namespace grammar {
|
||||||
using x3::no_case;
|
using x3::no_case;
|
||||||
using x3::alpha;
|
using x3::alpha;
|
||||||
using x3::alnum;
|
using x3::alnum;
|
||||||
using x3::hex;
|
x3::uint_parser<char, 16, 2, 2> const hex2 {};
|
||||||
|
|
||||||
auto do_assign = [] (auto const& ctx)
|
auto do_assign = [] (auto const& ctx)
|
||||||
{
|
{
|
||||||
|
@ -302,8 +302,8 @@ namespace mapnik { namespace grammar {
|
||||||
x3::rule<class regex_replace_expression, std::pair<std::string,std::string> > const regex_replace_expression("regex replace expression");
|
x3::rule<class regex_replace_expression, std::pair<std::string,std::string> > const regex_replace_expression("regex replace expression");
|
||||||
|
|
||||||
// strings
|
// strings
|
||||||
auto const single_quoted_string = x3::rule<class single_quoted_string, std::string> {} = lit('\'') >> no_skip[*(unesc_char | ("\\x" > hex) | (char_ - '\''))] > '\'';
|
auto const single_quoted_string = x3::rule<class single_quoted_string, std::string> {} = lit('\'') >> no_skip[*(unesc_char | ("\\x" > hex2) | (char_ - '\''))] > '\'';
|
||||||
auto const double_quoted_string = x3::rule<class double_quoted_string, std::string> {} = lit('"') >> no_skip[*(unesc_char | ("\\x" > hex) | (char_ - '"'))] > '"';
|
auto const double_quoted_string = x3::rule<class double_quoted_string, std::string> {} = lit('"') >> no_skip[*(unesc_char | ("\\x" > hex2) | (char_ - '"'))] > '"';
|
||||||
auto const quoted_string = x3::rule<class quoted_string, std::string> {} = single_quoted_string | double_quoted_string;
|
auto const quoted_string = x3::rule<class quoted_string, std::string> {} = single_quoted_string | double_quoted_string;
|
||||||
|
|
||||||
auto const unquoted_ustring = x3::rule<class ustring, std::string> {} = no_skip[alpha > *alnum] - lit("not");
|
auto const unquoted_ustring = x3::rule<class ustring, std::string> {} = no_skip[alpha > *alnum] - lit("not");
|
||||||
|
|
Loading…
Reference in a new issue