public inbox for gcc@gcc.gnu.org
 help / color / mirror / Atom feed
From: Alan Mackenzie <acm@muc.de>
To: gcc@gcc.gnu.org
Subject: Help requested on C++ template syntax (for Emacs development).
Date: Tue, 10 Jun 2008 18:15:00 -0000	[thread overview]
Message-ID: <20080610183707.GB4844@muc.de> (raw)

Hi, GCC list!

Apologies if this isn't the right place to ask, but it seems like a good
place to find experts on C++ and Java syntax.  If there's a better place
to ask, would somebody give me a pointer, please.

I'm the maintainer of Emacs's CC Mode, which includes modes for C, C++,
Java, etc.

Currently, C++ templates are not handled 100% accurately by C++ mode -
neither are generics in Java mode, for that matter.  I want to fix this.
My knowledge of C++ is moderate rather than comprehensive.

So, the question: is it possible to identify with 100% certainty, PURELY
SYNTACTICALLY (i.e. without access to the compiler's symbol table),
when "< ... >" is a pair of template (C++) or generic (Java) brackets?

I'm thinking of things like

    foo (a < b, c > d);

I think this is unambiguously a function call with 2 parameters, the
expressions "a < b" and "c > d".  It cannot be be one with 1 parameter
beginning with the template invocation "a < b , c >".  Or can it?

I believe that a pair of template brackets cannot enclose a semicolon,
for example.

Another related question: although there is no maximum bound on how far
apart template/generic brackets can be, I believe that in practice, they
are never that far apart (a few hundred bytes max, perhaps).  Is this, in
fact, the case?

A cc: to acm@muc.de would be most appreciated.

Thanks in advance for any and all help!

-- 
Alan Mackenzie (Nuremberg, Germany).

             reply	other threads:[~2008-06-10 18:15 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-06-10 18:15 Alan Mackenzie [this message]
2008-06-10 18:56 ` Ian Lance Taylor
2008-06-10 19:05   ` Ian Lance Taylor
2008-06-15 14:12     ` Alan Mackenzie
2008-06-11 18:15 ` Tom Tromey

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

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

  git send-email \
    --in-reply-to=20080610183707.GB4844@muc.de \
    --to=acm@muc.de \
    --cc=gcc@gcc.gnu.org \
    /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.
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).