diff options
author | Kartik K. Agaram <vc@akkartik.com> | 2015-10-25 11:55:35 -0700 |
---|---|---|
committer | Kartik K. Agaram <vc@akkartik.com> | 2015-10-25 12:18:32 -0700 |
commit | a796831f3e5697de7194607cfff3efddc588978a (patch) | |
tree | 6661d40bebcc816e3f86b94425991827eb0d496b /013literal_string.cc | |
parent | 61286c8d694f94d41fae7ac8b4c6ec2c6945b7bc (diff) | |
download | mu-a796831f3e5697de7194607cfff3efddc588978a.tar.gz |
2273 - start expanding the type system
Current plan: parsing {x: foo, y: bar} syntax for reagents parsing s-expr syntax for properties supporting reverse instructions (<-) parsing s-expr syntax for recipe headers (recipe number number -> number) static dispatch generic functions type-checking higher-order functions type of delimited continuations? need more type information First step is done, and the second partially so.
Diffstat (limited to '013literal_string.cc')
-rw-r--r-- | 013literal_string.cc | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/013literal_string.cc b/013literal_string.cc index 98cc85e7..78b15f18 100644 --- a/013literal_string.cc +++ b/013literal_string.cc @@ -109,7 +109,7 @@ if (s.at(0) == '[') { assert(*s.rbegin() == ']'); // delete [] delimiters s.erase(0, 1); - s.erase(SIZE(s)-1); + strip_last(s); name = s; types.push_back(0); properties.push_back(pair<string, vector<string> >(name, vector<string>())); @@ -145,6 +145,10 @@ size_t replace(string& str, const string& from, const string& to, size_t n) { return result; } +void strip_last(string& s) { + if (!s.empty()) s.erase(SIZE(s)-1); +} + :(scenario string_literal_nested) recipe main [ 1:address:array:character <- copy [abc [def]] |