Lexer: readWords for quoted strings now retains the quotes

This commit is contained in:
Paul Beckingham 2015-07-08 09:03:48 -04:00
parent 1fed8c55f1
commit e6c4f48a48
2 changed files with 15 additions and 14 deletions

View file

@ -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;
}