emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: cc-mode fontification feels random


From: Daniel Colascione
Subject: Re: cc-mode fontification feels random
Date: Thu, 10 Jun 2021 00:01:38 -0700
User-agent: AquaMail/1.29.2-1810 (build: 102900008)



On June 9, 2021 1:36:42 PM Stefan Monnier <monnier@iro.umontreal.ca> wrote:

That's a rather negative way of putting things, which is a bit indefinite
and wishy-washy.  You could instead try to specify which tokens should get
font-lock-type-face and which shouldn't, thus giving something concrete
to discuss.  I think this will be difficult to do well, and may lead to
the result which I alluded to above.

It has to be said also that C/C++ is quite unusual in that knowing which
identifier is a type is necessary for correct parsing.  If it weren't
so, we could reliably highlight types not based on their name but based
on their location in the syntax.

I think an approach like that of tree-sitter should be able (at least in
theory) to give reasonably good highlighting of types based on their
position (tho sadly not in those cases where the syntax is ambiguous).

The model I've had in mind for dealing with parse ambiguity is an incremental GLR parser generating a parse forest, pruning the forest by constraint solving on ad-hoc language specific constraints, then picking one of the remaining parse trees incrementally to fontify.





reply via email to

[Prev in Thread] Current Thread [Next in Thread]