Lexer: ::isLiteral now stops at EOS

This commit is contained in:
Paul Beckingham 2015-07-27 00:57:30 -04:00
parent f2fe397048
commit 99a53edca0
2 changed files with 4 additions and 3 deletions

View file

@ -1271,6 +1271,7 @@ bool Lexer::isLiteral (
// End boundary conditions must be met.
if (endBoundary &&
_text[_cursor + common] &&
! Lexer::isWhitespace (_text[_cursor + common]) &&
! Lexer::isSingleCharOperator (_text[_cursor + common]))
return false;

View file

@ -272,9 +272,9 @@ int main (int argc, char** argv)
t.ok (l4.isLiteral(".", false, false), "isLiteral 'one.two' --> '.'");
t.ok (l4.isLiteral("two", false, true), "isLiteral 'one.two' --> 'two'");
Lexer l5 ("wonderful");
t.notok (l5.isLiteral ("wonder", false, false), "isLiteral 'wonder' != 'wonderful' without abbreviation");
t.ok (l5.isLiteral ("wonder", true, false), "isLiteral 'wonder' == 'wonderful' with abbreviation");
Lexer l5 ("wonder");
t.notok (l5.isLiteral ("wonderful", false, false), "isLiteral 'wonderful' != 'wonder' without abbreviation");
t.ok (l5.isLiteral ("wonderful", true, false), "isLiteral 'wonderful' == 'wonder' with abbreviation");
// bool isOneOf (const std::string&, bool, bool);
Lexer l6 ("Grumpy.");