Improvements for highlighting mixed languages

and some cleanup

fixes https://github.com/ajaxorg/ace/issues/1588 https://github.com/ajaxorg/ace/issues/1589 https://github.com/ajaxorg/ace/issues/1529

@lennartcl