Geez @moors, take a look around trunk, I've written some code you can use if you're feeling crazy. (Didn't this logic have to exist somewhere for the old pattern matcher?)