LR0: Added missing '$' symbol from action table diagnostics

This commit is contained in:
Paul Beckingham 2016-01-05 23:58:31 -05:00
parent 1f1cd34134
commit 1abcd7ed3d
2 changed files with 13 additions and 1 deletions

View file

@ -28,6 +28,7 @@
#include <LR0.h>
#include <Table.h>
#include <Color.h>
#include <text.h>
#include <iostream>
#include <sstream>
@ -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);

View file

@ -53,7 +53,7 @@ public:
std::string next () const;
std::string dump () const;
private:
public:
std::vector <std::string> _rule;
unsigned int _cursor;
int _grammarRule;