Sorry, that was redundant. The script focuses on the ambiguity between curly-closing-quotes / apostrophes. In that sense, open-quote characters are always unambiguous.
Questions are welcome, that's why I posted. I think the script is about as good I can make it, but there wasn't much point putting it online if I can't work out how to explain it

.