V
V
Vyacheslav2016-03-23 19:57:05
IDE
Vyacheslav, 2016-03-23 19:57:05

How is code highlighting done in different IDEs?

It's interesting how this works in general. Algorithms, tools. I want to make a simple code editor in c #, I stumbled on the correct highlighting. Now done through regexp on a set of keywords, but I don't think it's correct. I would like to know at least in theory.

Answer the question

In order to leave comments, you need to log in

2 answer(s)
A
Alexander Evseev, 2016-03-31
@Firik67

For starters, you can see how this is done in other ready-made components
- www.codeproject.com/Articles/161871/Fast-Colored-T...
- codesharper.codeplex.com
- stackoverflow.com/questions/2973861/open-source- c-...
- stackoverflow.com/questions/1697360/how-to-syntax-...
And if we talk about serious IDEs, then of course they do not do regexps, but constantly parse the text and build a syntax tree , since this, in addition to syntax highlighting, also gives an "understanding" of the code (what classes, methods, etc. are there).
Now on .NET 4.5 you can use Roslyn:
sergeyteplyakov.blogspot.ru/2015/03/syntax-highlig...

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question