From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Alan Mackenzie Newsgroups: gmane.emacs.devel Subject: Re: Semantic parser uses c-forward-conditional Date: Tue, 22 Sep 2009 22:08:52 +0000 Message-ID: <20090922220852.GB3722@muc.de> References: <87zl8oumvl.fsf@stupidchicken.com> <20090922105735.GA3722@muc.de> <1253619827.10118.38.camel@projectile.siege-engine.com> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: ger.gmane.org 1253657134 16397 80.91.229.12 (22 Sep 2009 22:05:34 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Tue, 22 Sep 2009 22:05:34 +0000 (UTC) Cc: Chong Yidong , "Eric M. Ludlam" , emacs-devel@gnu.org To: "Eric M. Ludlam" Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Wed Sep 23 00:05:25 2009 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.50) id 1MqDUB-00018v-G8 for ged-emacs-devel@m.gmane.org; Wed, 23 Sep 2009 00:05:24 +0200 Original-Received: from localhost ([127.0.0.1]:39842 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1MqDUA-0001rN-Q8 for ged-emacs-devel@m.gmane.org; Tue, 22 Sep 2009 18:05:22 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1MqDU6-0001rI-8p for emacs-devel@gnu.org; Tue, 22 Sep 2009 18:05:18 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1MqDU1-0001qd-Hg for emacs-devel@gnu.org; Tue, 22 Sep 2009 18:05:17 -0400 Original-Received: from [199.232.76.173] (port=49735 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1MqDU1-0001qO-4k for emacs-devel@gnu.org; Tue, 22 Sep 2009 18:05:13 -0400 Original-Received: from colin.muc.de ([193.149.48.1]:2995 helo=mail.muc.de) by monty-python.gnu.org with esmtps (TLS-1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1MqDU0-0008K1-AT for emacs-devel@gnu.org; Tue, 22 Sep 2009 18:05:12 -0400 Original-Received: (qmail 41769 invoked by uid 3782); 22 Sep 2009 22:05:08 -0000 Original-Received: from acm.muc.de (pD9E5363E.dip.t-dialin.net [217.229.54.62]) by colin2.muc.de (tmda-ofmipd) with ESMTP; Wed, 23 Sep 2009 00:05:06 +0200 Original-Received: (qmail 15325 invoked by uid 1000); 22 Sep 2009 22:08:52 -0000 Content-Disposition: inline In-Reply-To: <1253619827.10118.38.camel@projectile.siege-engine.com> User-Agent: Mutt/1.5.9i X-Delivery-Agent: TMDA/1.1.5 (Fettercairn) X-Primary-Address: acm@muc.de X-detected-operating-system: by monty-python.gnu.org: FreeBSD 4.6-4.9 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:115534 Archived-At: Hi, Eric, On Tue, Sep 22, 2009 at 07:43:47AM -0400, Eric M. Ludlam wrote: > On Tue, 2009-09-22 at 10:57 +0000, Alan Mackenzie wrote: > > I'm not very keen on that, but how about this instead: a new defun > > c-forward-conditional-1 which does the same, except it doesn't push a > > mark, doesn't throw errors like "No following conditional at this > > level", and returns the final point, or nil? > > Then all occurances inside CEDET can be changed to > > (cedet-forward-c-conditional), where the following macro goes into > > CEDET: > > (require 'cc-cmds) > > (defmacro forward-cedet-c-conditional (count &optional target-depth with-else) > > .... > > (if (fboundp 'c-forward-conditional-1) ...) > > .... > > ) > > This will avoid complexifying cc-cmds.el, whilst still allowing CEDET > > and friends to work with older CC MODE versions. It would also be good > > for CC MODE to separate out the "engine" part of the command from the > > "wrapper". > The above seems like a fine solution to me. I've had a closer look at it, and it seems it would be better to let c-forward-conditional just signal errors (which it does when there aren't enough conditional to go over/out of/into). c-f-c (which is patterned on scan-lists) also does all the work for c-backward-conditional etc., so returning some sort of error status would mean having to throw identically in the other five defuns. Callers can catch the error if they need to, just as they do at the moment. I'll just take out the setting of the mark. > > As a matter of interest, have you grepped CEDET to find other similar > > problems? > All the C support for the parser is in one. It also uses c-end-of-macro > which stands out for me. Thanks! c-end-of-macro isn't a problem, it just goes forward past escaped EOLs. > Eric -- Alan Mackenzie (Nuremberg, Germany).