Comment by jokoon
10 years ago
I also tried to make an editor 5 years ago, because I was not satisfied by either notepad++ or sublime text. I was checking out notepad++'s code, and I was quite amazed by the fact that making a text editor was not some simple task.
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)
> 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.
Ropes are pretty sweet. I still prefer a piece table, just because of the sheer simplicity.