> So if you want to color every different part like operators, symbols, braces, with a different color, and you try to do this on C++, it is not going to be a small task...
For a lot of modes, Emacs does this using regex.
Running a regex each time you type a character seems a little heavy to me...
Regex'ing languages like HTML or C++ can be quite mind breaking... I think.
Re:Build Your Own Text Editor
by thomastjeffery on Friday April 07, 2017 @10:48PM
(#14065002)
Ropes are pretty sweet. I still prefer a piece table, just because of the sheer simplicity.
The syntax highlighting functionality alone is a combination of something as complex as what a compiler/parser does, and you have to do it almost in real time.
So if you want to color every different part like operators, symbols, braces, with a different color, and you try to do this on C++, it is not going to be a small task...
Also something you learn about text editors is the rope data structure. https://en.wikipedia.org/wiki/Rope_(data_structure)