From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 522 invoked by alias); 10 Jun 2008 18:15:11 -0000 Received: (qmail 512 invoked by uid 22791); 10 Jun 2008 18:15:10 -0000 X-Spam-Check-By: sourceware.org Received: from colin.muc.de (HELO mail.muc.de) (193.149.48.1) by sourceware.org (qpsmtpd/0.31) with ESMTP; Tue, 10 Jun 2008 18:14:51 +0000 Received: (qmail 64434 invoked by uid 3782); 10 Jun 2008 18:14:47 -0000 Received: from acm.muc.de (pD9E53556.dip.t-dialin.net [217.229.53.86]) by colin2.muc.de (tmda-ofmipd) with ESMTP; Tue, 10 Jun 2008 20:14:45 +0200 Received: (qmail 6380 invoked by uid 1000); 10 Jun 2008 18:37:07 -0000 Date: Tue, 10 Jun 2008 18:15:00 -0000 To: gcc@gcc.gnu.org Subject: Help requested on C++ template syntax (for Emacs development). Message-ID: <20080610183707.GB4844@muc.de> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.5.9i X-Delivery-Agent: TMDA/1.1.5 (Fettercairn) From: Alan Mackenzie X-Primary-Address: acm@muc.de Mailing-List: contact gcc-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-owner@gcc.gnu.org X-SW-Source: 2008-06/txt/msg00252.txt.bz2 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).