rewrite.py: improve pattern matching language
rewrite.py: improve pattern matching language

* Change syntax for matching 1 arbitrary item from 'foo' to '.foo'
* Support matching against literals
* Add tests

alexey4petrov/reinteract,alexey4petrov/reinteract,alexey4petrov/reinteract