Skip to content

Commit

Permalink
git sucks
Browse files Browse the repository at this point in the history
  • Loading branch information
nfomon committed Sep 20, 2015
1 parent 7fac893 commit 3adb6ce
Show file tree
Hide file tree
Showing 6 changed files with 39 additions and 8 deletions.
3 changes: 2 additions & 1 deletion statik/IncParser.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ void IncParser::ExtractChanges(Batch& out_batch) {
g_log.debug() << "EXTRACT DONE: " << m_name;
m_touchedNodes.clear();
for (std::vector<STree*>::iterator i = m_forcedChanges.begin(); i != m_forcedChanges.end(); ++i) {
(*i)->Unforce();
(*i)->UnforceChange();
}
m_forcedChanges.clear();
Cleanup();
Expand Down Expand Up @@ -210,6 +210,7 @@ void IncParser::TouchNode(const STree& node) {
}

void IncParser::ForceChange(STree& node) {
node.ForceChange();
m_forcedChanges.push_back(&node);
}

Expand Down
2 changes: 1 addition & 1 deletion statik/OutputFunc.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -266,7 +266,7 @@ ostream& statik::operator<< (ostream& out, const OutputItem& item) {
if (item.onode) {
out << *item.onode;
} else if (item.child) {
out << item.child->Print();
out << item.child->Print() << " <" << item.child << ">";
} else {
throw SError("Attempt to operator<< defective OutputItem");
}
Expand Down
4 changes: 4 additions & 0 deletions statik/Root.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,10 @@ void ParseFunc_Root::operator() (ParseAction::Action action, const List& inode,
}
const STree& child = **m_node->children.begin();
const State& childState = child.GetState();
if (!child.IsClear()) {
// Set our IStart to the child's IStart just in case it moved
m_node->GetIConnection().Restart(child.IStart());
}
if (child.IsClear()) {
// This is wrong. Supposed to set to m_firstINode but we removed that because tricky to maintain lol...
m_node->children.erase(m_node->children.begin());
Expand Down
3 changes: 2 additions & 1 deletion statik/STree.h
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,8 @@ class STree {
void ParseNode(ParseAction::Action action, const List& inode, const STree* initiator);
void ClearNode(const List& inode);

void Unforce() { m_forceChange = false; }
void ForceChange() { m_forceChange = true; }
void UnforceChange() { m_forceChange = false; }

bool IsClear() const { return m_isClear; }
const State& GetState() const { return m_state; }
Expand Down
13 changes: 8 additions & 5 deletions statik/Star.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -71,8 +71,9 @@ void ParseFunc_Star::operator() (ParseAction::Action action, const List& inode,
return;
}
} else {
g_log.warning() << "Star node found Restart=0 action even though we have children. Useless restart?";
return;
g_log.info() << "Star node found Restart=0 action even though we have children. This is presumably caused by a forced self-update after our first child was deleted so we moved ourselves right. Go on to re-determine our state.";
action = ParseAction::ChildUpdate; // force move-along
initiator = m_node->children.front();
}
}

Expand Down Expand Up @@ -111,9 +112,11 @@ void ParseFunc_Star::operator() (ParseAction::Action action, const List& inode,
g_log.info() << "Restarting self at right inode " << *inode.right;
g_log.warning() << "Probably shouldn't be doing this here, i.e. maybe the parent should decide that we should restart at our right inode now that our IStart is gone. But is top-node behaviour different than subsidiaries?";
//m_node->GetIncParser().Enqueue(ParseAction(ParseAction::Restart, *m_node, *inode.right, m_node));
g_log.info() << "Setting our IStart to the child's IStart, and continuing to determine state.";
m_node->GetIConnection().Restart(m_node->children.at(0)->IStart());
// keep going to determine our state
g_log.info() << "Our IStart will be set to the right INode, and we'll come back to Restart.";
//m_node->GetIConnection().Restart(*inode.right); // not necessary
m_node->GetIncParser().Enqueue(ParseAction(ParseAction::Restart, *m_node, *inode.right, m_node));
m_node->GetIncParser().ForceChange(*m_node);
return;
} else {
g_log.warning() << "ParseFunc_Star at " << *m_node << ": First child was cleared, but it's not as if our first INode was deleted but we can just move forward an INode. Clearing self.";
m_node->ClearNode(inode);
Expand Down
22 changes: 22 additions & 0 deletions statik/notes.txt
Original file line number Diff line number Diff line change
Expand Up @@ -1299,3 +1299,25 @@ Let's make that an event that can propagate upward: hey I really want to start h
- Let's review the whole Start/Restart logic, I'm not sure our separation there is good enough
- e.g. not clear what should happen when this Star-that-moved-itself-forward is a child of another Star/Seq.

Start:
- done by IncParser::Insert on the Root, if the IList is empty
- done by Rule::MakeNode to start up an STree child node
- performed by STree::StartNode which just does IConnection.Restart(istart) and then enqueues a Restart
- setting the IStart here is just cosmetic, i.e. it's for DrawGraph. The Restart will also set the IStart.

Restart:

-----
Root test cases: Root -- a*
More Star test cases
Splash test cases

Lexer should be perfect.
- Then try a C lexer!

In "Simple" only, this fails:
new;del
new;;del
^
(invalid pos for insert)

0 comments on commit 3adb6ce

Please sign in to comment.