4 ms·
"Lexical coloring" or "Lexical color-coding" would be even more appropriate. However, you are slightly wrong, depending on the coloring engine and language. T
by kazinator 11y ago
"Lexical coloring" or "Lexical color-coding" would be even more appropriate.
However, you are slightly wrong, depending on the coloring engine and language.
The syntax coloring algorithm in Vim handles nested syntax. (To what extent is up to the developer of the syntax file.)
You can see some of that at work here: http://www.kylheku.com/cgit/txr/tree/tests/011/txr-case.txr http://www.kylheku.com/cgit/txr/tree/tests/011/txr-case.txr
(This is being colorized by invoking Vim out of Apache on-the-fly.)
Here we can see that a Lisp dialect is embedded in a special-purpose language. The functions and operators of the Lisp dialect are colored green, but those in the special purpose language are purple. This is worked out even in situations when the are the same symbol. E.g. both languages have a "do" operator.
Vim doesn't handle nesting with a formal context-free grammar. Rather, it allows named regions to be defined, and highlighting matches can be declared as occurring only in specific regions. Regions can also be in regions. You can get very accurate coloring; but it can also be slow at times.