I'm making a program that uses a richedit control and has to do syntax highlighting to the text. I figured out how to do the most part, but it remains a problem :
It's not difficult to highlight ML comments if I parse the whole text every time, but that is, obviously, incredibly slow. So I have to parse only the lines that were actually changed.
The problem is, when I have to parse a line, the parser needs to know if that line is to be highlighted normally or if is to be highlighted as a comment (if the line is inside a ML comment).
How can I know if a line is inside a ML comment ?
Note: I focused on the ML comments, but it can also exist multi-line strings in the same text.