preliminary support for parsing and printing split queries

Peter, can you take a quick look and see if this seems like a reasonable approach so far?
I assume you intend to bring these test cases back? (Likewise, the ones below.)