Fix LiveScript string and comment highlighting

Only change `state.next` if `r.next` is defined, check if `r.regex` is a String before converting it into a RegExp (in the optimization step). Closes #2474.