Pig: Added ::skipN

This commit is contained in:
Paul Beckingham 2015-12-29 22:51:37 -05:00
parent abbc273d19
commit 07070baa73
2 changed files with 19 additions and 0 deletions

View file

@ -38,6 +38,24 @@ Pig::Pig (const std::string& text)
{
}
////////////////////////////////////////////////////////////////////////////////
bool Pig::skipN (const int quantity)
{
auto save = _cursor;
auto count = 0;
while (count++ < quantity)
{
if (! utf8_next_char (_text, _cursor))
{
_cursor = save;
return false;
}
}
return true;
}
////////////////////////////////////////////////////////////////////////////////
bool Pig::skipWS ()
{

View file

@ -34,6 +34,7 @@ class Pig
public:
Pig (const std::string&);
bool skipN (const int quantity = 1);
bool skipWS ();
bool getDigit (int&);