From a654e4ecace2d506d1b10f1dde2c287ebe84ef37 Mon Sep 17 00:00:00 2001 From: "Kartik K. Agaram" Date: Sat, 26 Mar 2016 23:59:59 -0700 Subject: 2812 --- html/011load.cc.html | 107 +++++++++++++++++++++++---------------------------- 1 file changed, 48 insertions(+), 59 deletions(-) (limited to 'html/011load.cc.html') diff --git a/html/011load.cc.html b/html/011load.cc.html index 6a28f8b5..bd2620ad 100644 --- a/html/011load.cc.html +++ b/html/011load.cc.html @@ -3,28 +3,36 @@ Mu - 011load.cc - - + + - + + + + -
+
 //: Phase 1 of running mu code: load it from a textual representation.
 
 :(scenarios load)  // use 'load' instead of 'run' in all scenarios in this layer
@@ -33,8 +41,8 @@ def main [
   1:number <- copy 23
 ]
 +parse: instruction: copy
-+parse:   ingredient: 23: "literal"
-+parse:   product: 1: "number"
++parse:   ingredient: {23: "literal"}
++parse:   product: {1: "number"}
 
 :(code)
 vector<recipe_ordinal> load(string form) {
@@ -67,7 +75,7 @@ vector<recipe_ordinal> load(istream& in
   return result;
 }
 
-long long int slurp_recipe(istream& in) {
+int slurp_recipe(istream& in) {
   recipe result;
   result.name = next_word(in);
   // End Load Recipe Name
@@ -87,8 +95,6 @@ vector<recipe_ordinal> load(istream& in
   slurp_body(in, result);
   // End Recipe Body(result)
   put(Recipe, get(Recipe_ordinal, result.name), result);
-  // track added recipes because we may need to undo them in tests; see below
-  Recently_added_recipes.push_back(get(Recipe_ordinal, result.name));
   return get(Recipe_ordinal, result.name);
 }
 
@@ -255,24 +261,6 @@ Disable_redefine_checks = false(0);
 }
 
-//: Have tests clean up any recipes they added.
-:(before "End Globals")
-vector<recipe_ordinal> Recently_added_recipes;
-long long int Reserved_for_tests = 1000;
-:(before "End Setup")
-clear_recently_added_recipes();
-:(code)
-void clear_recently_added_recipes() {
-  for (long long int i = 0; i < SIZE(Recently_added_recipes); ++i) {
-    if (Recently_added_recipes.at(i) >= Reserved_for_tests  // don't renumber existing recipes, like 'interactive'
-        && contains_key(Recipe, Recently_added_recipes.at(i)))  // in case previous test had duplicate definitions
-      Recipe_ordinal.erase(get(Recipe, Recently_added_recipes.at(i)).name);
-    Recipe.erase(Recently_added_recipes.at(i));
-  }
-  // Clear Other State For Recently_added_recipes
-  Recently_added_recipes.clear();
-}
-
 :(scenario parse_comment_outside_recipe)
 # this comment will be dropped by the tangler, so we need a dummy recipe to stop that
 def f1 [
@@ -282,8 +270,8 @@ def main [
   1:number <- copy 23
 ]
 +parse: instruction: copy
-+parse:   ingredient: 23: "literal"
-+parse:   product: 1: "number"
++parse:   ingredient: {23: "literal"}
++parse:   product: {1: "number"}
 
 :(scenario parse_comment_amongst_instruction)
 def main [
@@ -291,8 +279,8 @@ def main [
   1:number <- copy 23
 ]
 +parse: instruction: copy
-+parse:   ingredient: 23: "literal"
-+parse:   product: 1: "number"
++parse:   ingredient: {23: "literal"}
++parse:   product: {1: "number"}
 
 :(scenario parse_comment_amongst_instruction_2)
 def main [
@@ -301,8 +289,8 @@ def main [
   # comment
 ]
 +parse: instruction: copy
-+parse:   ingredient: 23: "literal"
-+parse:   product: 1: "number"
++parse:   ingredient: {23: "literal"}
++parse:   product: {1: "number"}
 
 :(scenario parse_comment_amongst_instruction_3)
 def main [
@@ -311,19 +299,19 @@ def main [
   2:number <- copy 23
 ]
 +parse: instruction: copy
-+parse:   ingredient: 23: "literal"
-+parse:   product: 1: "number"
++parse:   ingredient: {23: "literal"}
++parse:   product: {1: "number"}
 +parse: instruction: copy
-+parse:   ingredient: 23: "literal"
-+parse:   product: 2: "number"
++parse:   ingredient: {23: "literal"}
++parse:   product: {2: "number"}
 
 :(scenario parse_comment_after_instruction)
 def main [
   1:number <- copy 23  # comment
 ]
 +parse: instruction: copy
-+parse:   ingredient: 23: "literal"
-+parse:   product: 1: "number"
++parse:   ingredient: {23: "literal"}
++parse:   product: {1: "number"}
 
 :(scenario parse_label)
 def main [
@@ -342,43 +330,43 @@ def main [
   1:number <- copy 23/foo:bar:baz
 ]
 +parse: instruction: copy
-+parse:   ingredient: 23: "literal", {"foo": ("bar" "baz")}
-+parse:   product: 1: "number"
++parse:   ingredient: {23: "literal", "foo": ("bar" "baz")}
++parse:   product: {1: "number"}
 
 :(scenario parse_multiple_products)
 def main [
   1:number, 2:number <- copy 23
 ]
 +parse: instruction: copy
-+parse:   ingredient: 23: "literal"
-+parse:   product: 1: "number"
-+parse:   product: 2: "number"
++parse:   ingredient: {23: "literal"}
++parse:   product: {1: "number"}
++parse:   product: {2: "number"}
 
 :(scenario parse_multiple_ingredients)
 def main [
   1:number, 2:number <- copy 23, 4:number
 ]
 +parse: instruction: copy
-+parse:   ingredient: 23: "literal"
-+parse:   ingredient: 4: "number"
-+parse:   product: 1: "number"
-+parse:   product: 2: "number"
++parse:   ingredient: {23: "literal"}
++parse:   ingredient: {4: "number"}
++parse:   product: {1: "number"}
++parse:   product: {2: "number"}
 
 :(scenario parse_multiple_types)
 def main [
   1:number, 2:address:number <- copy 23, 4:number
 ]
 +parse: instruction: copy
-+parse:   ingredient: 23: "literal"
-+parse:   ingredient: 4: "number"
-+parse:   product: 1: "number"
-+parse:   product: 2: ("address" "number")
++parse:   ingredient: {23: "literal"}
++parse:   ingredient: {4: "number"}
++parse:   product: {1: "number"}
++parse:   product: {2: ("address" "number")}
 
 :(scenario parse_properties)
 def main [
   1:address:number/lookup <- copy 23
 ]
-+parse:   product: 1: ("address" "number"), {"lookup": ()}
++parse:   product: {1: ("address" "number"), "lookup": ()}
 
 //: this test we can't represent with a scenario
 :(code)
@@ -413,3 +401,4 @@ $error: 0
 
+ -- cgit 1.4.1-2-gfad0