Pig: Added ::skip

This commit is contained in:
Paul Beckingham 2015-12-30 10:48:37 -05:00
parent 09f23afc38
commit 6d47b1ba3a
2 changed files with 13 additions and 0 deletions

View file

@ -40,6 +40,18 @@ Pig::Pig (const std::string& text)
{ {
} }
////////////////////////////////////////////////////////////////////////////////
bool Pig::skip (int c)
{
if (_text[_cursor] == c)
{
++_cursor;
return true;
}
return false;
}
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
bool Pig::skipN (const int quantity) bool Pig::skipN (const int quantity)
{ {

View file

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