diff options
author | Kartik K. Agaram <vc@akkartik.com> | 2016-07-21 19:22:03 -0700 |
---|---|---|
committer | Kartik K. Agaram <vc@akkartik.com> | 2016-07-21 19:22:03 -0700 |
commit | 8d72e5652147a0218f36757fd9171f3f2beda887 (patch) | |
tree | b95edd6bb86f7d421327d2f436e0c2d375cb795d | |
parent | fc19980d91e306df87b308d0c2875a2dcaf4b5c7 (diff) | |
download | mu-8d72e5652147a0218f36757fd9171f3f2beda887.tar.gz |
3120
Always show instruction before any transforms in error messages. This is likely going to make some errors unclear because they *need* to show the original instruction. But if we don't have tests for those situations did they ever really work?
-rw-r--r-- | 011load.cc | 6 | ||||
-rw-r--r-- | 021check_instruction.cc | 2 | ||||
-rw-r--r-- | 022arithmetic.cc | 50 | ||||
-rw-r--r-- | 023boolean.cc | 6 | ||||
-rw-r--r-- | 024jump.cc | 6 | ||||
-rw-r--r-- | 025compare.cc | 36 | ||||
-rw-r--r-- | 026call.cc | 2 | ||||
-rw-r--r-- | 027call_ingredient.cc | 4 | ||||
-rw-r--r-- | 029tools.cc | 4 | ||||
-rw-r--r-- | 030container.cc | 8 | ||||
-rw-r--r-- | 031merge.cc | 14 | ||||
-rw-r--r-- | 032array.cc | 12 | ||||
-rw-r--r-- | 033exclusive_container.cc | 10 | ||||
-rw-r--r-- | 034address.cc | 4 | ||||
-rw-r--r-- | 039location_array.cc | 2 | ||||
-rw-r--r-- | 042name.cc | 6 | ||||
-rw-r--r-- | 050scenario.cc | 2 | ||||
-rw-r--r-- | 053recipe_header.cc | 8 | ||||
-rw-r--r-- | 054static_dispatch.cc | 2 | ||||
-rw-r--r-- | 056shape_shifting_recipe.cc | 4 | ||||
-rw-r--r-- | 057immutable.cc | 12 | ||||
-rw-r--r-- | 062rewrite_stash.cc | 2 | ||||
-rw-r--r-- | 065random.cc | 2 | ||||
-rw-r--r-- | 068hash.cc | 4 | ||||
-rw-r--r-- | 070recipe.cc | 6 | ||||
-rw-r--r-- | 071scheduler.cc | 10 | ||||
-rw-r--r-- | 072wait.cc | 6 | ||||
-rw-r--r-- | 073deep_copy.cc | 6 | ||||
-rw-r--r-- | 080display.cc | 4 | ||||
-rw-r--r-- | 082scenario_screen.cc | 7 | ||||
-rw-r--r-- | 091run_interactive.cc | 4 | ||||
-rw-r--r-- | 092persist.cc | 4 |
32 files changed, 130 insertions, 125 deletions
diff --git a/011load.cc b/011load.cc index 3a65586b..5988a7ba 100644 --- a/011load.cc +++ b/011load.cc @@ -71,12 +71,10 @@ void slurp_body(istream& in, recipe& result) { skip_whitespace_and_comments(in); // permit trailing comment after '[' instruction curr; while (next_instruction(in, &curr)) { + curr.original_string = to_original_string(curr); // End Rewrite Instruction(curr, recipe result) trace(9992, "load") << "after rewriting: " << to_string(curr) << end(); - if (!curr.is_empty()) { - curr.original_string = to_string(curr); - result.steps.push_back(curr); - } + if (!curr.is_empty()) result.steps.push_back(curr); } } diff --git a/021check_instruction.cc b/021check_instruction.cc index 63483df1..f1390eb3 100644 --- a/021check_instruction.cc +++ b/021check_instruction.cc @@ -22,7 +22,7 @@ void check_instruction(const recipe_ordinal r) { // Primitive Recipe Checks case COPY: { if (SIZE(inst.products) != SIZE(inst.ingredients)) { - raise << maybe(get(Recipe, r).name) << "ingredients and products should match in '" << to_original_string(inst) << "'\n" << end(); + raise << maybe(get(Recipe, r).name) << "ingredients and products should match in '" << inst.original_string << "'\n" << end(); break; } for (int i = 0; i < SIZE(inst.ingredients); ++i) { diff --git a/022arithmetic.cc b/022arithmetic.cc index bf6ae3b6..6f1e4c1c 100644 --- a/022arithmetic.cc +++ b/022arithmetic.cc @@ -14,7 +14,7 @@ case ADD: { } } if (SIZE(inst.products) > 1) { - raise << maybe(get(Recipe, r).name) << "'add' yields exactly one product in '" << to_original_string(inst) << "'\n" << end(); + raise << maybe(get(Recipe, r).name) << "'add' yields exactly one product in '" << inst.original_string << "'\n" << end(); break; } if (!inst.products.empty() && !is_dummy(inst.products.at(0)) && !is_mu_number(inst.products.at(0))) { @@ -86,7 +86,7 @@ case SUBTRACT: { } } if (SIZE(inst.products) > 1) { - raise << maybe(get(Recipe, r).name) << "'subtract' yields exactly one product in '" << to_original_string(inst) << "'\n" << end(); + raise << maybe(get(Recipe, r).name) << "'subtract' yields exactly one product in '" << inst.original_string << "'\n" << end(); break; } if (!inst.products.empty() && !is_dummy(inst.products.at(0)) && !is_mu_number(inst.products.at(0))) { @@ -142,7 +142,7 @@ case MULTIPLY: { } } if (SIZE(inst.products) > 1) { - raise << maybe(get(Recipe, r).name) << "'multiply' yields exactly one product in '" << to_original_string(inst) << "'\n" << end(); + raise << maybe(get(Recipe, r).name) << "'multiply' yields exactly one product in '" << inst.original_string << "'\n" << end(); break; } if (!inst.products.empty() && !is_dummy(inst.products.at(0)) && !is_mu_number(inst.products.at(0))) { @@ -199,7 +199,7 @@ case DIVIDE: { } } if (SIZE(inst.products) > 1) { - raise << maybe(get(Recipe, r).name) << "'divide' yields exactly one product in '" << to_original_string(inst) << "'\n" << end(); + raise << maybe(get(Recipe, r).name) << "'divide' yields exactly one product in '" << inst.original_string << "'\n" << end(); break; } if (!inst.products.empty() && !is_dummy(inst.products.at(0)) && !is_mu_number(inst.products.at(0))) { @@ -247,15 +247,15 @@ put(Recipe_ordinal, "divide-with-remainder", DIVIDE_WITH_REMAINDER); :(before "End Primitive Recipe Checks") case DIVIDE_WITH_REMAINDER: { if (SIZE(inst.ingredients) != 2) { - raise << maybe(get(Recipe, r).name) << "'divide-with-remainder' requires exactly two ingredients, but got '" << to_original_string(inst) << "'\n" << end(); + raise << maybe(get(Recipe, r).name) << "'divide-with-remainder' requires exactly two ingredients, but got '" << inst.original_string << "'\n" << end(); break; } if (!is_mu_number(inst.ingredients.at(0)) || !is_mu_number(inst.ingredients.at(1))) { - raise << maybe(get(Recipe, r).name) << "'divide-with-remainder' requires number ingredients, but got '" << to_original_string(inst) << "'\n" << end(); + raise << maybe(get(Recipe, r).name) << "'divide-with-remainder' requires number ingredients, but got '" << inst.original_string << "'\n" << end(); break; } if (SIZE(inst.products) > 2) { - raise << maybe(get(Recipe, r).name) << "'divide-with-remainder' yields two products in '" << to_original_string(inst) << "'\n" << end(); + raise << maybe(get(Recipe, r).name) << "'divide-with-remainder' yields two products in '" << inst.original_string << "'\n" << end(); break; } for (int i = 0; i < SIZE(inst.products); ++i) { @@ -331,15 +331,15 @@ put(Recipe_ordinal, "shift-left", SHIFT_LEFT); :(before "End Primitive Recipe Checks") case SHIFT_LEFT: { if (SIZE(inst.ingredients) != 2) { - raise << maybe(get(Recipe, r).name) << "'shift-left' requires exactly two ingredients, but got '" << to_original_string(inst) << "'\n" << end(); + raise << maybe(get(Recipe, r).name) << "'shift-left' requires exactly two ingredients, but got '" << inst.original_string << "'\n" << end(); break; } if (!is_mu_number(inst.ingredients.at(0)) || !is_mu_number(inst.ingredients.at(1))) { - raise << maybe(get(Recipe, r).name) << "'shift-left' requires number ingredients, but got '" << to_original_string(inst) << "'\n" << end(); + raise << maybe(get(Recipe, r).name) << "'shift-left' requires number ingredients, but got '" << inst.original_string << "'\n" << end(); break; } if (SIZE(inst.products) > 1) { - raise << maybe(get(Recipe, r).name) << "'shift-left' yields one product in '" << to_original_string(inst) << "'\n" << end(); + raise << maybe(get(Recipe, r).name) << "'shift-left' yields one product in '" << inst.original_string << "'\n" << end(); break; } if (!inst.products.empty() && !is_dummy(inst.products.at(0)) && !is_mu_number(inst.products.at(0))) { @@ -402,15 +402,15 @@ put(Recipe_ordinal, "shift-right", SHIFT_RIGHT); :(before "End Primitive Recipe Checks") case SHIFT_RIGHT: { if (SIZE(inst.ingredients) != 2) { - raise << maybe(get(Recipe, r).name) << "'shift-right' requires exactly two ingredients, but got '" << to_original_string(inst) << "'\n" << end(); + raise << maybe(get(Recipe, r).name) << "'shift-right' requires exactly two ingredients, but got '" << inst.original_string << "'\n" << end(); break; } if (!is_mu_number(inst.ingredients.at(0)) || !is_mu_number(inst.ingredients.at(1))) { - raise << maybe(get(Recipe, r).name) << "'shift-right' requires number ingredients, but got '" << to_original_string(inst) << "'\n" << end(); + raise << maybe(get(Recipe, r).name) << "'shift-right' requires number ingredients, but got '" << inst.original_string << "'\n" << end(); break; } if (SIZE(inst.products) > 1) { - raise << maybe(get(Recipe, r).name) << "'shift-right' yields one product in '" << to_original_string(inst) << "'\n" << end(); + raise << maybe(get(Recipe, r).name) << "'shift-right' yields one product in '" << inst.original_string << "'\n" << end(); break; } if (!inst.products.empty() && !is_dummy(inst.products.at(0)) && !is_mu_number(inst.products.at(0))) { @@ -473,15 +473,15 @@ put(Recipe_ordinal, "and-bits", AND_BITS); :(before "End Primitive Recipe Checks") case AND_BITS: { if (SIZE(inst.ingredients) != 2) { - raise << maybe(get(Recipe, r).name) << "'and-bits' requires exactly two ingredients, but got '" << to_original_string(inst) << "'\n" << end(); + raise << maybe(get(Recipe, r).name) << "'and-bits' requires exactly two ingredients, but got '" << inst.original_string << "'\n" << end(); break; } if (!is_mu_number(inst.ingredients.at(0)) || !is_mu_number(inst.ingredients.at(1))) { - raise << maybe(get(Recipe, r).name) << "'and-bits' requires number ingredients, but got '" << to_original_string(inst) << "'\n" << end(); + raise << maybe(get(Recipe, r).name) << "'and-bits' requires number ingredients, but got '" << inst.original_string << "'\n" << end(); break; } if (SIZE(inst.products) > 1) { - raise << maybe(get(Recipe, r).name) << "'and-bits' yields one product in '" << to_original_string(inst) << "'\n" << end(); + raise << maybe(get(Recipe, r).name) << "'and-bits' yields one product in '" << inst.original_string << "'\n" << end(); break; } if (!inst.products.empty() && !is_dummy(inst.products.at(0)) && !is_mu_number(inst.products.at(0))) { @@ -531,15 +531,15 @@ put(Recipe_ordinal, "or-bits", OR_BITS); :(before "End Primitive Recipe Checks") case OR_BITS: { if (SIZE(inst.ingredients) != 2) { - raise << maybe(get(Recipe, r).name) << "'or-bits' requires exactly two ingredients, but got '" << to_original_string(inst) << "'\n" << end(); + raise << maybe(get(Recipe, r).name) << "'or-bits' requires exactly two ingredients, but got '" << inst.original_string << "'\n" << end(); break; } if (!is_mu_number(inst.ingredients.at(0)) || !is_mu_number(inst.ingredients.at(1))) { - raise << maybe(get(Recipe, r).name) << "'or-bits' requires number ingredients, but got '" << to_original_string(inst) << "'\n" << end(); + raise << maybe(get(Recipe, r).name) << "'or-bits' requires number ingredients, but got '" << inst.original_string << "'\n" << end(); break; } if (SIZE(inst.products) > 1) { - raise << maybe(get(Recipe, r).name) << "'or-bits' yields one product in '" << to_original_string(inst) << "'\n" << end(); + raise << maybe(get(Recipe, r).name) << "'or-bits' yields one product in '" << inst.original_string << "'\n" << end(); break; } if (!inst.products.empty() && !is_dummy(inst.products.at(0)) && !is_mu_number(inst.products.at(0))) { @@ -583,15 +583,15 @@ put(Recipe_ordinal, "xor-bits", XOR_BITS); :(before "End Primitive Recipe Checks") case XOR_BITS: { if (SIZE(inst.ingredients) != 2) { - raise << maybe(get(Recipe, r).name) << "'xor-bits' requires exactly two ingredients, but got '" << to_original_string(inst) << "'\n" << end(); + raise << maybe(get(Recipe, r).name) << "'xor-bits' requires exactly two ingredients, but got '" << inst.original_string << "'\n" << end(); break; } if (!is_mu_number(inst.ingredients.at(0)) || !is_mu_number(inst.ingredients.at(1))) { - raise << maybe(get(Recipe, r).name) << "'xor-bits' requires number ingredients, but got '" << to_original_string(inst) << "'\n" << end(); + raise << maybe(get(Recipe, r).name) << "'xor-bits' requires number ingredients, but got '" << inst.original_string << "'\n" << end(); break; } if (SIZE(inst.products) > 1) { - raise << maybe(get(Recipe, r).name) << "'xor-bits' yields one product in '" << to_original_string(inst) << "'\n" << end(); + raise << maybe(get(Recipe, r).name) << "'xor-bits' yields one product in '" << inst.original_string << "'\n" << end(); break; } if (!inst.products.empty() && !is_dummy(inst.products.at(0)) && !is_mu_number(inst.products.at(0))) { @@ -635,15 +635,15 @@ put(Recipe_ordinal, "flip-bits", FLIP_BITS); :(before "End Primitive Recipe Checks") case FLIP_BITS: { if (SIZE(inst.ingredients) != 1) { - raise << maybe(get(Recipe, r).name) << "'flip-bits' requires exactly one ingredient, but got '" << to_original_string(inst) << "'\n" << end(); + raise << maybe(get(Recipe, r).name) << "'flip-bits' requires exactly one ingredient, but got '" << inst.original_string << "'\n" << end(); break; } if (!is_mu_number(inst.ingredients.at(0))) { - raise << maybe(get(Recipe, r).name) << "'flip-bits' requires a number ingredient, but got '" << to_original_string(inst) << "'\n" << end(); + raise << maybe(get(Recipe, r).name) << "'flip-bits' requires a number ingredient, but got '" << inst.original_string << "'\n" << end(); break; } if (SIZE(inst.products) > 1) { - raise << maybe(get(Recipe, r).name) << "'flip-bits' yields one product in '" << to_original_string(inst) << "'\n" << end(); + raise << maybe(get(Recipe, r).name) << "'flip-bits' yields one product in '" << inst.original_string << "'\n" << end(); break; } if (!inst.products.empty() && !is_dummy(inst.products.at(0)) && !is_mu_number(inst.products.at(0))) { diff --git a/023boolean.cc b/023boolean.cc index 833595fa..8175e365 100644 --- a/023boolean.cc +++ b/023boolean.cc @@ -13,7 +13,7 @@ case AND: { } } if (SIZE(inst.products) > 1) { - raise << maybe(get(Recipe, r).name) << "'and' yields exactly one product in '" << to_original_string(inst) << "'\n" << end(); + raise << maybe(get(Recipe, r).name) << "'and' yields exactly one product in '" << inst.original_string << "'\n" << end(); break; } if (!inst.products.empty() && !is_dummy(inst.products.at(0)) && !is_mu_boolean(inst.products.at(0))) { @@ -71,7 +71,7 @@ case OR: { } } if (SIZE(inst.products) > 1) { - raise << maybe(get(Recipe, r).name) << "'or' yields exactly one product in '" << to_original_string(inst) << "'\n" << end(); + raise << maybe(get(Recipe, r).name) << "'or' yields exactly one product in '" << inst.original_string << "'\n" << end(); break; } if (!inst.products.empty() && !is_dummy(inst.products.at(0)) && !is_mu_boolean(inst.products.at(0))) { @@ -123,7 +123,7 @@ put(Recipe_ordinal, "not", NOT); :(before "End Primitive Recipe Checks") case NOT: { if (SIZE(inst.products) != SIZE(inst.ingredients)) { - raise << "ingredients and products should match in '" << to_original_string(inst) << "'\n" << end(); + raise << "ingredients and products should match in '" << inst.original_string << "'\n" << end(); break; } for (int i = 0; i < SIZE(inst.ingredients); ++i) { diff --git a/024jump.cc b/024jump.cc index 6278ffc2..57c4d3bb 100644 --- a/024jump.cc +++ b/024jump.cc @@ -16,7 +16,7 @@ put(Recipe_ordinal, "jump", JUMP); :(before "End Primitive Recipe Checks") case JUMP: { if (SIZE(inst.ingredients) != 1) { - raise << maybe(get(Recipe, r).name) << "'jump' requires exactly one ingredient, but got '" << to_original_string(inst) << "'\n" << end(); + raise << maybe(get(Recipe, r).name) << "'jump' requires exactly one ingredient, but got '" << inst.original_string << "'\n" << end(); break; } if (!is_literal(inst.ingredients.at(0))) { @@ -55,7 +55,7 @@ put(Recipe_ordinal, "jump-if", JUMP_IF); :(before "End Primitive Recipe Checks") case JUMP_IF: { if (SIZE(inst.ingredients) != 2) { - raise << maybe(get(Recipe, r).name) << "'jump-if' requires exactly two ingredients, but got '" << to_original_string(inst) << "'\n" << end(); + raise << maybe(get(Recipe, r).name) << "'jump-if' requires exactly two ingredients, but got '" << inst.original_string << "'\n" << end(); break; } if (!is_mu_scalar(inst.ingredients.at(0))) { @@ -108,7 +108,7 @@ put(Recipe_ordinal, "jump-unless", JUMP_UNLESS); :(before "End Primitive Recipe Checks") case JUMP_UNLESS: { if (SIZE(inst.ingredients) != 2) { - raise << maybe(get(Recipe, r).name) << "'jump-unless' requires exactly two ingredients, but got '" << to_original_string(inst) << "'\n" << end(); + raise << maybe(get(Recipe, r).name) << "'jump-unless' requires exactly two ingredients, but got '" << inst.original_string << "'\n" << end(); break; } if (!is_mu_scalar(inst.ingredients.at(0))) { diff --git a/025compare.cc b/025compare.cc index 6d12bf3c..058a016f 100644 --- a/025compare.cc +++ b/025compare.cc @@ -7,18 +7,18 @@ put(Recipe_ordinal, "equal", EQUAL); :(before "End Primitive Recipe Checks") case EQUAL: { if (SIZE(inst.ingredients) <= 1) { - raise << maybe(get(Recipe, r).name) << "'equal' needs at least two ingredients to compare in '" << to_original_string(inst) << "'\n" << end(); + raise << maybe(get(Recipe, r).name) << "'equal' needs at least two ingredients to compare in '" << inst.original_string << "'\n" << end(); break; } const reagent& exemplar = inst.ingredients.at(0); for (int i = /*skip exemplar*/1; i < SIZE(inst.ingredients); ++i) { if (!types_match(inst.ingredients.at(i), exemplar) && !types_match(exemplar, inst.ingredients.at(i))) { - raise << maybe(get(Recipe, r).name) << "'equal' expects ingredients to be all of the same type, but got '" << to_original_string(inst) << "'\n" << end(); + raise << maybe(get(Recipe, r).name) << "'equal' expects ingredients to be all of the same type, but got '" << inst.original_string << "'\n" << end(); goto finish_checking_instruction; } } if (SIZE(inst.products) > 1) { - raise << maybe(get(Recipe, r).name) << "'equal' yields exactly one product in '" << to_original_string(inst) << "'\n" << end(); + raise << maybe(get(Recipe, r).name) << "'equal' yields exactly one product in '" << inst.original_string << "'\n" << end(); break; } if (!inst.products.empty() && !is_dummy(inst.products.at(0)) && !is_mu_boolean(inst.products.at(0))) { @@ -81,16 +81,16 @@ put(Recipe_ordinal, "not-equal", NOT_EQUAL); :(before "End Primitive Recipe Checks") case NOT_EQUAL: { if (SIZE(inst.ingredients) != 2) { - raise << maybe(get(Recipe, r).name) << "'equal' needs two ingredients to compare in '" << to_original_string(inst) << "'\n" << end(); + raise << maybe(get(Recipe, r).name) << "'equal' needs two ingredients to compare in '" << inst.original_string << "'\n" << end(); break; } const reagent& exemplar = inst.ingredients.at(0); if (!types_match(inst.ingredients.at(1), exemplar) && !types_match(exemplar, inst.ingredients.at(1))) { - raise << maybe(get(Recipe, r).name) << "'equal' expects ingredients to be all of the same type, but got '" << to_original_string(inst) << "'\n" << end(); + raise << maybe(get(Recipe, r).name) << "'equal' expects ingredients to be all of the same type, but got '" << inst.original_string << "'\n" << end(); goto finish_checking_instruction; } if (SIZE(inst.products) > 1) { - raise << maybe(get(Recipe, r).name) << "'equal' yields exactly one product in '" << to_original_string(inst) << "'\n" << end(); + raise << maybe(get(Recipe, r).name) << "'equal' yields exactly one product in '" << inst.original_string << "'\n" << end(); break; } if (!inst.products.empty() && !is_dummy(inst.products.at(0)) && !is_mu_boolean(inst.products.at(0))) { @@ -135,7 +135,7 @@ put(Recipe_ordinal, "greater-than", GREATER_THAN); :(before "End Primitive Recipe Checks") case GREATER_THAN: { if (SIZE(inst.ingredients) <= 1) { - raise << maybe(get(Recipe, r).name) << "'greater-than' needs at least two ingredients to compare in '" << to_original_string(inst) << "'\n" << end(); + raise << maybe(get(Recipe, r).name) << "'greater-than' needs at least two ingredients to compare in '" << inst.original_string << "'\n" << end(); break; } for (int i = 0; i < SIZE(inst.ingredients); ++i) { @@ -145,7 +145,7 @@ case GREATER_THAN: { } } if (SIZE(inst.products) > 1) { - raise << maybe(get(Recipe, r).name) << "'greater-than' yields exactly one product in '" << to_original_string(inst) << "'\n" << end(); + raise << maybe(get(Recipe, r).name) << "'greater-than' yields exactly one product in '" << inst.original_string << "'\n" << end(); break; } if (!inst.products.empty() && !is_dummy(inst.products.at(0)) && !is_mu_boolean(inst.products.at(0))) { @@ -202,7 +202,7 @@ put(Recipe_ordinal, "lesser-than", LESSER_THAN); :(before "End Primitive Recipe Checks") case LESSER_THAN: { if (SIZE(inst.ingredients) <= 1) { - raise << maybe(get(Recipe, r).name) << "'lesser-than' needs at least two ingredients to compare in '" << to_original_string(inst) << "'\n" << end(); + raise << maybe(get(Recipe, r).name) << "'lesser-than' needs at least two ingredients to compare in '" << inst.original_string << "'\n" << end(); break; } for (int i = 0; i < SIZE(inst.ingredients); ++i) { @@ -212,7 +212,7 @@ case LESSER_THAN: { } } if (SIZE(inst.products) > 1) { - raise << maybe(get(Recipe, r).name) << "'lesser-than' yields exactly one product in '" << to_original_string(inst) << "'\n" << end(); + raise << maybe(get(Recipe, r).name) << "'lesser-than' yields exactly one product in '" << inst.original_string << "'\n" << end(); break; } if (!inst.products.empty() && !is_dummy(inst.products.at(0)) && !is_mu_boolean(inst.products.at(0))) { @@ -269,7 +269,7 @@ put(Recipe_ordinal, "greater-or-equal", GREATER_OR_EQUAL); :(before "End Primitive Recipe Checks") case GREATER_OR_EQUAL: { if (SIZE(inst.ingredients) <= 1) { - raise << maybe(get(Recipe, r).name) << "'greater-or-equal' needs at least two ingredients to compare in '" << to_original_string(inst) << "'\n" << end(); + raise << maybe(get(Recipe, r).name) << "'greater-or-equal' needs at least two ingredients to compare in '" << inst.original_string << "'\n" << end(); break; } for (int i = 0; i < SIZE(inst.ingredients); ++i) { @@ -279,7 +279,7 @@ case GREATER_OR_EQUAL: { } } if (SIZE(inst.products) > 1) { - raise << maybe(get(Recipe, r).name) << "'greater-or-equal' yields exactly one product in '" << to_original_string(inst) << "'\n" << end(); + raise << maybe(get(Recipe, r).name) << "'greater-or-equal' yields exactly one product in '" << inst.original_string << "'\n" << end(); break; } if (!inst.products.empty() && !is_dummy(inst.products.at(0)) && !is_mu_boolean(inst.products.at(0))) { @@ -344,7 +344,7 @@ put(Recipe_ordinal, "lesser-or-equal", LESSER_OR_EQUAL); :(before "End Primitive Recipe Checks") case LESSER_OR_EQUAL: { if (SIZE(inst.ingredients) <= 1) { - raise << maybe(get(Recipe, r).name) << "'lesser-or-equal' needs at least two ingredients to compare in '" << to_original_string(inst) << "'\n" << end(); + raise << maybe(get(Recipe, r).name) << "'lesser-or-equal' needs at least two ingredients to compare in '" << inst.original_string << "'\n" << end(); break; } for (int i = 0; i < SIZE(inst.ingredients); ++i) { @@ -354,7 +354,7 @@ case LESSER_OR_EQUAL: { } } if (SIZE(inst.products) > 1) { - raise << maybe(get(Recipe, r).name) << "'greater-or-equal' yields exactly one product in '" << to_original_string(inst) << "'\n" << end(); + raise << maybe(get(Recipe, r).name) << "'greater-or-equal' yields exactly one product in '" << inst.original_string << "'\n" << end(); break; } if (!inst.products.empty() && !is_dummy(inst.products.at(0)) && !is_mu_boolean(inst.products.at(0))) { @@ -419,7 +419,7 @@ put(Recipe_ordinal, "max", MAX); :(before "End Primitive Recipe Checks") case MAX: { if (SIZE(inst.ingredients) <= 1) { - raise << maybe(get(Recipe, r).name) << "'max' needs at least two ingredients to compare in '" << to_original_string(inst) << "'\n" << end(); + raise << maybe(get(Recipe, r).name) << "'max' needs at least two ingredients to compare in '" << inst.original_string << "'\n" << end(); break; } for (int i = 0; i < SIZE(inst.ingredients); ++i) { @@ -429,7 +429,7 @@ case MAX: { } } if (SIZE(inst.products) > 1) { - raise << maybe(get(Recipe, r).name) << "'max' yields exactly one product in '" << to_original_string(inst) << "'\n" << end(); + raise << maybe(get(Recipe, r).name) << "'max' yields exactly one product in '" << inst.original_string << "'\n" << end(); break; } if (!inst.products.empty() && !is_dummy(inst.products.at(0)) && !is_mu_number(inst.products.at(0))) { @@ -458,7 +458,7 @@ put(Recipe_ordinal, "min", MIN); :(before "End Primitive Recipe Checks") case MIN: { if (SIZE(inst.ingredients) <= 1) { - raise << maybe(get(Recipe, r).name) << "'min' needs at least two ingredients to compare in '" << to_original_string(inst) << "'\n" << end(); + raise << maybe(get(Recipe, r).name) << "'min' needs at least two ingredients to compare in '" << inst.original_string << "'\n" << end(); break; } for (int i = 0; i < SIZE(inst.ingredients); ++i) { @@ -468,7 +468,7 @@ case MIN: { } } if (SIZE(inst.products) > 1) { - raise << maybe(get(Recipe, r).name) << "'min' yields exactly one product in '" << to_original_string(inst) << "'\n" << end(); + raise << maybe(get(Recipe, r).name) << "'min' yields exactly one product in '" << inst.original_string << "'\n" << end(); break; } if (!inst.products.empty() && !is_dummy(inst.products.at(0)) && !is_mu_number(inst.products.at(0))) { diff --git a/026call.cc b/026call.cc index dd3b5968..c313deaf 100644 --- a/026call.cc +++ b/026call.cc @@ -97,7 +97,7 @@ inline const instruction& to_instruction(const call& call) { :(after "Defined Recipe Checks") // not a primitive; check that it's present in the book of recipes if (!contains_key(Recipe, inst.operation)) { - raise << maybe(get(Recipe, r).name) << "undefined operation in '" << to_original_string(inst) << "'\n" << end(); + raise << maybe(get(Recipe, r).name) << "undefined operation in '" << inst.original_string << "'\n" << end(); break; } :(replace{} "default:" following "End Primitive Recipe Implementations") diff --git a/027call_ingredient.cc b/027call_ingredient.cc index 1f3b26e8..9e98cdc2 100644 --- a/027call_ingredient.cc +++ b/027call_ingredient.cc @@ -42,7 +42,7 @@ put(Recipe_ordinal, "next-ingredient", NEXT_INGREDIENT); :(before "End Primitive Recipe Checks") case NEXT_INGREDIENT: { if (!inst.ingredients.empty()) { - raise << maybe(get(Recipe, r).name) << "'next-ingredient' didn't expect any ingredients in '" << to_original_string(inst) << "'\n" << end(); + raise << maybe(get(Recipe, r).name) << "'next-ingredient' didn't expect any ingredients in '" << inst.original_string << "'\n" << end(); break; } break; @@ -141,7 +141,7 @@ put(Recipe_ordinal, "ingredient", INGREDIENT); :(before "End Primitive Recipe Checks") case INGREDIENT: { if (SIZE(inst.ingredients) != 1) { - raise << maybe(get(Recipe, r).name) << "'ingredient' expects exactly one ingredient, but got '" << to_original_string(inst) << "'\n" << end(); + raise << maybe(get(Recipe, r).name) << "'ingredient' expects exactly one ingredient, but got '" << inst.original_string << "'\n" << end(); break; } if (!is_literal(inst.ingredients.at(0)) && !is_mu_number(inst.ingredients.at(0))) { diff --git a/029tools.cc b/029tools.cc index 108fa0ed..1639ebba 100644 --- a/029tools.cc +++ b/029tools.cc @@ -13,7 +13,7 @@ put(Recipe_ordinal, "trace", TRACE); :(before "End Primitive Recipe Checks") case TRACE: { if (SIZE(inst.ingredients) < 3) { - raise << maybe(get(Recipe, r).name) << "'trace' takes three or more ingredients rather than '" << to_original_string(inst) << "'\n" << end(); + raise << maybe(get(Recipe, r).name) << "'trace' takes three or more ingredients rather than '" << inst.original_string << "'\n" << end(); break; } if (!is_mu_number(inst.ingredients.at(0))) { @@ -203,7 +203,7 @@ put(Recipe_ordinal, "assert", ASSERT); :(before "End Primitive Recipe Checks") case ASSERT: { if (SIZE(inst.ingredients) != 2) { - raise << maybe(get(Recipe, r).name) << "'assert' takes exactly two ingredients rather than '" << to_original_string(inst) << "'\n" << end(); + raise << maybe(get(Recipe, r).name) << "'assert' takes exactly two ingredients rather than '" << inst.original_string << "'\n" << end(); break; } if (!is_mu_scalar(inst.ingredients.at(0))) { diff --git a/030container.cc b/030container.cc index e22fe4be..56cae250 100644 --- a/030container.cc +++ b/030container.cc @@ -263,7 +263,7 @@ put(Recipe_ordinal, "get", GET); :(before "End Primitive Recipe Checks") case GET: { if (SIZE(inst.ingredients) != 2) { - raise << maybe(get(Recipe, r).name) << "'get' expects exactly 2 ingredients in '" << to_original_string(inst) << "'\n" << end(); + raise << maybe(get(Recipe, r).name) << "'get' expects exactly 2 ingredients in '" << inst.original_string << "'\n" << end(); break; } reagent/*copy*/ base = inst.ingredients.at(0); // new copy for every invocation @@ -401,7 +401,7 @@ put(Recipe_ordinal, "put", PUT); :(before "End Primitive Recipe Checks") case PUT: { if (SIZE(inst.ingredients) != 3) { - raise << maybe(get(Recipe, r).name) << "'put' expects exactly 3 ingredients in '" << to_original_string(inst) << "'\n" << end(); + raise << maybe(get(Recipe, r).name) << "'put' expects exactly 3 ingredients in '" << inst.original_string << "'\n" << end(); break; } reagent/*copy*/ base = inst.ingredients.at(0); @@ -672,9 +672,9 @@ void check_or_set_invalid_types(const recipe_ordinal r) { for (int index = 0; index < SIZE(caller.steps); ++index) { instruction& inst = caller.steps.at(index); for (int i = 0; i < SIZE(inst.ingredients); ++i) - check_or_set_invalid_types(inst.ingredients.at(i).type, maybe(caller.name), "'"+to_original_string(inst)+"'"); + check_or_set_invalid_types(inst.ingredients.at(i).type, maybe(caller.name), "'"+inst.original_string+"'"); for (int i = 0; i < SIZE(inst.products); ++i) - check_or_set_invalid_types(inst.products.at(i).type, maybe(caller.name), "'"+to_original_string(inst)+"'"); + check_or_set_invalid_types(inst.products.at(i).type, maybe(caller.name), "'"+inst.original_string+"'"); } // End check_or_set_invalid_types } diff --git a/031merge.cc b/031merge.cc index abc1bbc5..21c036c8 100644 --- a/031merge.cc +++ b/031merge.cc @@ -119,19 +119,19 @@ void check_merge_calls(const recipe_ordinal r) { const instruction& inst = caller.steps.at(i); if (inst.name != "merge") continue; if (SIZE(inst.products) != 1) { - raise << maybe(caller.name) << "'merge' should yield a single product in '" << to_original_string(inst) << "'\n" << end(); + raise << maybe(caller.name) << "'merge' should yield a single product in '" << inst.original_string << "'\n" << end(); continue; } reagent/*copy*/ product = inst.products.at(0); // Update product While Type-checking Merge type_ordinal product_type = product.type->value; if (product_type == 0 || !contains_key(Type, product_type)) { - raise << maybe(caller.name) << "'merge' should yield a container in '" << to_original_string(inst) << "'\n" << end(); + raise << maybe(caller.name) << "'merge' should yield a container in '" << inst.original_string << "'\n" << end(); continue; } const type_info& info = get(Type, product_type); if (info.kind != CONTAINER && info.kind != EXCLUSIVE_CONTAINER) { - raise << maybe(caller.name) << "'merge' should yield a container in '" << to_original_string(inst) << "'\n" << end(); + raise << maybe(caller.name) << "'merge' should yield a container in '" << inst.original_string << "'\n" << end(); continue; } check_merge_call(inst.ingredients, product, caller, inst); @@ -146,7 +146,7 @@ void check_merge_call(const vector<reagent>& ingredients, const reagent& product assert(!state.data.empty()); trace(9999, "transform") << ingredient_index << " vs " << SIZE(ingredients) << end(); if (ingredient_index >= SIZE(ingredients)) { - raise << maybe(caller.name) << "too few ingredients in '" << to_original_string(inst) << "'\n" << end(); + raise << maybe(caller.name) << "too few ingredients in '" << inst.original_string << "'\n" << end(); return; } reagent& container = state.data.top().container; @@ -167,7 +167,7 @@ void check_merge_call(const vector<reagent>& ingredients, const reagent& product state.data.pop(); if (state.data.empty()) { if (ingredient_index < SIZE(ingredients)) - raise << maybe(caller.name) << "too many ingredients in '" << to_original_string(inst) << "'\n" << end(); + raise << maybe(caller.name) << "too many ingredients in '" << inst.original_string << "'\n" << end(); return; } ++state.data.top().container_element_index; @@ -183,7 +183,7 @@ void check_merge_call(const vector<reagent>& ingredients, const reagent& product // End check_merge_call Cases default: { if (!types_coercible(container, ingredients.at(ingredient_index))) { - raise << maybe(caller.name) << "incorrect type of ingredient " << ingredient_index << " in '" << to_original_string(inst) << "'\n" << end(); + raise << maybe(caller.name) << "incorrect type of ingredient " << ingredient_index << " in '" << inst.original_string << "'\n" << end(); raise << " (expected '" << debug_string(container) << "')\n" << end(); raise << " (got '" << debug_string(ingredients.at(ingredient_index)) << "')\n" << end(); return; @@ -194,7 +194,7 @@ void check_merge_call(const vector<reagent>& ingredients, const reagent& product state.data.pop(); if (state.data.empty()) { if (ingredient_index < SIZE(ingredients)) - raise << maybe(caller.name) << "too many ingredients in '" << to_original_string(inst) << "'\n" << end(); + raise << maybe(caller.name) << "too many ingredients in '" << inst.original_string << "'\n" << end(); return; } ++state.data.top().container_element_index; diff --git a/032array.cc b/032array.cc index 56b487a6..06520cb0 100644 --- a/032array.cc +++ b/032array.cc @@ -20,7 +20,7 @@ put(Recipe_ordinal, "create-array", CREATE_ARRAY); :(before "End Primitive Recipe Checks") case CREATE_ARRAY: { if (inst.products.empty()) { - raise << maybe(get(Recipe, r).name) << "'create-array' needs one product and no ingredients but got '" << to_original_string(inst) << '\n' << end(); + raise << maybe(get(Recipe, r).name) << "'create-array' needs one product and no ingredients but got '" << inst.original_string << '\n' << end(); break; } reagent/*copy*/ product = inst.products.at(0); @@ -30,12 +30,12 @@ case CREATE_ARRAY: { break; } if (!product.type->right) { - raise << maybe(get(Recipe, r).name) << "create array of what? '" << to_original_string(inst) << "'\n" << end(); + raise << maybe(get(Recipe, r).name) << "create array of what? '" << inst.original_string << "'\n" << end(); break; } // 'create-array' will need to check properties rather than types if (!product.type->right->right) { - raise << maybe(get(Recipe, r).name) << "create array of what size? '" << to_original_string(inst) << "'\n" << end(); + raise << maybe(get(Recipe, r).name) << "create array of what size? '" << inst.original_string << "'\n" << end(); break; } if (!is_integer(product.type->right->right->name)) { @@ -200,7 +200,7 @@ put(Recipe_ordinal, "index", INDEX); :(before "End Primitive Recipe Checks") case INDEX: { if (SIZE(inst.ingredients) != 2) { - raise << maybe(get(Recipe, r).name) << "'index' expects exactly 2 ingredients in '" << to_original_string(inst) << "'\n" << end(); + raise << maybe(get(Recipe, r).name) << "'index' expects exactly 2 ingredients in '" << inst.original_string << "'\n" << end(); break; } reagent/*copy*/ base = inst.ingredients.at(0); @@ -362,7 +362,7 @@ put(Recipe_ordinal, "put-index", PUT_INDEX); :(before "End Primitive Recipe Checks") case PUT_INDEX: { if (SIZE(inst.ingredients) != 3) { - raise << maybe(get(Recipe, r).name) << "'put-index' expects exactly 3 ingredients in '" << to_original_string(inst) << "'\n" << end(); + raise << maybe(get(Recipe, r).name) << "'put-index' expects exactly 3 ingredients in '" << inst.original_string << "'\n" << end(); break; } reagent/*copy*/ base = inst.ingredients.at(0); @@ -484,7 +484,7 @@ put(Recipe_ordinal, "length", LENGTH); :(before "End Primitive Recipe Checks") case LENGTH: { if (SIZE(inst.ingredients) != 1) { - raise << maybe(get(Recipe, r).name) << "'length' expects exactly 2 ingredients in '" << to_original_string(inst) << "'\n" << end(); + raise << maybe(get(Recipe, r).name) << "'length' expects exactly 2 ingredients in '" << inst.original_string << "'\n" << end(); break; } reagent/*copy*/ array = inst.ingredients.at(0); diff --git a/033exclusive_container.cc b/033exclusive_container.cc index fc7708bc..8f79e980 100644 --- a/033exclusive_container.cc +++ b/033exclusive_container.cc @@ -95,7 +95,7 @@ put(Recipe_ordinal, "maybe-convert", MAYBE_CONVERT); case MAYBE_CONVERT: { const recipe& caller = get(Recipe, r); if (SIZE(inst.ingredients) != 2) { - raise << maybe(caller.name) << "'maybe-convert' expects exactly 2 ingredients in '" << to_original_string(inst) << "'\n" << end(); + raise << maybe(caller.name) << "'maybe-convert' expects exactly 2 ingredients in '" << inst.original_string << "'\n" << end(); break; } reagent/*copy*/ base = inst.ingredients.at(0); @@ -110,7 +110,7 @@ case MAYBE_CONVERT: { } if (inst.products.empty()) break; if (SIZE(inst.products) != 2) { - raise << maybe(caller.name) << "'maybe-convert' expects exactly 2 products in '" << to_original_string(inst) << "'\n" << end(); + raise << maybe(caller.name) << "'maybe-convert' expects exactly 2 products in '" << inst.original_string << "'\n" << end(); break; } reagent/*copy*/ product = inst.products.at(0); @@ -118,7 +118,7 @@ case MAYBE_CONVERT: { reagent& offset = inst.ingredients.at(1); populate_value(offset); if (offset.value >= SIZE(get(Type, base.type->value).elements)) { - raise << maybe(caller.name) << "invalid tag " << offset.value << " in '" << to_original_string(inst) << '\n' << end(); + raise << maybe(caller.name) << "invalid tag " << offset.value << " in '" << inst.original_string << '\n' << end(); break; } const reagent& variant = variant_type(base, offset.value); @@ -299,13 +299,13 @@ case EXCLUSIVE_CONTAINER: { if (types_strictly_match(container, inst.ingredients.at(ingredient_index))) return; if (!is_literal(ingredients.at(ingredient_index))) { - raise << maybe(caller.name) << "ingredient " << ingredient_index << " of 'merge' should be a literal, for the tag of exclusive-container '" << container_info.name << "' in '" << to_original_string(inst) << "'\n" << end(); + raise << maybe(caller.name) << "ingredient " << ingredient_index << " of 'merge' should be a literal, for the tag of exclusive-container '" << container_info.name << "' in '" << inst.original_string << "'\n" << end(); return; } reagent/*copy*/ ingredient = ingredients.at(ingredient_index); // unnecessary copy just to keep this function from modifying caller populate_value(ingredient); if (ingredient.value >= SIZE(container_info.elements)) { - raise << maybe(caller.name) << "invalid tag at " << ingredient_index << " for '" << container_info.name << "' in '" << to_original_string(inst) << "'\n" << end(); + raise << maybe(caller.name) << "invalid tag at " << ingredient_index << " for '" << container_info.name << "' in '" << inst.original_string << "'\n" << end(); return; } const reagent& variant = variant_type(container, ingredient.value); diff --git a/034address.cc b/034address.cc index c8e63bf3..a6ed554f 100644 --- a/034address.cc +++ b/034address.cc @@ -151,7 +151,7 @@ put(Recipe_ordinal, "new", NEW); case NEW: { const recipe& caller = get(Recipe, r); if (inst.ingredients.empty() || SIZE(inst.ingredients) > 2) { - raise << maybe(caller.name) << "'new' requires one or two ingredients, but got '" << to_original_string(inst) << "'\n" << end(); + raise << maybe(caller.name) << "'new' requires one or two ingredients, but got '" << inst.original_string << "'\n" << end(); break; } // End NEW Check Special-cases @@ -165,7 +165,7 @@ case NEW: { break; } if (!product_of_new_is_valid(inst)) { - raise << maybe(caller.name) << "product of 'new' has incorrect type: '" << to_original_string(inst) << "'\n" << end(); + raise << maybe(caller.name) << "product of 'new' has incorrect type: '" << inst.original_string << "'\n" << end(); break; } break; diff --git a/039location_array.cc b/039location_array.cc index fd95511b..6c261dcf 100644 --- a/039location_array.cc +++ b/039location_array.cc @@ -6,7 +6,7 @@ put(Recipe_ordinal, "to-location-array", TO_LOCATION_ARRAY); case TO_LOCATION_ARRAY: { const recipe& caller = get(Recipe, r); if (!is_address_of_array_of_numbers(inst.products.at(0))) { - raise << maybe(caller.name) << "product of 'to-location-array' has incorrect type: '" << to_original_string(inst) << "'\n" << end(); + raise << maybe(caller.name) << "product of 'to-location-array' has incorrect type: '" << inst.original_string << "'\n" << end(); break; } break; diff --git a/042name.cc b/042name.cc index 323e9c3e..6c122935 100644 --- a/042name.cc +++ b/042name.cc @@ -95,7 +95,7 @@ void transform_names(const recipe_ordinal r) { bool is_disqualified(/*mutable*/ reagent& x, const instruction& inst, const string& recipe_name) { if (!x.type) { // End Null-type is_disqualified Exceptions - raise << maybe(recipe_name) << "missing type for '" << x.original_string << "' in '" << to_original_string(inst) << "'\n" << end(); + raise << maybe(recipe_name) << "missing type for '" << x.original_string << "' in '" << inst.original_string << "'\n" << end(); return true; } if (is_raw(x)) return true; @@ -281,7 +281,7 @@ def main [ // convert variant names of exclusive containers if (inst.name == "maybe-convert") { if (SIZE(inst.ingredients) != 2) { - raise << maybe(get(Recipe, r).name) << "exactly 2 ingredients expected in '" << to_original_string(inst) << "'\n" << end(); + raise << maybe(get(Recipe, r).name) << "exactly 2 ingredients expected in '" << inst.original_string << "'\n" << end(); break; } assert(is_literal(inst.ingredients.at(1))); @@ -289,7 +289,7 @@ if (inst.name == "maybe-convert") { // since first non-address in base type must be an exclusive container, we don't have to canonize type_ordinal base_type = skip_addresses(inst.ingredients.at(0).type); if (base_type == -1) - raise << maybe(get(Recipe, r).name) << "expected an exclusive-container in '" << to_original_string(inst) << "'\n" << end(); + raise << maybe(get(Recipe, r).name) << "expected an exclusive-container in '" << inst.original_string << "'\n" << end(); if (contains_key(Type, base_type)) { // otherwise we'll raise an error elsewhere inst.ingredients.at(1).set_value(find_element_name(base_type, inst.ingredients.at(1).name, get(Recipe, r).name)); trace(9993, "name") << "variant " << inst.ingredients.at(1).name << " of type " << get(Type, base_type).name << " has tag " << no_scientific(inst.ingredients.at(1).value) << end(); diff --git a/050scenario.cc b/050scenario.cc index eed98d1b..bb5a88b8 100644 --- a/050scenario.cc +++ b/050scenario.cc @@ -675,7 +675,7 @@ put(Recipe_ordinal, "check-trace-count-for-label", CHECK_TRACE_COUNT_FOR_LABEL); :(before "End Primitive Recipe Checks") case CHECK_TRACE_COUNT_FOR_LABEL: { if (SIZE(inst.ingredients) != 2) { - raise << maybe(get(Recipe, r).name) << "'check-trace-count-for-label' requires exactly two ingredients, but got '" << to_original_string(inst) << "'\n" << end(); + raise << maybe(get(Recipe, r).name) << "'check-trace-count-for-label' requires exactly two ingredients, but got '" << inst.original_string << "'\n" << end(); break; } if (!is_mu_number(inst.ingredients.at(0))) { diff --git a/053recipe_header.cc b/053recipe_header.cc index 06abcc4b..3f3c5403 100644 --- a/053recipe_header.cc +++ b/053recipe_header.cc @@ -231,13 +231,13 @@ void check_calls_against_header(const recipe_ordinal r) { for (long int i = 0; i < min(SIZE(inst.ingredients), SIZE(callee.ingredients)); ++i) { // ingredients coerced from call to callee if (!types_coercible(callee.ingredients.at(i), inst.ingredients.at(i))) - raise << maybe(caller.name) << "ingredient " << i << " has the wrong type at '" << to_original_string(inst) << "'\n" << end(); + raise << maybe(caller.name) << "ingredient " << i << " has the wrong type at '" << inst.original_string << "'\n" << end(); } for (long int i = 0; i < min(SIZE(inst.products), SIZE(callee.products)); ++i) { if (is_dummy(inst.products.at(i))) continue; // products coerced from callee to call if (!types_coercible(inst.products.at(i), callee.products.at(i))) - raise << maybe(caller.name) << "product " << i << " has the wrong type at '" << to_original_string(inst) << "'\n" << end(); + raise << maybe(caller.name) << "product " << i << " has the wrong type at '" << inst.original_string << "'\n" << end(); } } } @@ -267,12 +267,12 @@ void check_reply_instructions_against_header(const recipe_ordinal r) { const instruction& inst = caller_recipe.steps.at(i); if (inst.name != "reply" && inst.name != "return") continue; if (SIZE(caller_recipe.products) != SIZE(inst.ingredients)) { - raise << maybe(caller_recipe.name) << "replied with the wrong number of products at '" << to_original_string(inst) << "'\n" << end(); + raise << maybe(caller_recipe.name) << "replied with the wrong number of products at '" << inst.original_string << "'\n" << end(); continue; } for (int i = 0; i < SIZE(caller_recipe.products); ++i) { if (!types_match(caller_recipe.products.at(i), inst.ingredients.at(i))) - raise << maybe(caller_recipe.name) << "replied with the wrong type at '" << to_original_string(inst) << "'\n" << end(); + raise << maybe(caller_recipe.name) << "replied with the wrong type at '" << inst.original_string << "'\n" << end(); } } } diff --git a/054static_dispatch.cc b/054static_dispatch.cc index 17d82545..ca2bcba9 100644 --- a/054static_dispatch.cc +++ b/054static_dispatch.cc @@ -193,7 +193,7 @@ string best_variant(instruction& inst, const recipe& caller_recipe) { // error messages if (get(Recipe_ordinal, inst.name) >= MAX_PRIMITIVE_RECIPES) { // we currently don't check types for primitive variants - raise << maybe(caller_recipe.name) << "failed to find a matching call for '" << to_original_string(inst) << "'\n" << end(); + raise << maybe(caller_recipe.name) << "failed to find a matching call for '" << inst.original_string << "'\n" << end(); for (list<call>::iterator p = /*skip*/++resolve_stack.begin(); p != resolve_stack.end(); ++p) { const recipe& specializer_recipe = get(Recipe, p->running_recipe); const instruction& specializer_inst = specializer_recipe.steps.at(p->running_step_index); diff --git a/056shape_shifting_recipe.cc b/056shape_shifting_recipe.cc index 5cbbfa59..a4485f6c 100644 --- a/056shape_shifting_recipe.cc +++ b/056shape_shifting_recipe.cc @@ -276,9 +276,9 @@ void compute_type_names(recipe& variant) { instruction& inst = variant.steps.at(i); trace(9993, "transform") << " instruction: " << to_string(inst) << end(); for (int in = 0; in < SIZE(inst.ingredients); ++in) - save_or_deduce_type_name(inst.ingredients.at(in), type_names, variant, " in '" + to_original_string(inst) + "'"); + save_or_deduce_type_name(inst.ingredients.at(in), type_names, variant, " in '" + inst.original_string + "'"); for (int out = 0; out < SIZE(inst.products); ++out) - save_or_deduce_type_name(inst.products.at(out), type_names, variant, " in '" + to_original_string(inst) + "'"); + save_or_deduce_type_name(inst.products.at(out), type_names, variant, " in '" + inst.original_string + "'"); } } diff --git a/057immutable.cc b/057immutable.cc index 4513b5db..0d82c010 100644 --- a/057immutable.cc +++ b/057immutable.cc @@ -435,9 +435,9 @@ void check_immutable_ingredient_in_instruction(const instruction& inst, const se && current_ingredient_and_aliases.find(inst.products.at(i)) != current_ingredient_and_aliases.end()) { string current_product_name = inst.products.at(i).name; if (current_product_name == original_ingredient_name) - raise << maybe(caller.name) << "cannot modify '" << current_product_name << "' in instruction '" << to_original_string(inst) << "' because it's an ingredient of recipe " << caller.name << " but not also a product\n" << end(); + raise << maybe(caller.name) << "cannot modify '" << current_product_name << "' in instruction '" << inst.original_string << "' because it's an ingredient of recipe " << caller.name << " but not also a product\n" << end(); else - raise << maybe(caller.name) << "cannot modify '" << current_product_name << "' in instruction '" << to_original_string(inst) << "' because that would modify " << original_ingredient_name << " which is an ingredient of recipe " << caller.name << " but not also a product\n" << end(); + raise << maybe(caller.name) << "cannot modify '" << current_product_name << "' in instruction '" << inst.original_string << "' because that would modify " << original_ingredient_name << " which is an ingredient of recipe " << caller.name << " but not also a product\n" << end(); return; } } @@ -458,9 +458,9 @@ void check_immutable_ingredient_in_instruction(const instruction& inst, const se if (inst.operation == PUT || inst.operation == PUT_INDEX) { if (current_ingredient_index == 0) { if (current_ingredient_name == original_ingredient_name) - raise << maybe(caller.name) << "cannot modify '" << current_ingredient_name << "' in instruction '" << to_original_string(inst) << "' because it's an ingredient of recipe " << caller.name << " but not also a product\n" << end(); + raise << maybe(caller.name) << "cannot modify '" << current_ingredient_name << "' in instruction '" << inst.original_string << "' because it's an ingredient of recipe " << caller.name << " but not also a product\n" << end(); else - raise << maybe(caller.name) << "cannot modify '" << current_ingredient_name << "' in instruction '" << to_original_string(inst) << "' because that would modify '" << original_ingredient_name << "' which is an ingredient of recipe " << caller.name << " but not also a product\n" << end(); + raise << maybe(caller.name) << "cannot modify '" << current_ingredient_name << "' in instruction '" << inst.original_string << "' because that would modify '" << original_ingredient_name << "' which is an ingredient of recipe " << caller.name << " but not also a product\n" << end(); } } } @@ -468,9 +468,9 @@ void check_immutable_ingredient_in_instruction(const instruction& inst, const se // defined recipe if (is_modified_in_recipe(inst.operation, current_ingredient_index, caller)) { if (current_ingredient_name == original_ingredient_name) - raise << maybe(caller.name) << "cannot modify '" << current_ingredient_name << "' in instruction '" << to_original_string(inst) << "' because it's an ingredient of recipe " << caller.name << " but not also a product\n" << end(); + raise << maybe(caller.name) << "cannot modify '" << current_ingredient_name << "' in instruction '" << inst.original_string << "' because it's an ingredient of recipe " << caller.name << " but not also a product\n" << end(); else - raise << maybe(caller.name) << "cannot modify '" << current_ingredient_name << "' in instruction '" << to_original_string(inst) << "' because that would modify '" << original_ingredient_name << "' which is an ingredient of recipe " << caller.name << " but not also a product\n" << end(); + raise << maybe(caller.name) << "cannot modify '" << current_ingredient_name << "' in instruction '" << inst.original_string << "' because that would modify '" << original_ingredient_name << "' which is an ingredient of recipe " << caller.name << " but not also a product\n" << end(); } } } diff --git a/062rewrite_stash.cc b/062rewrite_stash.cc index 3fd57f12..5c6f28ca 100644 --- a/062rewrite_stash.cc +++ b/062rewrite_stash.cc @@ -119,7 +119,7 @@ put(Recipe_ordinal, "to-text", TO_TEXT); :(before "End Primitive Recipe Checks") case TO_TEXT: { if (SIZE(inst.ingredients) != 1) { - raise << maybe(get(Recipe, r).name) << "'to-text' requires a single ingredient, but got '" << to_original_string(inst) << "'\n" << end(); + raise << maybe(get(Recipe, r).name) << "'to-text' requires a single ingredient, but got '" << inst.original_string << "'\n" << end(); break; } // can handle any type diff --git a/065random.cc b/065random.cc index 4cec27bd..45bcfd7d 100644 --- a/065random.cc +++ b/065random.cc @@ -36,7 +36,7 @@ put(Recipe_ordinal, "round", ROUND); :(before "End Primitive Recipe Checks") case ROUND: { if (SIZE(inst.ingredients) != 1) { - raise << maybe(get(Recipe, r).name) << "'round' requires exactly one ingredient, but got '" << to_original_string(inst) << "'\n" << end(); + raise << maybe(get(Recipe, r).name) << "'round' requires exactly one ingredient, but got '" << inst.original_string << "'\n" << end(); break; } if (!is_mu_number(inst.ingredients.at(0))) { diff --git a/068hash.cc b/068hash.cc index 704ec6a1..457d1f9c 100644 --- a/068hash.cc +++ b/068hash.cc @@ -15,7 +15,7 @@ put(Recipe_ordinal, "hash", HASH); :(before "End Primitive Recipe Checks") case HASH: { if (SIZE(inst.ingredients) != 1) { - raise << maybe(get(Recipe, r).name) << "'hash' takes exactly one ingredient rather than '" << to_original_string(inst) << "'\n" << end(); + raise << maybe(get(Recipe, r).name) << "'hash' takes exactly one ingredient rather than '" << inst.original_string << "'\n" << end(); break; } break; @@ -351,7 +351,7 @@ put(Recipe_ordinal, "hash_old", HASH_OLD); :(before "End Primitive Recipe Checks") case HASH_OLD: { if (SIZE(inst.ingredients) != 1) { - raise << maybe(get(Recipe, r).name) << "'hash_old' takes exactly one ingredient rather than '" << to_original_string(inst) << "'\n" << end(); + raise << maybe(get(Recipe, r).name) << "'hash_old' takes exactly one ingredient rather than '" << inst.original_string << "'\n" << end(); break; } if (!is_mu_string(inst.ingredients.at(0))) { diff --git a/070recipe.cc b/070recipe.cc index 07e91c50..e41eb494 100644 --- a/070recipe.cc +++ b/070recipe.cc @@ -120,12 +120,12 @@ void check_indirect_calls_against_header(const recipe_ordinal r) { if (!callee_header.has_header) continue; for (long int i = /*skip callee*/1; i < min(SIZE(inst.ingredients), SIZE(callee_header.ingredients)+/*skip callee*/1); ++i) { if (!types_coercible(callee_header.ingredients.at(i-/*skip callee*/1), inst.ingredients.at(i))) - raise << maybe(caller.name) << "ingredient " << i-/*skip callee*/1 << " has the wrong type at '" << to_original_string(inst) << "'\n" << end(); + raise << maybe(caller.name) << "ingredient " << i-/*skip callee*/1 << " has the wrong type at '" << inst.original_string << "'\n" << end(); } for (long int i = 0; i < min(SIZE(inst.products), SIZE(callee_header.products)); ++i) { if (is_dummy(inst.products.at(i))) continue; if (!types_coercible(callee_header.products.at(i), inst.products.at(i))) - raise << maybe(caller.name) << "product " << i << " has the wrong type at '" << to_original_string(inst) << "'\n" << end(); + raise << maybe(caller.name) << "product " << i << " has the wrong type at '" << inst.original_string << "'\n" << end(); } } } @@ -234,7 +234,7 @@ def main [ } ] # error should be as if foo is not a recipe -+error: main: missing type for foo in 'break-if {foo: ()}' ++error: main: missing type for foo in 'break-if foo' :(before "End JUMP_IF Checks") check_for_recipe_literals(inst, get(Recipe, r)); diff --git a/071scheduler.cc b/071scheduler.cc index b675883c..3a5da648 100644 --- a/071scheduler.cc +++ b/071scheduler.cc @@ -342,7 +342,7 @@ put(Recipe_ordinal, "routine-state", ROUTINE_STATE); :(before "End Primitive Recipe Checks") case ROUTINE_STATE: { if (SIZE(inst.ingredients) != 1) { - raise << maybe(get(Recipe, r).name) << "'routine-state' requires exactly one ingredient, but got '" << to_original_string(inst) << "'\n" << end(); + raise << maybe(get(Recipe, r).name) << "'routine-state' requires exactly one ingredient, but got '" << inst.original_string << "'\n" << end(); break; } if (!is_mu_number(inst.ingredients.at(0))) { @@ -375,7 +375,7 @@ put(Recipe_ordinal, "restart", RESTART); :(before "End Primitive Recipe Checks") case RESTART: { if (SIZE(inst.ingredients) != 1) { - raise << maybe(get(Recipe, r).name) << "'restart' requires exactly one ingredient, but got '" << to_original_string(inst) << "'\n" << end(); + raise << maybe(get(Recipe, r).name) << "'restart' requires exactly one ingredient, but got '" << inst.original_string << "'\n" << end(); break; } if (!is_mu_number(inst.ingredients.at(0))) { @@ -403,7 +403,7 @@ put(Recipe_ordinal, "stop", STOP); :(before "End Primitive Recipe Checks") case STOP: { if (SIZE(inst.ingredients) != 1) { - raise << maybe(get(Recipe, r).name) << "'stop' requires exactly one ingredient, but got '" << to_original_string(inst) << "'\n" << end(); + raise << maybe(get(Recipe, r).name) << "'stop' requires exactly one ingredient, but got '" << inst.original_string << "'\n" << end(); break; } if (!is_mu_number(inst.ingredients.at(0))) { @@ -507,7 +507,7 @@ put(Recipe_ordinal, "limit-time", LIMIT_TIME); :(before "End Primitive Recipe Checks") case LIMIT_TIME: { if (SIZE(inst.ingredients) != 2) { - raise << maybe(get(Recipe, r).name) << "'limit-time' requires exactly two ingredient, but got '" << to_original_string(inst) << "'\n" << end(); + raise << maybe(get(Recipe, r).name) << "'limit-time' requires exactly two ingredient, but got '" << inst.original_string << "'\n" << end(); break; } if (!is_mu_number(inst.ingredients.at(0))) { @@ -545,7 +545,7 @@ put(Recipe_ordinal, "number-of-instructions", NUMBER_OF_INSTRUCTIONS); :(before "End Primitive Recipe Checks") case NUMBER_OF_INSTRUCTIONS: { if (SIZE(inst.ingredients) != 1) { - raise << maybe(get(Recipe, r).name) << "'number-of-instructions' requires exactly one ingredient, but got '" << to_original_string(inst) << "'\n" << end(); + raise << maybe(get(Recipe, r).name) << "'number-of-instructions' requires exactly one ingredient, but got '" << inst.original_string << "'\n" << end(); break; } if (!is_mu_number(inst.ingredients.at(0))) { diff --git a/072wait.cc b/072wait.cc index d2c9004e..3f69219f 100644 --- a/072wait.cc +++ b/072wait.cc @@ -59,7 +59,7 @@ put(Recipe_ordinal, "wait-for-location", WAIT_FOR_LOCATION); :(before "End Primitive Recipe Checks") case WAIT_FOR_LOCATION: { if (SIZE(inst.ingredients) != 1) { - raise << maybe(get(Recipe, r).name) << "'wait-for-location' requires exactly one ingredient, but got '" << to_original_string(inst) << "'\n" << end(); + raise << maybe(get(Recipe, r).name) << "'wait-for-location' requires exactly one ingredient, but got '" << inst.original_string << "'\n" << end(); break; } if (!is_mu_location(inst.ingredients.at(0))) { @@ -109,7 +109,7 @@ put(Recipe_ordinal, "get-location", GET_LOCATION); :(before "End Primitive Recipe Checks") case GET_LOCATION: { if (SIZE(inst.ingredients) != 2) { - raise << maybe(get(Recipe, r).name) << "'get-location' expects exactly 2 ingredients in '" << to_original_string(inst) << "'\n" << end(); + raise << maybe(get(Recipe, r).name) << "'get-location' expects exactly 2 ingredients in '" << inst.original_string << "'\n" << end(); break; } reagent/*copy*/ base = inst.ingredients.at(0); @@ -260,7 +260,7 @@ put(Recipe_ordinal, "wait-for-routine", WAIT_FOR_ROUTINE); :(before "End Primitive Recipe Checks") case WAIT_FOR_ROUTINE: { if (SIZE(inst.ingredients) != 1) { - raise << maybe(get(Recipe, r).name) << "'wait-for-routine' requires exactly one ingredient, but got '" << to_original_string(inst) << "'\n" << end(); + raise << maybe(get(Recipe, r).name) << "'wait-for-routine' requires exactly one ingredient, but got '" << inst.original_string << "'\n" << end(); break; } if (!is_mu_number(inst.ingredients.at(0))) { diff --git a/073deep_copy.cc b/073deep_copy.cc index 277459e1..59f71286 100644 --- a/073deep_copy.cc +++ b/073deep_copy.cc @@ -195,15 +195,15 @@ put(Recipe_ordinal, "deep-copy", DEEP_COPY); :(before "End Primitive Recipe Checks") case DEEP_COPY: { if (SIZE(inst.ingredients) != 1) { - raise << maybe(get(Recipe, r).name) << "'deep-copy' takes exactly one ingredient rather than '" << to_original_string(inst) << "'\n" << end(); + raise << maybe(get(Recipe, r).name) << "'deep-copy' takes exactly one ingredient rather than '" << inst.original_string << "'\n" << end(); break; } if (SIZE(inst.products) != 1) { - raise << maybe(get(Recipe, r).name) << "'deep-copy' takes exactly one ingredient rather than '" << to_original_string(inst) << "'\n" << end(); + raise << maybe(get(Recipe, r).name) << "'deep-copy' takes exactly one ingredient rather than '" << inst.original_string << "'\n" << end(); break; } if (!types_strictly_match(inst.ingredients.at(0), inst.products.at(0))) { - raise << maybe(get(Recipe, r).name) << "'deep-copy' requires its ingredient and product to be the same type, but got '" << to_original_string(inst) << "'\n" << end(); + raise << maybe(get(Recipe, r).name) << "'deep-copy' requires its ingredient and product to be the same type, but got '" << inst.original_string << "'\n" << end(); break; } break; diff --git a/080display.cc b/080display.cc index 49c6d071..8e890013 100644 --- a/080display.cc +++ b/080display.cc @@ -100,7 +100,7 @@ put(Recipe_ordinal, "print-character-to-display", PRINT_CHARACTER_TO_DISPLAY); :(before "End Primitive Recipe Checks") case PRINT_CHARACTER_TO_DISPLAY: { if (inst.ingredients.empty()) { - raise << maybe(get(Recipe, r).name) << "'print-character-to-display' requires at least one ingredient, but got '" << to_original_string(inst) << "'\n" << end(); + raise << maybe(get(Recipe, r).name) << "'print-character-to-display' requires at least one ingredient, but got '" << inst.original_string << "'\n" << end(); break; } if (!is_mu_number(inst.ingredients.at(0))) { @@ -186,7 +186,7 @@ put(Recipe_ordinal, "move-cursor-on-display", MOVE_CURSOR_ON_DISPLAY); :(before "End Primitive Recipe Checks") case MOVE_CURSOR_ON_DISPLAY: { if (SIZE(inst.ingredients) != 2) { - raise << maybe(get(Recipe, r).name) << "'move-cursor-on-display' requires two ingredients, but got '" << to_original_string(inst) << "'\n" << end(); + raise << maybe(get(Recipe, r).name) << "'move-cursor-on-display' requires two ingredients, but got '" << inst.original_string << "'\n" << end(); break; } if (!is_mu_number(inst.ingredients.at(0))) { diff --git a/082scenario_screen.cc b/082scenario_screen.cc index 20cf5c84..a3cf9393 100644 --- a/082scenario_screen.cc +++ b/082scenario_screen.cc @@ -156,6 +156,13 @@ if (curr.name == "assume-screen") { curr.products.at(0).set_value(SCREEN); } +:(scenario assume_screen_shows_up_in_errors) +% Hide_errors = true; +scenario error-in-assume-screen [ + assume-screen width, 5 +] ++error: scenario_error-in-assume-screen: missing type for 'width' in 'assume-screen width, 5' + //: screen-should-contain is a regular instruction :(before "End Primitive Recipe Declarations") SCREEN_SHOULD_CONTAIN, diff --git a/091run_interactive.cc b/091run_interactive.cc index 70dbed0f..b88333bd 100644 --- a/091run_interactive.cc +++ b/091run_interactive.cc @@ -30,7 +30,7 @@ put(Recipe_ordinal, "run-interactive", RUN_INTERACTIVE); :(before "End Primitive Recipe Checks") case RUN_INTERACTIVE: { if (SIZE(inst.ingredients) != 1) { - raise << maybe(get(Recipe, r).name) << "'run-interactive' requires exactly one ingredient, but got '" << to_original_string(inst) << "'\n" << end(); + raise << maybe(get(Recipe, r).name) << "'run-interactive' requires exactly one ingredient, but got '" << inst.original_string << "'\n" << end(); break; } if (!is_mu_string(inst.ingredients.at(0))) { @@ -436,7 +436,7 @@ put(Recipe_ordinal, "reload", RELOAD); :(before "End Primitive Recipe Checks") case RELOAD: { if (SIZE(inst.ingredients) != 1) { - raise << maybe(get(Recipe, r).name) << "'reload' requires exactly one ingredient, but got '" << to_original_string(inst) << "'\n" << end(); + raise << maybe(get(Recipe, r).name) << "'reload' requires exactly one ingredient, but got '" << inst.original_string << "'\n" << end(); break; } if (!is_mu_string(inst.ingredients.at(0))) { diff --git a/092persist.cc b/092persist.cc index e4838913..4f3d1494 100644 --- a/092persist.cc +++ b/092persist.cc @@ -9,7 +9,7 @@ put(Recipe_ordinal, "restore", RESTORE); :(before "End Primitive Recipe Checks") case RESTORE: { if (SIZE(inst.ingredients) != 1) { - raise << maybe(get(Recipe, r).name) << "'restore' requires exactly one ingredient, but got '" << to_original_string(inst) << "'\n" << end(); + raise << maybe(get(Recipe, r).name) << "'restore' requires exactly one ingredient, but got '" << inst.original_string << "'\n" << end(); break; } string filename; @@ -73,7 +73,7 @@ put(Recipe_ordinal, "save", SAVE); :(before "End Primitive Recipe Checks") case SAVE: { if (SIZE(inst.ingredients) != 2) { - raise << maybe(get(Recipe, r).name) << "'save' requires exactly two ingredients, but got '" << to_original_string(inst) << "'\n" << end(); + raise << maybe(get(Recipe, r).name) << "'save' requires exactly two ingredients, but got '" << inst.original_string << "'\n" << end(); break; } if (is_literal_string(inst.ingredients.at(0))) { |