diff --git a/src/LR0.cpp b/src/LR0.cpp index 0c1b9e6c..09b81bb9 100644 --- a/src/LR0.cpp +++ b/src/LR0.cpp @@ -28,6 +28,7 @@ #include #include #include +#include #include #include @@ -194,6 +195,15 @@ void LR0::createParseTable (States& states) for (auto& rule : _rules) _goto[state][rule] = ""; } + + for (unsigned int state = 0; state < states.size (); ++state) + { +/* + if (states[state].size () == 1 && + states[state][0].done ()) + _actions[state][states[state][0]._rule[states[state]0]._cursor]] = format ("r{1}", states[state][0]._grammarRule); +*/ + } } //////////////////////////////////////////////////////////////////////////////// @@ -231,6 +241,8 @@ std::string LR0::dump () const for (auto& terminal : _terminals) t.add (terminal, false); + t.add ("$", false); + for (auto& rule : _rules) t.add (rule, false); diff --git a/src/LR0.h b/src/LR0.h index e362c683..d2590b85 100644 --- a/src/LR0.h +++ b/src/LR0.h @@ -53,7 +53,7 @@ public: std::string next () const; std::string dump () const; - private: + public: std::vector _rule; unsigned int _cursor; int _grammarRule;