Hi Lee.
Thanks for the comments. Actually, your fix was dead-on.
Turns out the default case for the single-quotes will handle what you're talking about above. Even your questions about "boundary conditions" (end-of-line -- technically, end of paragraph -- and whatnot) would be handled correctly.
The part that caused the crash is a check for the NEXT single-quote, not the one the algorithm is currently changing into curly-open/close. Why I do this involves typographic conventions for contractions ("tell 'im to go to away") vs. quotations ('go away') -- they're different. The algorithm is trying to decide the "right thing" by looking ahead. Avoiding the crash is what matters at that point, and then the default case will be correct (if next quote's at end-of-line, the current one is an open-quote).
I just have to post your fix as promised... and I don't have "too much sushi!" as an excuse this morning.
-Pie