diff options
author | Kartik K. Agaram <vc@akkartik.com> | 2016-08-31 13:15:29 -0700 |
---|---|---|
committer | Kartik K. Agaram <vc@akkartik.com> | 2016-08-31 13:15:29 -0700 |
commit | 376b333a39445bba51ab9210e1a32f18e86da4e6 (patch) | |
tree | 54ca98803cd2ba221f21fea0d45279a635b69ddd /010vm.cc | |
parent | ce2e604ec97259cbc143f9b6ae429b45d33a836f (diff) | |
download | mu-376b333a39445bba51ab9210e1a32f18e86da4e6.tar.gz |
3286
Diffstat (limited to '010vm.cc')
-rw-r--r-- | 010vm.cc | 22 |
1 files changed, 21 insertions, 1 deletions
diff --git a/010vm.cc b/010vm.cc index 7afb3d4f..2238c897 100644 --- a/010vm.cc +++ b/010vm.cc @@ -340,7 +340,7 @@ type_tree::type_tree(const type_tree& old) { right = old.right ? new type_tree(*old.right) : NULL; } -string_tree::string_tree(const string_tree& old) { // :value(old.value) { +string_tree::string_tree(const string_tree& old) { value = old.value; left = old.left ? new string_tree(*old.left) : NULL; right = old.right ? new string_tree(*old.right) : NULL; @@ -385,6 +385,26 @@ string_tree::~string_tree() { delete right; } +void append(type_tree*& base, type_tree* extra) { + if (!base) { + base = extra; + return; + } + type_tree* curr = base; + while (curr->right) curr = curr->right; + curr->right = extra; +} + +void append(string_tree*& base, string_tree* extra) { + if (!base) { + base = extra; + return; + } + string_tree* curr = base; + while (curr->right) curr = curr->right; + curr->right = extra; +} + string slurp_until(istream& in, char delim) { ostringstream out; char c; |