summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorolpc user <olpc@xo-5d-f7-86.localdomain>2020-01-05 14:22:38 -0800
committerolpc user <olpc@xo-5d-f7-86.localdomain>2020-01-05 14:22:38 -0800
commit869391835d43e29494cb39b69f3bb73e622db33e (patch)
tree63e497a3cf039d68bfbaf056e2a19da5057322d8
parent06c2b19c9cd33f3dd8aa28e2fb51dee3e26fd6f4 (diff)
downloadstandingwithresilience-869391835d43e29494cb39b69f3bb73e622db33e.tar.gz
standingwithresilience-869391835d43e29494cb39b69f3bb73e622db33e.zip
basic run level2
-rw-r--r--starts/meaning-vm/level2.cpp10
1 files changed, 7 insertions, 3 deletions
diff --git a/starts/meaning-vm/level2.cpp b/starts/meaning-vm/level2.cpp
index 19fdf57..ae779f2 100644
--- a/starts/meaning-vm/level2.cpp
+++ b/starts/meaning-vm/level2.cpp
@@ -512,6 +512,7 @@ void parse(ref stream)
labels[action].link("label", action);
if (laststep.linked("next-step")) { throw makeconcept().link(is, "jump-from-nowhere", "label", action); }
laststep.link("next-step", labels[action]);
+ laststep = nothing;
continue;
}
if (action == "if") {
@@ -529,13 +530,14 @@ void parse(ref stream)
action.resize(action.size()-1);
if (!labels.count(action)) {
labels.emplace(action, makeconcept());
- labels[action].link("label", label);
+ labels[action].link("label", action);
}
ref("condition-step-set")(laststep, cond, labels[action]);
// if this improves from being jump, remember to
// update laststep to end of any 'anything' branch
continue;
}
+ if (laststep == nothing && label.size() == 0) { throw makeconcept().link(is, "no-path-to-code"); }
if (label.size() && !labels.count(label)) {
labels[label] = makeconcept();
labels[label].link("label", label);
@@ -558,7 +560,7 @@ void parse(ref stream)
} else {
ref("condition-step-set")(laststep, "anything", nextstep);
}
- } else {
+ } else if (laststep != nothing) {
laststep.link("next-step", nextstep);
}
ref habit = values.count(action) ? action : lookup(action);
@@ -674,10 +676,12 @@ when dump group [\n\
set link-type get link-entry 'type'\n\
pick link-type\n\
if 'responsibility' continue2.\n\
- if anything loop2.\n\
+ if anything next2.\n\
continue2:\n\
set link-target get link-entry 'target'\n\
'dump' link-target\n\
+ next2:\n\
+ next-link-entry link-entry\n\
loop2.\n\
done2:\n\
concept-unmake context 'link-entry'\n\