← Back to context

Comment by kazinator

4 months ago

> And we just use it to distinguish syntax.

To some extent syntax highlighting distinguishes bad syntax from good; it can be configured to flag deviations from token-level or even grammar-level syntax. For instance, not closing a string literal, or bungling a numeric token with nondigits.

In all the syntax that is good, it mainly just assigns colors to lexical categories, which have a role within syntax.

It does that while retaining some channel capacity for other functions,like matches for regex searches still being highlighted, and visual selections of text being highlighted. (The channel is not exclusively occupied by syntax coloring to the point that no other information can squeeze in there concurrently.)