unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: Alan Mackenzie <acm@muc.de>
To: "Óscar Fuentes" <ofv@wanadoo.es>
Cc: emacs-devel@gnu.org
Subject: Re: Help sought from C++ expert: is this `value' a type or something else (what)?
Date: Sat, 21 Jan 2023 14:59:50 +0000	[thread overview]
Message-ID: <Y8v95qXEIItuRmHT@ACM> (raw)
In-Reply-To: <87sfg68pf2.fsf@telefonica.net>

Hello, Óscar.

On Thu, Jan 19, 2023 at 17:22:41 +0100, Óscar Fuentes wrote:
> Alan Mackenzie <acm@muc.de> writes:

> > Hello, Emacs.
> >
> > In the following test file, templates-9.cc from the CC Mode test suite,
> > on the indicated line, what is the syntactic significance of `value'?
> > Traditionally, it has fontified with the default face, but recently after
> > some (not yet committed) changes in CC Mode, it has started getting
> > font-lock-type-face.
> >
> > I don't understand the file at all, hardly, and can't work out whether
> > the old (non-) fontification was correct, or whether the new
> > fontification of f-l-type-face is correct.  Help would be appreciated.
> >
> > Just as a matter of interest, in c++-ts-mode a treesit-query-error gets
> > thrown.  It isn't clear to me whether the file is still valid C++.

> It is not valid C++ because it misses quite a few declarations.

Yes.  Michael Duggan has identified the file as part of an early boost
source, and clearly there are bits missing.

> The parser has no way of knowing what `value' is unless it can see the
> relevant declarations. And even then, in the general case, it is not
> possible to really know unless your "parser" is, actually, a C++ front
> end. So both c++-mode and c++-ts-mode are out of their breadth here.

c++-ts-mode is a little disappointing, here.  It displays virtually
everything (including "value") in font-lock-type-face.

I've managed to track down the bug in my uncommitted CC Mode changes and
fix it.

> IMAO, a reasonable heuristic is to consider it a value unless it is
> preceded by `typename'.

Yes.  That is the general consensus from all who answered me, so a big
thank you to yourself and the other people!

-- 
Alan Mackenzie (Nuremberg, Germany).



      reply	other threads:[~2023-01-21 14:59 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-01-19 14:53 Help sought from C++ expert: is this `value' a type or something else (what)? Alan Mackenzie
2023-01-19 14:59 ` Eli Zaretskii
2023-01-19 17:14   ` Difficulty building tree-sitter grammars [was: Help sought from C++ expert: ....] Alan Mackenzie
2023-01-19 17:53     ` Dmitry Gutov
2023-01-19 18:06       ` Eli Zaretskii
2023-01-19 18:16         ` Dmitry Gutov
2023-01-19 17:53     ` Eli Zaretskii
2023-01-19 20:56       ` Alan Mackenzie
2023-01-20  6:44         ` Eli Zaretskii
2023-01-19 15:41 ` Help sought from C++ expert: is this `value' a type or something else (what)? Michael Welsh Duggan
2023-01-21 14:34   ` Alan Mackenzie
2023-01-19 16:22 ` Óscar Fuentes
2023-01-21 14:59   ` Alan Mackenzie [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=Y8v95qXEIItuRmHT@ACM \
    --to=acm@muc.de \
    --cc=emacs-devel@gnu.org \
    --cc=ofv@wanadoo.es \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).