diff options
author | Kartik K. Agaram <vc@akkartik.com> | 2015-04-28 22:45:38 -0700 |
---|---|---|
committer | Kartik K. Agaram <vc@akkartik.com> | 2015-04-28 22:55:04 -0700 |
commit | c51043abdf83243f81685858d8f76793faed042b (patch) | |
tree | 362afefaa547dc1f8dd490947056a558d5fe3b17 /cpp/031address.cc | |
parent | e3fa6cc7af792a6c0d83d9004859d6e9452c5fdb (diff) | |
download | mu-c51043abdf83243f81685858d8f76793faed042b.tar.gz |
1217 - string literals weren't handling later comments
Diffstat (limited to 'cpp/031address.cc')
-rw-r--r-- | cpp/031address.cc | 25 |
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>(); +} |