Command line parsing: support empty strings

This commit is contained in:
Maxime Coste 2012-12-15 17:47:50 +01:00
parent d208067589
commit b090465e80

View File

@ -110,6 +110,7 @@ TokenList parse(const String& line,
} }
ByteCount token_start = pos; ByteCount token_start = pos;
ByteCount start_pos = pos;
Token::Type type = Token::Type::Raw; Token::Type type = Token::Type::Raw;
if (line[pos] == '"' or line[pos] == '\'') if (line[pos] == '"' or line[pos] == '\'')
@ -184,7 +185,7 @@ TokenList parse(const String& line,
or (pos != 0 and line[pos-1] == '\\'))) or (pos != 0 and line[pos-1] == '\\')))
++pos; ++pos;
if (token_start != pos) if (start_pos != pos)
{ {
if (opt_token_pos_info) if (opt_token_pos_info)
opt_token_pos_info->push_back({token_start, pos}); opt_token_pos_info->push_back({token_start, pos});