diff --git a/reading_machine/include/Action.hpp b/reading_machine/include/Action.hpp index 17e71149d37626029548251b7f3f0ae3c69c0d03..f2435e6b51e8397a2066b0f574e9768ef2209cc1 100644 --- a/reading_machine/include/Action.hpp +++ b/reading_machine/include/Action.hpp @@ -58,7 +58,7 @@ class Action static Action setRoot(); static Action updateIds(); static Action endWord(); - static Action assertIdIsEmpty(); + static Action assertIsEmpty(const std::string & colName); static Action attach(Object governorObject, int governorIndex, Object dependentObject, int dependentIndex); static Action addCurCharToCurWord(); static Action ignoreCurrentCharacter(); diff --git a/reading_machine/src/Action.cpp b/reading_machine/src/Action.cpp index dbe4c12364af3d444c7b7b4eeef23240b5e24393..47c5d2042967260b00bb848596ee551c66d1fa1d 100644 --- a/reading_machine/src/Action.cpp +++ b/reading_machine/src/Action.cpp @@ -370,7 +370,7 @@ Action Action::ignoreCurrentCharacter() return {Type::MoveChar, apply, undo, appliable}; } -Action Action::assertIdIsEmpty() +Action Action::assertIsEmpty(const std::string & colName) { auto apply = [](Config &, Action &) { @@ -380,9 +380,9 @@ Action Action::assertIdIsEmpty() { }; - auto appliable = [](const Config & config, const Action &) + auto appliable = [colName](const Config & config, const Action &) { - return util::isEmpty(config.getAsFeature(Config::idColName, config.getWordIndex())); + return util::isEmpty(config.getAsFeature(colName, config.getWordIndex())); }; return {Type::Check, apply, undo, appliable}; diff --git a/reading_machine/src/Transition.cpp b/reading_machine/src/Transition.cpp index 11ad8e990054290957e1c98175e6a808c9ffd19a..a8d3b33e2d16036db5aabe969b4a560777582773 100644 --- a/reading_machine/src/Transition.cpp +++ b/reading_machine/src/Transition.cpp @@ -164,7 +164,7 @@ void Transition::initEndWord() void Transition::initAddCharToWord() { - sequence.emplace_back(Action::assertIdIsEmpty()); + sequence.emplace_back(Action::assertIsEmpty(Config::idColName)); sequence.emplace_back(Action::addLinesIfNeeded(0)); sequence.emplace_back(Action::addCurCharToCurWord()); sequence.emplace_back(Action::moveCharacterIndex(1)); @@ -191,7 +191,8 @@ void Transition::initAddCharToWord() void Transition::initSplitWord(std::vector<std::string> words) { auto & consumedWord = words[0]; - sequence.emplace_back(Action::assertIdIsEmpty()); + sequence.emplace_back(Action::assertIsEmpty(Config::idColName)); + sequence.emplace_back(Action::assertIsEmpty("FORM")); sequence.emplace_back(Action::addLinesIfNeeded(words.size())); sequence.emplace_back(Action::consumeCharacterIndex(consumedWord)); for (unsigned int i = 0; i < words.size(); i++)