rasham: fix more rope bugs and implement a simple pattern matching ostream

Signed-off-by: Alex Dubov <oakad@yahoo.com>