diff --git a/lib/tokenize/include/tokenize/Tokenizer.h b/lib/tokenize/include/tokenize/Tokenizer.h index aab29b9..61d013c 100644 --- a/lib/tokenize/include/tokenize/Tokenizer.h +++ b/lib/tokenize/include/tokenize/Tokenizer.h @@ -61,8 +61,8 @@ class Tokenizer: public Stream, public TokenizerPolicy // TODO: refactor std::string getIdentifier(); - bool testIdentifierAndReturn(const std::string &identifier); bool testIdentifierAndSkip(const std::string &identifier); + bool testIdentifierAndReturn(const std::string &identifier); // TODO: remove bool probeNumber(); @@ -223,6 +223,20 @@ std::string Tokenizer::getIdentifier() //////////////////////////////////////////////////////////////////////////////////////////////////// +template +bool Tokenizer::testIdentifierAndReturn(const std::string &expectedValue) +{ + const auto previousPosition = position(); + + const auto result = testIdentifierAndSkip(expectedValue); + + seek(previousPosition); + + return result; +} + +//////////////////////////////////////////////////////////////////////////////////////////////////// + template bool Tokenizer::testIdentifierAndSkip(const std::string &expectedValue) {