Checking that Parser initially is case-sensitive.
This commit is contained in:
parent
d9578b6f1c
commit
73c9d6c1f3
@ -57,6 +57,7 @@ class Parser
|
|||||||
Coordinate coordinate() const;
|
Coordinate coordinate() const;
|
||||||
|
|
||||||
void setCaseSensitive(bool isCaseInsensitive = true);
|
void setCaseSensitive(bool isCaseInsensitive = true);
|
||||||
|
bool isCaseSensitive() const noexcept;
|
||||||
|
|
||||||
char currentCharacter() const;
|
char currentCharacter() const;
|
||||||
void advance();
|
void advance();
|
||||||
|
@ -166,6 +166,13 @@ void Parser::setCaseSensitive(bool isCaseSensitive)
|
|||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
bool Parser::isCaseSensitive() const noexcept
|
||||||
|
{
|
||||||
|
return m_isCaseSensitive;
|
||||||
|
}
|
||||||
|
|
||||||
|
////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
char Parser::currentCharacter() const
|
char Parser::currentCharacter() const
|
||||||
{
|
{
|
||||||
if (m_isCaseSensitive)
|
if (m_isCaseSensitive)
|
||||||
|
@ -11,6 +11,8 @@ TEST(UtilsTests, ParseSimple)
|
|||||||
std::stringstream s("identifier 5 \n-51\t 0 1 expected unexpected");
|
std::stringstream s("identifier 5 \n-51\t 0 1 expected unexpected");
|
||||||
plasp::utils::Parser p("input", s);
|
plasp::utils::Parser p("input", s);
|
||||||
|
|
||||||
|
ASSERT_TRUE(p.isCaseSensitive());
|
||||||
|
|
||||||
ASSERT_EQ(p.parse<std::string>(), "identifier");
|
ASSERT_EQ(p.parse<std::string>(), "identifier");
|
||||||
ASSERT_EQ(p.parse<size_t>(), 5u);
|
ASSERT_EQ(p.parse<size_t>(), 5u);
|
||||||
ASSERT_EQ(p.parse<int>(), -51);
|
ASSERT_EQ(p.parse<int>(), -51);
|
||||||
|
Reference in New Issue
Block a user