mirror of
https://github.com/GothenburgBitFactory/taskwarrior.git
synced 2025-08-28 22:47:20 +02:00
Lexer: readWords for quoted strings now retains the quotes
This commit is contained in:
parent
1fed8c55f1
commit
e6c4f48a48
2 changed files with 15 additions and 14 deletions
|
@ -1237,26 +1237,27 @@ bool Lexer::isOneWord (const std::string& text)
|
|||
// "'"
|
||||
// "\""
|
||||
// 'one two'
|
||||
// Result includes the quotes.
|
||||
bool Lexer::readWord (
|
||||
const std::string& text,
|
||||
const std::string& quotes,
|
||||
std::string::size_type& cursor,
|
||||
std::string& word)
|
||||
{
|
||||
if (quotes.find (text[cursor]) == std::string::npos)
|
||||
return false;
|
||||
|
||||
std::string::size_type eos = text.length ();
|
||||
int quote = text[cursor++];
|
||||
word = quote;
|
||||
|
||||
int quote = 0;
|
||||
if (quotes.find (text[cursor]) != std::string::npos)
|
||||
quote = text[cursor++];
|
||||
|
||||
word = "";
|
||||
int c;
|
||||
while ((c = text[cursor]))
|
||||
{
|
||||
// Quoted word ends on a quote.
|
||||
if (quote && quote == c)
|
||||
{
|
||||
++cursor;
|
||||
word += utf8_character (utf8_next_char (text, cursor));
|
||||
break;
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue