Fix bug in command parsing post refactoring

Fixes #1857
This commit is contained in:
Maxime Coste 2018-02-19 08:29:04 +11:00
parent fc60e29870
commit 76f5fb937c

View File

@ -297,6 +297,7 @@ Optional<Token> CommandParser::read_token(bool throw_on_unterminated)
String token = get_until_delimiter(m_reader, c);
if (throw_on_unterminated and not m_reader)
throw parse_error{format("unterminated string {0}...{0}", c)};
if (m_reader)
++m_reader;
return Token{c == '"' ? Token::Type::RawEval
: Token::Type::RawQuoted,
@ -305,6 +306,7 @@ Optional<Token> CommandParser::read_token(bool throw_on_unterminated)
else if (c == '%')
{
auto token = parse_percent_token(m_reader, throw_on_unterminated);
if (m_reader)
++m_reader;
return token;
}
@ -604,7 +606,7 @@ Completions CommandManager::complete(const Context& context,
case Token::Type::RawQuoted:
case Token::Type::RawEval:
{
if (token.type != Token::Type::Raw)
if (token.type != Token::Type::Raw and token.type != Token::Type::RawQuoted)
return Completions{};
StringView command_name = tokens.front().content;