Fix parsing of raw strings containing unclosed parentheses and brackets

Strings like `r'['` and `r'('` were causing the rest of the document to be parsed as if it were inside the regex. Now we terminate the regex at the closing quote in all cases.

This is a backport of https://github.com/textmate/python.tmbundle/commit/2567262452b389f7042ef3026e0443f6336d1735

/cc @vmg
You're right. I guess I should make the tests sensitive to that bug.