about summary refs log tree commit diff stats
path: root/040brace.cc
diff options
context:
space:
mode:
authorKartik K. Agaram <vc@akkartik.com>2015-10-06 22:15:45 -0700
committerKartik K. Agaram <vc@akkartik.com>2015-10-06 22:15:45 -0700
commit5f98a10cc78829a03c9fa5a137392e7d5e9030ac (patch)
treeb88536e28f6d507c4b68b337423c0b6a4e28306c /040brace.cc
parent75aa3a98e2b9311d65df91523ec754d5a2770456 (diff)
downloadmu-5f98a10cc78829a03c9fa5a137392e7d5e9030ac.tar.gz
2258 - separate warnings from errors
At the lowest level I'm reluctantly starting to see the need for errors
that stop the program in its tracks. Only way to avoid memory corruption
and security issues. But beyond that core I still want to be as lenient
as possible at higher levels of abstraction.
Diffstat (limited to '040brace.cc')
-rw-r--r--040brace.cc20
1 files changed, 10 insertions, 10 deletions
diff --git a/040brace.cc b/040brace.cc
index d5e89a6c..ba8e9fd6 100644
--- a/040brace.cc
+++ b/040brace.cc
@@ -76,7 +76,7 @@ void transform_braces(const recipe_ordinal r) {
     // check for errors
     if (inst.name.find("-if") != string::npos || inst.name.find("-unless") != string::npos) {
       if (inst.ingredients.empty()) {
-        raise << inst.name << " expects 1 or 2 ingredients, but got none\n" << end();
+        raise_error << inst.name << " expects 1 or 2 ingredients, but got none\n" << end();
         continue;
       }
     }
@@ -107,7 +107,7 @@ void transform_braces(const recipe_ordinal r) {
     target.types.push_back(Type_ordinal["offset"]);
     target.set_value(0);
     if (open_braces.empty())
-      raise << inst.name << " needs a '{' before\n" << end();
+      raise_error << inst.name << " needs a '{' before\n" << end();
     else if (inst.name.find("loop") != string::npos)
       target.set_value(open_braces.top()-index);
     else  // break instruction
@@ -132,7 +132,7 @@ long long int matching_brace(long long int index, const list<pair<int, long long
     stacksize += (p->first ? 1 : -1);
     if (stacksize == 0) return p->second;
   }
-  raise << maybe(Recipe[r].name) << "unbalanced '{'\n" << end();
+  raise_error << maybe(Recipe[r].name) << "unbalanced '{'\n" << end();
   return SIZE(Recipe[r].steps);  // exit current routine
 }
 
@@ -279,7 +279,7 @@ recipe main [
 +after-brace: jump 2:offset
 
 :(scenario break_label)
-% Hide_warnings = true;
+% Hide_errors = true;
 recipe main [
   1:number <- copy 0
   {
@@ -361,18 +361,18 @@ recipe test-factorial [
 ]
 +mem: location 2 is 120
 
-:(scenario break_outside_braces_warns)
-% Hide_warnings = true;
+:(scenario break_outside_braces_fails)
+% Hide_errors = true;
 recipe main [
   break
 ]
-+warn: break needs a '{' before
++error: break needs a '{' before
 
-:(scenario break_conditional_without_ingredient_warns)
-% Hide_warnings = true;
+:(scenario break_conditional_without_ingredient_fails)
+% Hide_errors = true;
 recipe main [
   {
     break-if
   }
 ]
-+warn: break-if expects 1 or 2 ingredients, but got none
++error: break-if expects 1 or 2 ingredients, but got none