diff options
-rw-r--r-- | 010vm.cc | 5 | ||||
-rw-r--r-- | 020run.cc | 8 | ||||
-rw-r--r-- | 038scheduler.cc | 4 | ||||
-rw-r--r-- | 047jump_label.cc | 3 | ||||
-rw-r--r-- | 060string.mu | 3 |
5 files changed, 21 insertions, 2 deletions
diff --git a/010vm.cc b/010vm.cc index 9b1641bd..c5e13543 100644 --- a/010vm.cc +++ b/010vm.cc @@ -183,7 +183,10 @@ reagent::reagent(string s) :value(0), initialized(false) { // structures for the first row of properties name = properties.at(0).first; for (index_t i = 0; i < properties.at(0).second.size(); ++i) { - types.push_back(Type_number[properties.at(0).second.at(i)]); + string type = properties.at(0).second.at(i); + if (Type_number.find(type) == Type_number.end()) + raise << "unknown type: " << type << '\n'; + types.push_back(Type_number[type]); } if (name == "_" && types.empty()) { types.push_back(0); diff --git a/020run.cc b/020run.cc index b93b7c98..32981fa6 100644 --- a/020run.cc +++ b/020run.cc @@ -239,3 +239,11 @@ recipe main [ _ <- copy 0:literal ] +run: instruction main/0 + +:(scenario run_warns_on_unknown_types) +% Hide_warnings = true; +recipe main [ + # integer is not a type + 1:integer <- copy 0:literal +] ++warn: unknown type: integer diff --git a/038scheduler.cc b/038scheduler.cc index 3d425d50..101d1960 100644 --- a/038scheduler.cc +++ b/038scheduler.cc @@ -123,6 +123,10 @@ Next_routine_id = 1; id = Next_routine_id; Next_routine_id++; +//: it needs a new type: 'recipe' +:(before "End Mu Types Initialization") +Type_number["recipe"] = 0; + //: routines save the routine that spawned them :(before "End routine Fields") // todo: really should be routine_id, but that's less efficient. diff --git a/047jump_label.cc b/047jump_label.cc index dd65c432..3158233b 100644 --- a/047jump_label.cc +++ b/047jump_label.cc @@ -10,6 +10,9 @@ recipe main [ ] -mem: storing 0 in location 1 +:(before "End Mu Types Initialization") +Type_number["label"] = 0; + :(after "int main") Transform.push_back(transform_labels); diff --git a/060string.mu b/060string.mu index d6921c8a..55dc0840 100644 --- a/060string.mu +++ b/060string.mu @@ -403,7 +403,7 @@ recipe interpolate [ { # while i < template.length tem-done?:boolean <- greater-or-equal i:number, tem-len:number - break-if tem-done?:boolean, 2:blocks + break-if tem-done?:boolean, +done:label # while template[i] != '_' in:character <- index template:address:array:character/deref, i:number underscore?:boolean <- equal in:character, 95:literal # '_' @@ -437,6 +437,7 @@ recipe interpolate [ i:number <- add i:number, 1:literal loop # interpolate next arg } + +done # done with holes; copy rest of template directly into result { # while i < template.length |