wizcool
asked on
multi-line comments in syntax highlighting
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 :
multi-line comments!
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.
multi-line comments!
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.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
It worked great, scrapdog.
Thanks
Thanks
That's great. You're welcome.
ASKER
I will implement it and then let you know (it shouldn't take long) :)