diff options
author | Kartik K. Agaram <vc@akkartik.com> | 2016-08-12 14:51:53 -0700 |
---|---|---|
committer | Kartik K. Agaram <vc@akkartik.com> | 2016-08-12 14:51:53 -0700 |
commit | 1625e908ba6c415570008ef6767031a80be60aa3 (patch) | |
tree | 5c637b4f8120f9bd035b18e9572ee8f173026f44 /011load.cc | |
parent | 9e4f18449b1dce5448f97cd10c721d5085dae6cb (diff) | |
download | mu-1625e908ba6c415570008ef6767031a80be60aa3.tar.gz |
3168 - skip loading recipe 'main' in edit/
This is part of efforts to allow students to transition gradually from the sandbox to running programs directly on the commandline, writing real scenarios, etc. Running on the commandline requires 'main', but overriding 'main' would mess up edit/ which is itself a Mu program.
Diffstat (limited to '011load.cc')
-rw-r--r-- | 011load.cc | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/011load.cc b/011load.cc index 5988a7ba..ca66a8f4 100644 --- a/011load.cc +++ b/011load.cc @@ -25,11 +25,13 @@ vector<recipe_ordinal> load(istream& in) { string command = next_word(in); // Command Handlers if (command == "recipe" || command == "def") { - result.push_back(slurp_recipe(in)); + recipe_ordinal r = slurp_recipe(in); + if (r > 0) result.push_back(r); } else if (command == "recipe!" || command == "def!") { Disable_redefine_checks = true; - result.push_back(slurp_recipe(in)); + recipe_ordinal r = slurp_recipe(in); + if (r > 0) result.push_back(r); Disable_redefine_checks = false; } // End Command Handlers @@ -40,6 +42,8 @@ vector<recipe_ordinal> load(istream& in) { return result; } +// return the recipe ordinal slurped, or -1 if it failed +// (later layers will cause failures) int slurp_recipe(istream& in) { recipe result; result.name = next_word(in); |