public inbox for gcc@gcc.gnu.org
 help / color / mirror / Atom feed
* Help requested on C++ template syntax (for Emacs development).
@ 2008-06-10 18:15 Alan Mackenzie
  2008-06-10 18:56 ` Ian Lance Taylor
  2008-06-11 18:15 ` Tom Tromey
  0 siblings, 2 replies; 5+ messages in thread
From: Alan Mackenzie @ 2008-06-10 18:15 UTC (permalink / raw)
  To: gcc

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).

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2008-06-15 14:12 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-06-10 18:15 Help requested on C++ template syntax (for Emacs development) Alan Mackenzie
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

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).