diff --git a/src/Lexer.cpp b/src/Lexer.cpp index 050c9763b..f7a158e9c 100644 --- a/src/Lexer.cpp +++ b/src/Lexer.cpp @@ -1324,11 +1324,6 @@ bool Lexer::readWord ( { std::string::size_type eos = text.length (); - // Skip initial whitespace. - while (cursor <= eos && - Lexer::isWhitespace(text[cursor])) - ++cursor; - word = ""; int c; while ((c = text[cursor])) diff --git a/test/lexer.t.cpp b/test/lexer.t.cpp index 0cce6be62..ace4a2e66 100644 --- a/test/lexer.t.cpp +++ b/test/lexer.t.cpp @@ -243,8 +243,10 @@ int main (int argc, char** argv) cursor = 0; t.ok (Lexer::readWord (text, cursor, word), "readWord \"one 'two' three\\ four\" --> true"); t.is (word, "one", " word '" + word + "'"); + cursor++; t.ok (Lexer::readWord (text, cursor, word), "readWord \"one 'two' three\\ four\" --> true"); t.is (word, "'two'", " word '" + word + "'"); + cursor++; t.ok (Lexer::readWord (text, cursor, word), "readWord \"one 'two' three\\ four\" --> true"); t.is (word, "three four", " word '" + word + "'");