replace q with more correct (and more correctly named) repr function

`q` was an appropriate name when this function just quoted strings; `repr` better describes the current function.

This pull request fixes the handling of `\` and `"` in string arguments.