about summary refs log tree commit diff stats
path: root/cpp/031address.cc
diff options
context:
space:
mode:
authorKartik K. Agaram <vc@akkartik.com>2015-04-28 22:45:38 -0700
committerKartik K. Agaram <vc@akkartik.com>2015-04-28 22:55:04 -0700
commitc51043abdf83243f81685858d8f76793faed042b (patch)
tree362afefaa547dc1f8dd490947056a558d5fe3b17 /cpp/031address.cc
parente3fa6cc7af792a6c0d83d9004859d6e9452c5fdb (diff)
downloadmu-c51043abdf83243f81685858d8f76793faed042b.tar.gz
1217 - string literals weren't handling later comments
Diffstat (limited to 'cpp/031address.cc')
-rw-r--r--cpp/031address.cc25
1 files changed, 18 insertions, 7 deletions
diff --git a/cpp/031address.cc b/cpp/031address.cc
index fd713a22..fd9037b1 100644
--- a/cpp/031address.cc
+++ b/cpp/031address.cc
@@ -41,13 +41,6 @@ reagent canonize(reagent x) {
   return r;
 }
 
-bool has_property(reagent x, string name) {
-  for (size_t i = 0; i < x.properties.size(); ++i) {
-    if (x.properties[i].first == name) return true;
-  }
-  return false;
-}
-
 reagent deref(reagent x) {
 //?   cout << "deref: " << x.to_string() << "\n"; //? 2
   static const int ADDRESS = Type_number["address"];
@@ -117,3 +110,21 @@ recipe main [
 
 :(after "reagent base = " following "case GET_ADDRESS:")
 base = canonize(base);
+
+//:: helpers
+
+:(code)
+bool has_property(reagent x, string name) {
+  for (size_t i = 0; i < x.properties.size(); ++i) {
+    if (x.properties[i].first == name) return true;
+  }
+  return false;
+}
+
+vector<string> property(const reagent& r, const string& name) {
+  for (size_t p = 0; p != r.properties.size(); ++p) {
+    if (r.properties[p].first == name)
+      return r.properties[p].second;
+  }
+  return vector<string>();
+}