Lexer: ::isLiteral now stops at EOS
This commit is contained in:
@@ -1271,6 +1271,7 @@ bool Lexer::isLiteral (
|
|||||||
|
|
||||||
// End boundary conditions must be met.
|
// End boundary conditions must be met.
|
||||||
if (endBoundary &&
|
if (endBoundary &&
|
||||||
|
_text[_cursor + common] &&
|
||||||
! Lexer::isWhitespace (_text[_cursor + common]) &&
|
! Lexer::isWhitespace (_text[_cursor + common]) &&
|
||||||
! Lexer::isSingleCharOperator (_text[_cursor + common]))
|
! Lexer::isSingleCharOperator (_text[_cursor + common]))
|
||||||
return false;
|
return false;
|
||||||
|
|||||||
@@ -272,9 +272,9 @@ int main (int argc, char** argv)
|
|||||||
t.ok (l4.isLiteral(".", false, false), "isLiteral 'one.two' --> '.'");
|
t.ok (l4.isLiteral(".", false, false), "isLiteral 'one.two' --> '.'");
|
||||||
t.ok (l4.isLiteral("two", false, true), "isLiteral 'one.two' --> 'two'");
|
t.ok (l4.isLiteral("two", false, true), "isLiteral 'one.two' --> 'two'");
|
||||||
|
|
||||||
Lexer l5 ("wonderful");
|
Lexer l5 ("wonder");
|
||||||
t.notok (l5.isLiteral ("wonder", false, false), "isLiteral 'wonder' != 'wonderful' without abbreviation");
|
t.notok (l5.isLiteral ("wonderful", false, false), "isLiteral 'wonderful' != 'wonder' without abbreviation");
|
||||||
t.ok (l5.isLiteral ("wonder", true, false), "isLiteral 'wonder' == 'wonderful' with abbreviation");
|
t.ok (l5.isLiteral ("wonderful", true, false), "isLiteral 'wonderful' == 'wonder' with abbreviation");
|
||||||
|
|
||||||
// bool isOneOf (const std::string&, bool, bool);
|
// bool isOneOf (const std::string&, bool, bool);
|
||||||
Lexer l6 ("Grumpy.");
|
Lexer l6 ("Grumpy.");
|
||||||
|
|||||||
Reference in New Issue
Block a user