From 1c2d788b454670bf8fa1cb65c6251a8ff6ddcaf7 Mon Sep 17 00:00:00 2001 From: "Kartik K. Agaram" Date: Mon, 19 Jun 2017 11:29:20 -0700 Subject: 3927 --- html/053recipe_header.cc.html | 66 +++++++++++++++++++++---------------------- 1 file changed, 33 insertions(+), 33 deletions(-) (limited to 'html/053recipe_header.cc.html') diff --git a/html/053recipe_header.cc.html b/html/053recipe_header.cc.html index cfae8979..d54d2db5 100644 --- a/html/053recipe_header.cc.html +++ b/html/053recipe_header.cc.html @@ -90,7 +90,7 @@ if ('onhashchange' in window) { 24 25 :(before "End Recipe Refinements") 26 if (in.peek() != '[') { - 27 trace(9999, "parse") << "recipe has a header; parsing" << end(); + 27 trace(9999, "parse") << "recipe has a header; parsing" << end(); 28 load_recipe_header(in, result); 29 } 30 @@ -101,25 +101,25 @@ if ('onhashchange' in window) { 35 ¦ string s = next_word(in); 36 ¦ if (s.empty()) { 37 ¦ ¦ assert(!has_data(in)); - 38 ¦ ¦ raise << "incomplete recipe header at end of file (0)\n" << end(); + 38 ¦ ¦ raise << "incomplete recipe header at end of file (0)\n" << end(); 39 ¦ ¦ return; 40 ¦ } 41 ¦ if (s == "<-") - 42 ¦ ¦ raise << "recipe " << result.name << " should say '->' and not '<-'\n" << end(); + 42 ¦ ¦ raise << "recipe " << result.name << " should say '->' and not '<-'\n" << end(); 43 ¦ if (s == "->") break; 44 ¦ result.ingredients.push_back(reagent(s)); - 45 ¦ trace(9999, "parse") << "header ingredient: " << result.ingredients.back().original_string << end(); + 45 ¦ trace(9999, "parse") << "header ingredient: " << result.ingredients.back().original_string << end(); 46 ¦ skip_whitespace_but_not_newline(in); 47 } 48 while (has_data(in) && in.peek() != '[' && in.peek() != '\n') { 49 ¦ string s = next_word(in); 50 ¦ if (s.empty()) { 51 ¦ ¦ assert(!has_data(in)); - 52 ¦ ¦ raise << "incomplete recipe header at end of file (1)\n" << end(); + 52 ¦ ¦ raise << "incomplete recipe header at end of file (1)\n" << end(); 53 ¦ ¦ return; 54 ¦ } 55 ¦ result.products.push_back(reagent(s)); - 56 ¦ trace(9999, "parse") << "header product: " << result.products.back().original_string << end(); + 56 ¦ trace(9999, "parse") << "header product: " << result.products.back().original_string << end(); 57 ¦ skip_whitespace_but_not_newline(in); 58 } 59 // End Load Recipe Header(result) @@ -215,7 +215,7 @@ if ('onhashchange' in window) { 149 } 150 } 151 if (result.has_header) { -152 trace(9999, "parse") << "recipe " << result.name << " has a header" << end(); +152 trace(9999, "parse") << "recipe " << result.name << " has a header" << end(); 153 } 154 155 //: Support type abbreviations in headers. @@ -254,7 +254,7 @@ if ('onhashchange' in window) { 188 } 189 } 190 if (curr.name == "next-ingredient-without-typechecking") { -191 raise << maybe(result.name) << "never call 'next-ingredient-without-typechecking' directly\n" << end(); +191 raise << maybe(result.name) << "never call 'next-ingredient-without-typechecking' directly\n" << end(); 192 curr.clear(); 193 } 194 @@ -299,7 +299,7 @@ if ('onhashchange' in window) { 233 234 :(after "use-before-set Error") 235 if (is_present_in_ingredients(caller, ingredient.name)) -236 raise << " did you forget 'load-ingredients'?\n" << end(); +236 raise << " did you forget 'load-ingredients'?\n" << end(); 237 238 :(scenario load_ingredients_missing_error_2) 239 % Hide_errors = true; @@ -312,7 +312,7 @@ if ('onhashchange' in window) { 246 247 :(after "missing-type Error 1") 248 if (is_present_in_ingredients(get(Recipe, get(Recipe_ordinal, recipe_name)), x.name)) -249 raise << " did you forget 'load-ingredients'?\n" << end(); +249 raise << " did you forget 'load-ingredients'?\n" << end(); 250 251 :(code) 252 bool is_present_in_ingredients(const recipe& callee, const string& ingredient_name) { @@ -354,7 +354,7 @@ if ('onhashchange' in window) { 288 :(code) 289 void check_calls_against_header(const recipe_ordinal r) { 290 const recipe& caller = get(Recipe, r); -291 trace(9991, "transform") << "--- type-check calls inside recipe " << caller.name << end(); +291 trace(9991, "transform") << "--- type-check calls inside recipe " << caller.name << end(); 292 for (int i = 0; i < SIZE(caller.steps); ++i) { 293 ¦ const instruction& inst = caller.steps.at(i); 294 ¦ if (inst.operation < MAX_PRIMITIVE_RECIPES) continue; @@ -363,16 +363,16 @@ if ('onhashchange' in window) { 297 ¦ for (long int i = 0; i < min(SIZE(inst.ingredients), SIZE(callee.ingredients)); ++i) { 298 ¦ ¦ // ingredients coerced from call to callee 299 ¦ ¦ if (!types_coercible(callee.ingredients.at(i), inst.ingredients.at(i))) { -300 ¦ ¦ ¦ raise << maybe(caller.name) << "ingredient " << i << " has the wrong type at '" << to_original_string(inst) << "'\n" << end(); -301 ¦ ¦ ¦ raise << " ['" << to_string(callee.ingredients.at(i).type) << "' vs '" << to_string(inst.ingredients.at(i).type) << "']\n" << end(); +300 ¦ ¦ ¦ raise << maybe(caller.name) << "ingredient " << i << " has the wrong type at '" << to_original_string(inst) << "'\n" << end(); +301 ¦ ¦ ¦ raise << " ['" << to_string(callee.ingredients.at(i).type) << "' vs '" << to_string(inst.ingredients.at(i).type) << "']\n" << end(); 302 ¦ ¦ } 303 ¦ } 304 ¦ for (long int i = 0; i < min(SIZE(inst.products), SIZE(callee.products)); ++i) { 305 ¦ ¦ if (is_dummy(inst.products.at(i))) continue; 306 ¦ ¦ // products coerced from callee to call 307 ¦ ¦ if (!types_coercible(inst.products.at(i), callee.products.at(i))) { -308 ¦ ¦ ¦ raise << maybe(caller.name) << "product " << i << " has the wrong type at '" << to_original_string(inst) << "'\n" << end(); -309 ¦ ¦ ¦ raise << " ['" << to_string(inst.products.at(i).type) << "' vs '" << to_string(callee.products.at(i).type) << "']\n" << end(); +308 ¦ ¦ ¦ raise << maybe(caller.name) << "product " << i << " has the wrong type at '" << to_original_string(inst) << "'\n" << end(); +309 ¦ ¦ ¦ raise << " ['" << to_string(inst.products.at(i).type) << "' vs '" << to_string(callee.products.at(i).type) << "']\n" << end(); 310 ¦ ¦ } 311 ¦ } 312 } @@ -398,17 +398,17 @@ if ('onhashchange' in window) { 332 void check_return_instructions_against_header(const recipe_ordinal r) { 333 const recipe& caller_recipe = get(Recipe, r); 334 if (!caller_recipe.has_header) return; -335 trace(9991, "transform") << "--- checking return instructions against header for " << caller_recipe.name << end(); +335 trace(9991, "transform") << "--- checking return instructions against header for " << caller_recipe.name << end(); 336 for (int i = 0; i < SIZE(caller_recipe.steps); ++i) { 337 ¦ const instruction& inst = caller_recipe.steps.at(i); 338 ¦ if (inst.name != "reply" && inst.name != "return") continue; 339 ¦ if (SIZE(caller_recipe.products) != SIZE(inst.ingredients)) { -340 ¦ ¦ raise << maybe(caller_recipe.name) << "replied with the wrong number of products at '" << to_original_string(inst) << "'\n" << end(); +340 ¦ ¦ raise << maybe(caller_recipe.name) << "replied with the wrong number of products at '" << to_original_string(inst) << "'\n" << end(); 341 ¦ ¦ continue; 342 ¦ } 343 ¦ for (int i = 0; i < SIZE(caller_recipe.products); ++i) { 344 ¦ ¦ if (!types_match(caller_recipe.products.at(i), inst.ingredients.at(i))) -345 ¦ ¦ ¦ raise << maybe(caller_recipe.name) << "replied with the wrong type at '" << to_original_string(inst) << "'\n" << end(); +345 ¦ ¦ ¦ raise << maybe(caller_recipe.name) << "replied with the wrong type at '" << to_original_string(inst) << "'\n" << end(); 346 ¦ } 347 } 348 } @@ -469,10 +469,10 @@ if ('onhashchange' in window) { 403 void check_header_ingredients(const recipe_ordinal r) { 404 recipe& caller_recipe = get(Recipe, r); 405 caller_recipe.ingredient_index.clear(); -406 trace(9991, "transform") << "--- checking return instructions against header for " << caller_recipe.name << end(); +406 trace(9991, "transform") << "--- checking return instructions against header for " << caller_recipe.name << end(); 407 for (int i = 0; i < SIZE(caller_recipe.ingredients); ++i) { 408 ¦ if (caller_recipe.ingredients.at(i).type == NULL) -409 ¦ ¦ raise << maybe(caller_recipe.name) << "ingredient '" << caller_recipe.ingredients.at(i).name << "' has no type\n" << end(); +409 ¦ ¦ raise << maybe(caller_recipe.name) << "ingredient '" << caller_recipe.ingredients.at(i).name << "' has no type\n" << end(); 410 ¦ if (contains_key(caller_recipe.ingredient_index, caller_recipe.ingredients.at(i).name)) 411 ¦ ¦ raise << maybe(caller_recipe.name) << "'" << caller_recipe.ingredients.at(i).name << "' can't repeat in the ingredients\n" << end(); 412 ¦ put(caller_recipe.ingredient_index, caller_recipe.ingredients.at(i).name, i); @@ -501,37 +501,37 @@ if ('onhashchange' in window) { 435 void deduce_types_from_header(const recipe_ordinal r) { 436 recipe& caller_recipe = get(Recipe, r); 437 if (caller_recipe.products.empty()) return; -438 trace(9991, "transform") << "--- deduce types from header for " << caller_recipe.name << end(); +438 trace(9991, "transform") << "--- deduce types from header for " << caller_recipe.name << end(); 439 map<string, const type_tree*> header_type; 440 for (int i = 0; i < SIZE(caller_recipe.ingredients); ++i) { 441 ¦ if (!caller_recipe.ingredients.at(i).type) continue; // error handled elsewhere 442 ¦ put(header_type, caller_recipe.ingredients.at(i).name, caller_recipe.ingredients.at(i).type); -443 ¦ trace(9993, "transform") << "type of " << caller_recipe.ingredients.at(i).name << " is " << names_to_string(caller_recipe.ingredients.at(i).type) << end(); +443 ¦ trace(9993, "transform") << "type of " << caller_recipe.ingredients.at(i).name << " is " << names_to_string(caller_recipe.ingredients.at(i).type) << end(); 444 } 445 for (int i = 0; i < SIZE(caller_recipe.products); ++i) { 446 ¦ if (!caller_recipe.products.at(i).type) continue; // error handled elsewhere 447 ¦ put(header_type, caller_recipe.products.at(i).name, caller_recipe.products.at(i).type); -448 ¦ trace(9993, "transform") << "type of " << caller_recipe.products.at(i).name << " is " << names_to_string(caller_recipe.products.at(i).type) << end(); +448 ¦ trace(9993, "transform") << "type of " << caller_recipe.products.at(i).name << " is " << names_to_string(caller_recipe.products.at(i).type) << end(); 449 } 450 for (int i = 0; i < SIZE(caller_recipe.steps); ++i) { 451 ¦ instruction& inst = caller_recipe.steps.at(i); -452 ¦ trace(9992, "transform") << "instruction: " << to_string(inst) << end(); +452 ¦ trace(9992, "transform") << "instruction: " << to_string(inst) << end(); 453 ¦ for (int i = 0; i < SIZE(inst.ingredients); ++i) { 454 ¦ ¦ if (inst.ingredients.at(i).type) continue; -455 ¦ ¦ if (header_type.find(inst.ingredients.at(i).name) == header_type.end()) +455 ¦ ¦ if (header_type.find(inst.ingredients.at(i).name) == header_type.end()) 456 ¦ ¦ ¦ continue; 457 ¦ ¦ if (!contains_key(header_type, inst.ingredients.at(i).name)) continue; // error handled elsewhere 458 ¦ ¦ inst.ingredients.at(i).type = new type_tree(*get(header_type, inst.ingredients.at(i).name)); -459 ¦ ¦ trace(9993, "transform") << "type of " << inst.ingredients.at(i).name << " is " << names_to_string(inst.ingredients.at(i).type) << end(); +459 ¦ ¦ trace(9993, "transform") << "type of " << inst.ingredients.at(i).name << " is " << names_to_string(inst.ingredients.at(i).type) << end(); 460 ¦ } 461 ¦ for (int i = 0; i < SIZE(inst.products); ++i) { -462 ¦ ¦ trace(9993, "transform") << " product: " << to_string(inst.products.at(i)) << end(); +462 ¦ ¦ trace(9993, "transform") << " product: " << to_string(inst.products.at(i)) << end(); 463 ¦ ¦ if (inst.products.at(i).type) continue; -464 ¦ ¦ if (header_type.find(inst.products.at(i).name) == header_type.end()) +464 ¦ ¦ if (header_type.find(inst.products.at(i).name) == header_type.end()) 465 ¦ ¦ ¦ continue; 466 ¦ ¦ if (!contains_key(header_type, inst.products.at(i).name)) continue; // error handled elsewhere 467 ¦ ¦ inst.products.at(i).type = new type_tree(*get(header_type, inst.products.at(i).name)); -468 ¦ ¦ trace(9993, "transform") << "type of " << inst.products.at(i).name << " is " << names_to_string(inst.products.at(i).type) << end(); +468 ¦ ¦ trace(9993, "transform") << "type of " << inst.products.at(i).name << " is " << names_to_string(inst.products.at(i).type) << end(); 469 ¦ } 470 } 471 } @@ -557,7 +557,7 @@ if ('onhashchange' in window) { 491 :(code) 492 void fill_in_return_ingredients(const recipe_ordinal r) { 493 recipe& caller_recipe = get(Recipe, r); -494 trace(9991, "transform") << "--- fill in return ingredients from header for recipe " << caller_recipe.name << end(); +494 trace(9991, "transform") << "--- fill in return ingredients from header for recipe " << caller_recipe.name << end(); 495 if (!caller_recipe.has_header) return; 496 for (int i = 0; i < SIZE(caller_recipe.steps); ++i) { 497 ¦ instruction& inst = caller_recipe.steps.at(i); @@ -690,12 +690,12 @@ if ('onhashchange' in window) { 624 void check_recipe_header_constraints(const recipe_ordinal r) { 625 const recipe& caller = get(Recipe, r); 626 if (caller.name != "main") return; -627 trace(9992, "transform") << "check recipe header constraints for recipe " << caller.name << end(); +627 trace(9992, "transform") << "check recipe header constraints for recipe " << caller.name << end(); 628 if (!caller.has_header) return; 629 reagent/*local*/ expected_ingredient("x:address:array:character"); 630 for (int i = 0; i < SIZE(caller.ingredients); ++i) { 631 ¦ if (!types_strictly_match(expected_ingredient, caller.ingredients.at(i))) { -632 ¦ ¦ raise << "ingredients of recipe 'main' must all be text (address:array:character)\n" << end(); +632 ¦ ¦ raise << "ingredients of recipe 'main' must all be text (address:array:character)\n" << end(); 633 ¦ ¦ break; 634 ¦ } 635 } @@ -703,7 +703,7 @@ if ('onhashchange' in window) { 637 reagent/*local*/ expected_product("x:number"); 638 if (nprod > 1 639 ¦ ¦ || (nprod == 1 && !types_strictly_match(expected_product, caller.products.at(0)))) { -640 ¦ raise << "recipe 'main' must return at most a single product, a number\n" << end(); +640 ¦ raise << "recipe 'main' must return at most a single product, a number\n" << end(); 641 } 642 } 643 -- cgit 1.4.1-2-gfad0