about summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorKartik K. Agaram <vc@akkartik.com>2016-09-11 17:53:11 -0700
committerKartik K. Agaram <vc@akkartik.com>2016-09-11 17:53:11 -0700
commit621c64b538500528e4d95b32888a0eaf5dffeec8 (patch)
tree23e3bfb8f712b4360a7c1808f3b98f38842516ba
parentcdf0f349d1ad432d785cf69c7a136fff07258adf (diff)
downloadmu-621c64b538500528e4d95b32888a0eaf5dffeec8.tar.gz
3325
-rw-r--r--018type_abbreviations.cc16
1 files changed, 14 insertions, 2 deletions
diff --git a/018type_abbreviations.cc b/018type_abbreviations.cc
index 9e907ae9..1fc0f432 100644
--- a/018type_abbreviations.cc
+++ b/018type_abbreviations.cc
@@ -69,13 +69,18 @@ void load_type_abbreviations(istream& in) {
 }
 
 type_tree* new_type_tree(const string& x) {
-  string_tree* type_names = new string_tree(x);
-  type_names = parse_string_tree(type_names);
+  string_tree* type_names = starts_with(x, "(") ? parse_string_tree(x) : parse_string_list(x);
   type_tree* result = new_type_tree(type_names);
   delete type_names;
   return result;
 }
 
+string_tree* parse_string_list(const string& s) {
+  istringstream in(s);
+  in >> std::noskipws;
+  return parse_property_list(in);
+}
+
 :(scenario type_error1)
 % Hide_errors = true;
 type foo
@@ -97,6 +102,13 @@ type foo = bar
 type foo = baz
 +error: 'type' conflict: 'foo' defined as both 'bar' and 'baz'
 
+:(scenario type_abbreviation_for_compound)
+type foo = address:number
+def main [
+  a:foo <- copy 0
+]
++run: {a: ("address" "number")} <- copy {0: "literal"}
+
 //:: A few default abbreviations.
 
 :(before "End Mu Types Initialization")