GVariant parser: tweak lexer for format strings

Tweak the lexer so that '[%s]' gets parsed as three separate tokens,
instead of the closing bracket getting sucked into the format string.
This commit is contained in:
Ryan Lortie 2013-04-17 12:12:20 -04:00
parent 1d87c6c7f8
commit 57cd876321

View File

@ -223,10 +223,11 @@ token_stream_prepare (TokenStream *stream)
case '@': case '%':
/* stop at the first space, comma, colon or unmatched bracket.
* deals nicely with cases like (%i, %i) or {%i: %i}.
* Also: ] and > are never in format strings.
*/
for (end = stream->stream + 1;
end != stream->end && *end != ',' &&
*end != ':' && *end != '>' && !g_ascii_isspace (*end);
*end != ':' && *end != '>' && *end != ']' && !g_ascii_isspace (*end);
end++)
if (*end == '(' || *end == '{')