emacs-devel
[Top][All Lists]
Advanced

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

Re: Call for volunteers: add tree-sitter support to major modes


From: Eli Zaretskii
Subject: Re: Call for volunteers: add tree-sitter support to major modes
Date: Thu, 20 Oct 2022 09:12:24 +0300

> From: Po Lu <luangruo@yahoo.com>
> Cc: emacs-devel@gnu.org,  casouri@gmail.com,  acm@muc.de,  theo@thornhill.no
> Date: Thu, 20 Oct 2022 08:19:28 +0800
> 
> Eli Zaretskii <eliz@gnu.org> writes:
> 
> > This part definitely isn't valid:
> >
> >   extern maybe_tls (int) errno;
> >
> >  $ gcc -c buggy_c.c
> >  buggy_c.c: In function 'maybe_tls':
> >  buggy_c.c:1:26: error: expected declaration specifiers before 'errno'
> >      1 |   extern maybe_tls (int) errno;
> >        |                          ^~~~~
> >  buggy_c.c:1:21: error: parameter name omitted
> >      1 |   extern maybe_tls (int) errno;
> >        |                     ^~~
> >  buggy_c.c:2: error: expected '{' at end of input
> 
> Well, what if tree-sitter is given the following macro definition?
> 
> #    if !defined (LinkTargetKO) && !defined (__cc_lint__)
> #    define maybe_tls(type) _task_local_/**/type
> #    else
> #    define maybe_tls(type) type
> #    endif

If you use macros to selectively remove parts of the source at
critical places, you can completely change how the source code is seen
by the parser.

I don't know how tree-sitter processes macro definitions, but maybe
someone else will.

> Trust me, I have my own bad experiences with CC Mode fontification.  See
> the slew of bugs I found and reported with Emacs 29's CC Mode just this
> week: bug#58537, bug#58534, bug#58539.  My problem is the blanket
> dismissal of what CC Mode actually gets right that seems to be
> alarmingly prevalent around here ("... in Emacs 30, let's get rid of CC
> Mode!")

No one seriously intends to throw away what CC Mode does, let alone
dismiss it in a blanket manner.  This is a strawman.  This discussion
has a lot of noise, but you should be experienced enough to know whose
voices to hear and whose to dismiss as merely a personal opinion that
has no bearing on what will actually happen in Emacs.

> I agree that's bad, but so is the tree-sitter fontification of K&R
> areas.

We need to get our priorities right.



reply via email to

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