Rework to support nested arrays properly.

This changes how parsing works almost entirely by using a stateful input
stream rather than simply pattern matching. This was heavily inspired by
Arto Bendiken's php-s11n for Chicken Scheme
(c.f. http://wiki.call-cc.org/eggref/4/php-s11n).