Grammar: Added debug mode

This commit is contained in:
Paul Beckingham 2015-12-26 14:13:43 -05:00
parent 980dda147f
commit 2d594c33dc
2 changed files with 9 additions and 0 deletions

View file

@ -32,6 +32,7 @@
////////////////////////////////////////////////////////////////////////////////
Grammar::Grammar ()
: _debug (false)
{
}
@ -185,6 +186,12 @@ std::vector <std::vector <std::string>> Grammar::augmented () const
return results;
}
////////////////////////////////////////////////////////////////////////////////
void Grammar::debug (bool value)
{
_debug = value;
}
////////////////////////////////////////////////////////////////////////////////
std::string Grammar::dump () const
{

View file

@ -42,6 +42,7 @@ public:
std::vector <std::string> rules () const;
std::vector <std::string> terminals () const;
std::vector <std::vector <std::string>> augmented () const;
void debug (bool);
std::string dump () const;
protected:
@ -69,6 +70,7 @@ private:
private:
std::string _start;
std::map <std::string, Grammar::Rule> _rules;
bool _debug;
};
#endif