mirror of
https://github.com/GothenburgBitFactory/timewarrior.git
synced 2025-07-07 20:06:39 +02:00
LR0: Added missing '$' symbol from action table diagnostics
This commit is contained in:
parent
1f1cd34134
commit
1abcd7ed3d
2 changed files with 13 additions and 1 deletions
12
src/LR0.cpp
12
src/LR0.cpp
|
@ -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);
|
||||
|
||||
|
|
|
@ -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;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue