Enable regular expressions for contexts

This introduces `ContextPattern`, a regular expression context matcher, for #47.  It also wreaks a little havoc on the SPI.

Still have to fix the context match sorting.  Need to do:

- [x] add a test that can detect the problem (hopefully)
- [x] get rid of positions
- [x] get rid of excluded match elements
- [x] expose type distance
- [x] first compare ignoring type distance
- [x] then compare type distance