about summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorKartik K. Agaram <vc@akkartik.com>2015-07-28 16:51:23 -0700
committerKartik K. Agaram <vc@akkartik.com>2015-07-28 16:51:23 -0700
commit7002b921c92de28c1f9f9aebfb5781485580854b (patch)
treebaf34d5357bba379b6402dcdac5e81e8f84f0546
parent1f59be846a68a5a4ec456b4104a94e421d135cf1 (diff)
downloadmu-7002b921c92de28c1f9f9aebfb5781485580854b.tar.gz
1877 - shorten /lookup property to prefix '*'
-rw-r--r--031address.cc20
1 files changed, 20 insertions, 0 deletions
diff --git a/031address.cc b/031address.cc
index a069f332..d139c4cf 100644
--- a/031address.cc
+++ b/031address.cc
@@ -104,6 +104,26 @@ recipe main [
 :(after "reagent base = " following "case GET_ADDRESS:")
 base = canonize(base);
 
+//:: abbreviation for '/lookup': a prefix '*'
+
+:(scenario lookup_abbreviation)
+recipe main [
+  1:address:number <- copy 2
+  2:number <- copy 34
+  3:number <- copy *1:address:number
+]
++mem: storing 34 in location 3
+
+:(before "End Parsing reagent")
+{
+  while (!name.empty() && name.at(0) == '*') {
+    name.erase(0, 1);
+    properties.push_back(pair<string, vector<string> >("lookup", vector<string>()));
+  }
+  if (name.empty())
+    raise << "illegal name " << original_string << '\n' << end();
+}
+
 //:: helpers for debugging
 
 :(before "End Primitive Recipe Declarations")