[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: cc-mode fontification feels random
From: |
Stephen Leake |
Subject: |
Re: cc-mode fontification feels random |
Date: |
Sun, 11 Jul 2021 11:12:04 -0700 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (windows-nt) |
Daniel Colascione <dancol@dancol.org> writes:
> ... cc-mode is still very inconsistent in
> fontification though. Take a look at the attached screenshot, which is
> of this program:
>
> void
> deallocate_one_arg(void* const ptr_to_arg,
> MethodProgramPc& pc);
>
> void
> deallocate_one_arg(void* const ptr_to_arg,
> MethodProgramPc& pc);
>
> I'm confused about why "MethodProgramPc" is fontified as a type in the
> first prototype but not the second. I still wish we had a
> general-purpose mechanism for ensuring that problems like this didn't
> happen.
The ELPA package wisi provides a parser-based fontification engine,
which makes things like this more consistent. It is currently used for
ada-mode. Note that syntax errors in the source can cause bad
fontification, but the wisi parser has very robust error-correction, so
it usually does a good job even with syntax errors.
However, parsing C and C++ is complicated by macros; wisi makes no
provision for that.
Another option is an LSP based system via the EPLA package eglot; that
delegates fontification to the language server. I don't know how well
the C/C++ language servers perform for this.
--
-- Stephe
- Re: cc-mode fontification feels random, Daniel Colascione, 2021/07/09
- Re: cc-mode fontification feels random,
Stephen Leake <=
- Re: cc-mode fontification feels random, Perry E. Metzger, 2021/07/15
- Tree Sitter (was Re: cc-mode fontification feels random), Perry E. Metzger, 2021/07/15
- Re: Tree Sitter (was Re: cc-mode fontification feels random), Stephen Leake, 2021/07/19
- Re: Tree Sitter (was Re: cc-mode fontification feels random), Perry E. Metzger, 2021/07/20
- Re: Tree Sitter (was Re: cc-mode fontification feels random), Stephen Leake, 2021/07/20
- Re: Tree Sitter (was Re: cc-mode fontification feels random), Stefan Monnier, 2021/07/20
- Re: Tree Sitter (was Re: cc-mode fontification feels random), Perry E. Metzger, 2021/07/21
- Re: Tree Sitter (was Re: cc-mode fontification feels random), Daniel Colascione, 2021/07/21
- Re: Tree Sitter (was Re: cc-mode fontification feels random), Perry E. Metzger, 2021/07/21
- Re: Tree Sitter (was Re: cc-mode fontification feels random), Daniel Colascione, 2021/07/21