about summary refs log tree commit diff stats
path: root/cpp/029string
diff options
context:
space:
mode:
authorKartik K. Agaram <vc@akkartik.com>2015-03-31 10:17:19 -0700
committerKartik K. Agaram <vc@akkartik.com>2015-03-31 10:17:19 -0700
commit3d6c13dc432917de73e17a3fd301a4cc3a2d851b (patch)
treeca0d21377427b4bc8a31125895a451b173f1f74f /cpp/029string
parent5e21a9f608f413eb1df4736f4c143f18ba7ac1ec (diff)
downloadmu-3d6c13dc432917de73e17a3fd301a4cc3a2d851b.tar.gz
999
Diffstat (limited to 'cpp/029string')
-rw-r--r--cpp/029string11
1 files changed, 9 insertions, 2 deletions
diff --git a/cpp/029string b/cpp/029string
index 209a1e7f..6778a3c4 100644
--- a/cpp/029string
+++ b/cpp/029string
@@ -1,8 +1,9 @@
 //: Some instructions can take string literals for convenience.
 //:
 //: Instead of quotes, we'll use [] to delimit strings. That'll reduce the
-//: need for escaping. And we can also imagine that 'recipe' might one day
-//: itself be defined in mu, doing its own parsing.
+//: need for escaping since we can support nested brackets. And we can also
+//: imagine that 'recipe' might one day itself be defined in mu, doing its own
+//: parsing.
 
 //: First extend the mu parser to support string literals.
 :(scenario "string_literal")
@@ -35,6 +36,12 @@ string slurp_quoted(istream& in) {
   return out.str();
 }
 
+:(scenario "string_literal_nested")
+recipe main [
+  1:address:array:character <- new [abc [def]]
+]
++parse:   ingredient: {name: "abc [def]", value: 0, type: 0, properties: ["abc [def]": "literal-string"]}
+
 //: Next, extend 'new' to handle a string literal argument.
 :(scenario "new_string")
 recipe main [