I have a string that contains a list of elements, some of which are fixed and some of which are pickable. As an example let's say my string is a grocery list:
"strawberry, raspberry, $2{tomato, sauerkraut, beans},
potato, $1{{apple, pear}, {orange, banana}}"
And I would like to end up with something like:
["strawberry",
"raspberry",
[2, "tomato", "sauerkraut", "beans"],
"potato",
[1, ["apple", "pear"], ["orange", "banana"]]
I have no idea how can I tackle the multiple choices here so I'm open to any and all suggestions. Also you can modify the "syntax" (eg "$[num of coices]{list}") and add/remove fluff, it doesn't really matter. The simpler the merrirer! :]
edit: I have bazillions of these lists in the above format and converting them by hand is not an option unless there is no other solution... :(
Thanks!