Do not allow whitespaces as % string delimiters

This commit is contained in:
Maxime Coste 2017-06-07 13:09:45 +01:00
parent 81118552c8
commit a0d848da8d

View File

@ -210,11 +210,13 @@ Token parse_percent_token(Reader& reader)
++reader;
StringView type_name = reader.substr_from(type_start);
if (throw_on_unterminated and not reader)
if (not reader or is_blank(*reader))
{
if (throw_on_unterminated)
throw parse_error{format("expected a string delimiter after '%{}'",
type_name)};
else if (not reader)
return {};
}
Token::Type type = token_type<throw_on_unterminated>(type_name);