Skip to content
Snippets Groups Projects
Commit fc7f07cc authored by Franck Dary's avatar Franck Dary
Browse files

Fixed bug related to undoing parser actions

parent 43150f0c
Branches
No related tags found
No related merge requests found
...@@ -336,6 +336,10 @@ class Config ...@@ -336,6 +336,10 @@ class Config
void setEntropy(float entropy); void setEntropy(float entropy);
float getEntropy() const; float getEntropy() const;
void addToEntropy(float entropy); void addToEntropy(float entropy);
/// \brief Print a column content for debug purpose.
///
/// \param index Index of the column to print.
void printColumnInfos(unsigned int index);
}; };
#endif #endif
...@@ -354,6 +354,7 @@ std::vector<Action::BasicAction> ActionBank::str2sequence(const std::string & na ...@@ -354,6 +354,7 @@ std::vector<Action::BasicAction> ActionBank::str2sequence(const std::string & na
auto apply = [](Config & c, Action::BasicAction & ba) auto apply = [](Config & c, Action::BasicAction & ba)
{ {
ba.data = "";
auto & govs = c.getTape("GOV"); auto & govs = c.getTape("GOV");
int b0 = c.getHead(); int b0 = c.getHead();
int rootIndex = -1; int rootIndex = -1;
...@@ -416,6 +417,7 @@ std::vector<Action::BasicAction> ActionBank::str2sequence(const std::string & na ...@@ -416,6 +417,7 @@ std::vector<Action::BasicAction> ActionBank::str2sequence(const std::string & na
auto apply2 = [b2](Config & c, Action::BasicAction & ba) auto apply2 = [b2](Config & c, Action::BasicAction & ba)
{ {
ba.data = "";
auto & labels = c.getTape("LABEL"); auto & labels = c.getTape("LABEL");
int b0 = c.getHead(); int b0 = c.getHead();
int rootIndex = -1; int rootIndex = -1;
......
...@@ -619,3 +619,11 @@ void Config::Tape::maskIndex(int index) ...@@ -619,3 +619,11 @@ void Config::Tape::maskIndex(int index)
ref.maskIndex(index); ref.maskIndex(index);
} }
void Config::printColumnInfos(unsigned int index)
{
for (auto & tape : tapes)
fprintf(stderr, "%s\t: %s\n", tape.getName().c_str(), tape[index-getHead()].c_str());
fprintf(stderr, "\n");
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment