Fix LiveScript string and comment highlighting

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