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

splitword cannot happen if current form is not empty

parent 5c114f0c
No related branches found
No related tags found
No related merge requests found
...@@ -58,7 +58,7 @@ class Action ...@@ -58,7 +58,7 @@ class Action
static Action setRoot(); static Action setRoot();
static Action updateIds(); static Action updateIds();
static Action endWord(); 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 attach(Object governorObject, int governorIndex, Object dependentObject, int dependentIndex);
static Action addCurCharToCurWord(); static Action addCurCharToCurWord();
static Action ignoreCurrentCharacter(); static Action ignoreCurrentCharacter();
......
...@@ -370,7 +370,7 @@ Action Action::ignoreCurrentCharacter() ...@@ -370,7 +370,7 @@ Action Action::ignoreCurrentCharacter()
return {Type::MoveChar, apply, undo, appliable}; return {Type::MoveChar, apply, undo, appliable};
} }
Action Action::assertIdIsEmpty() Action Action::assertIsEmpty(const std::string & colName)
{ {
auto apply = [](Config &, Action &) auto apply = [](Config &, Action &)
{ {
...@@ -380,9 +380,9 @@ Action Action::assertIdIsEmpty() ...@@ -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}; return {Type::Check, apply, undo, appliable};
......
...@@ -164,7 +164,7 @@ void Transition::initEndWord() ...@@ -164,7 +164,7 @@ void Transition::initEndWord()
void Transition::initAddCharToWord() 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::addLinesIfNeeded(0));
sequence.emplace_back(Action::addCurCharToCurWord()); sequence.emplace_back(Action::addCurCharToCurWord());
sequence.emplace_back(Action::moveCharacterIndex(1)); sequence.emplace_back(Action::moveCharacterIndex(1));
...@@ -191,7 +191,8 @@ void Transition::initAddCharToWord() ...@@ -191,7 +191,8 @@ void Transition::initAddCharToWord()
void Transition::initSplitWord(std::vector<std::string> words) void Transition::initSplitWord(std::vector<std::string> words)
{ {
auto & consumedWord = words[0]; 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::addLinesIfNeeded(words.size()));
sequence.emplace_back(Action::consumeCharacterIndex(consumedWord)); sequence.emplace_back(Action::consumeCharacterIndex(consumedWord));
for (unsigned int i = 0; i < words.size(); i++) for (unsigned int i = 0; i < words.size(); i++)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment