File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -1505,7 +1505,7 @@ bool Datetime::initializeDayName (Pig& pig)
15051505 std::string token;
15061506 for (int day = 0 ; day <= 7 ; ++day) // Deliberate <= so that 'sunday' is either 0 or 7.
15071507 {
1508- if (pig.skipPartial (dayNames[day % 7 ], token) &&
1508+ if (pig.skipPartial (dayNames[day % 7 ], token, true ) &&
15091509 token.length () >= static_cast <std::string::size_type> (Datetime::minimumMatchLength))
15101510 {
15111511 auto following = pig.peek ();
@@ -1548,7 +1548,7 @@ bool Datetime::initializeMonthName (Pig& pig)
15481548 std::string token;
15491549 for (int month = 0 ; month < 12 ; ++month)
15501550 {
1551- if (pig.skipPartial (monthNames[month], token) &&
1551+ if (pig.skipPartial (monthNames[month], token, true ) &&
15521552 token.length () >= static_cast <std::string::size_type> (Datetime::minimumMatchLength))
15531553 {
15541554 auto following = pig.peek ();
Original file line number Diff line number Diff line change @@ -103,13 +103,15 @@ bool Pig::skipLiteral (const std::string& literal)
103103}
104104
105105// //////////////////////////////////////////////////////////////////////////////
106- bool Pig::skipPartial (const std::string& reference, std::string& result)
106+ bool Pig::skipPartial (const std::string& reference, std::string& result,
107+ bool ignore_case)
107108{
108109 // Walk the common substring.
109110 auto pos = 0 ;
110111 while (reference[pos] &&
111112 (*_text)[_cursor + pos] &&
112- reference[pos] == tolower ((*_text)[_cursor + pos]))
113+ ((reference[pos] == (*_text)[_cursor + pos] && !ignore_case) ||
114+ (reference[pos] == tolower ((*_text)[_cursor + pos]) && ignore_case)))
113115 ++pos;
114116
115117 if (pos > 0 )
Original file line number Diff line number Diff line change @@ -40,7 +40,7 @@ class Pig
4040 bool skipN (const int quantity = 1 );
4141 bool skipWS ();
4242 bool skipLiteral (const std::string&);
43- bool skipPartial (const std::string&, std::string&);
43+ bool skipPartial (const std::string&, std::string&, bool ignore_case = false );
4444
4545 bool getUntil (int , std::string&);
4646 bool getUntilWS (std::string&);
You can’t perform that action at this time.
0 commit comments