Skip to content
Permalink
Browse files

Fixed some bugs in Seq/Star :)

  • Loading branch information
nfomon committed Oct 19, 2015
1 parent ebd7591 commit 6e9f693528083a1359288c44278f928189179942
Showing with 49 additions and 3 deletions.
  1. +1 −0 statik/Meta.cpp
  2. +9 −1 statik/Seq.cpp
  3. +14 −2 statik/Star.cpp
  4. +25 −0 statik/notes.txt
@@ -42,6 +42,7 @@ void ParseFunc_Meta::operator() (ParseAction::Action action, const List& inode,
State& state = m_node->GetState();
state.Clear();
const List& first = m_node->IStart();
g_log.debug() << " - Meta wants '" << m_searchName << "', we are provided first '" << first.name << "'";
m_node->GetIncParser().Listen(*m_node, first);
m_node->GetIConnection().SetEnd(first);
if (first.name == m_searchName) {
@@ -51,10 +51,13 @@ void ParseFunc_Seq::operator() (ParseAction::Action action, const List& inode, c
throw SError("Seq failed to process non-ChildUpdate-action properly");
}

// FIXME SLOPPY: erase any clear/pending children. LoL :D
// FIXME SLOPPY: erase any clear/pending children, except the initiator. LoL :D
vector<STree::child_mod_iter> children_to_erase;
STree::child_mod_iter clear_child = m_node->children.begin();
for (; clear_child != m_node->children.end(); ++clear_child) {
if (*clear_child == initiator) {
continue;
}
if ((*clear_child)->IsClear() || (*clear_child)->GetState().IsPending()) {
children_to_erase.push_back(clear_child);
}
@@ -83,6 +86,11 @@ void ParseFunc_Seq::operator() (ParseAction::Action action, const List& inode, c
if (!foundInitiator) {
g_log.info() << "ParseFunc_Seq at " << m_node->Print() << " provided an initiator which is not a child";
g_log.info() << " - not an error, because presumably that child was recently cleared... so just dropping this update.";
if (m_node->children.empty()) {
g_log.info() << " - but we're out of children! So clearing self";
m_node->ClearNode(inode);
return;
}
return;
}
g_log.debug() << "Initiator child: " << **child;
@@ -85,10 +85,13 @@ void ParseFunc_Star::operator() (ParseAction::Action action, const List& inode,
throw SError("Star failed to process non-ChildUpdate-action properly");
}

// FIXME SLOPPY: erase any clear/pending children. LoL :D
// FIXME SLOPPY: erase any clear/pending children, except the initiator. LoL :D
vector<STree::child_mod_iter> children_to_erase;
STree::child_mod_iter clear_child = m_node->children.begin();
for (; clear_child != m_node->children.end(); ++clear_child) {
if (*clear_child == initiator) {
continue;
}
if ((*clear_child)->IsClear() || (*clear_child)->GetState().IsPending()) {
children_to_erase.push_back(clear_child);
}
@@ -113,7 +116,13 @@ void ParseFunc_Star::operator() (ParseAction::Action action, const List& inode,
++child;
}
if (!foundInitiator) {
g_log.info() << "ParseFunc_Star at " << *m_node << " provided an initiator which is not a child; presumably we've already dealt with this update";
g_log.info() << "ParseFunc_Star at " << *m_node << " provided an initiator which is not a child";
g_log.info() << " - not an error, because presumably that child was recently cleared... so just dropping this update.";
if (m_node->children.empty()) {
g_log.info() << " - but we're out of children! So clearing self";
m_node->ClearNode(inode);
return;
}
return;
}
g_log.debug() << "Initiator child: " << **child;
@@ -344,6 +353,9 @@ void ParseFunc_Star::operator() (ParseAction::Action action, const List& inode,
state.GoComplete();
m_node->GetIConnection().SetEnd(breachChild->IEnd());
}
} else if (!m_plus && &*m_node->children.front() == breachChild) {
state.GoComplete();
m_node->GetIConnection().SetEnd(breachChild->IEnd());
} else {
state.GoBad();
m_node->GetIConnection().SetEnd(breachChild->IEnd());
@@ -1371,4 +1371,29 @@ We have: Root -> lexer(*) -> (or:new) (or:;) (or:del) (or:new) (..bad..)
So the lexer(*) changes from emitting 2 to 4 things
But its parent, the root, is still bad, so we don't actually output the "del new".

--
new x;del y; new WS ID ; del WS ID ;
new xdel y; new WS ID WS ID ;

segfault. did we double-remove ';' for no reason or smthg?
why do we delete EIGHT things when the user removes the first semi?
- those are from the PARSER. In response to the LEXER giving us 5 deletes, 3 inserts.

lexer_300: emits ID y
lexer_337: emits terminal ;
lexer_392: emits del(semi1) del(semi2) del(del) WS(@new) del ID del SEMI

OP_DELETE 0x216b3d8 semi1
OP_DELETE 0x2171058 semi2
OP_DELETE 0x216d768 del
OP_INSERT 0x216bf18 (List WS:) @ 0x21682c8 (List ID:)
OP_DELETE 0x2177748
OP_INSERT 0x2177eb8 (List ID:) @ 0x216bf18 (List WS:)
OP_DELETE 0x2178728
OP_INSERT 0x216f988 (List ;:) @ 0x2177eb8 (List ID:)

Parser looks bad in several ways. Let's try without that wonky new* in its middle, although that can't be the entire problem.

--
at parser_181, we're deleting "del" INode. But some things don't tell their parent to update right when I would expect...

0 comments on commit 6e9f693

Please sign in to comment.
You can’t perform that action at this time.