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: C Mode: acceleration in brace deserts. Date: Thu, 3 Dec 2009 16:59:37 +0000 Message-ID: <20091203165937.GB1942@muc.de> References: <20091203162129.GA1942@muc.de> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: ger.gmane.org 1259859300 6834 80.91.229.12 (3 Dec 2009 16:55:00 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Thu, 3 Dec 2009 16:55:00 +0000 (UTC) Cc: emacs-devel@gnu.org To: Lennart Borgman Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Thu Dec 03 17:54:53 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 1NGEx9-0001lT-9r for ged-emacs-devel@m.gmane.org; Thu, 03 Dec 2009 17:54:51 +0100 Original-Received: from localhost ([127.0.0.1]:45304 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1NGEx9-0002eP-32 for ged-emacs-devel@m.gmane.org; Thu, 03 Dec 2009 11:54:51 -0500 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1NGEwb-000209-8w for emacs-devel@gnu.org; Thu, 03 Dec 2009 11:54:17 -0500 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1NGEwW-0001ru-4m for emacs-devel@gnu.org; Thu, 03 Dec 2009 11:54:16 -0500 Original-Received: from [199.232.76.173] (port=36960 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1NGEwV-0001rb-Rw for emacs-devel@gnu.org; Thu, 03 Dec 2009 11:54:11 -0500 Original-Received: from colin.muc.de ([193.149.48.1]:2545 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 1NGEwV-0001xp-Cf for emacs-devel@gnu.org; Thu, 03 Dec 2009 11:54:11 -0500 Original-Received: (qmail 24666 invoked by uid 3782); 3 Dec 2009 16:54:09 -0000 Original-Received: from acm.muc.de (pD9E22654.dip.t-dialin.net [217.226.38.84]) by colin2.muc.de (tmda-ofmipd) with ESMTP; Thu, 03 Dec 2009 17:54:08 +0100 Original-Received: (qmail 20447 invoked by uid 1000); 3 Dec 2009 16:59:37 -0000 Content-Disposition: inline In-Reply-To: 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:118184 Archived-At: Hi, Lennart! On Thu, Dec 03, 2009 at 05:26:57PM +0100, Lennart Borgman wrote: > Hi Alan, > Can you tell me how the cache [c-parse-state] is implemented so I can > support it in MuMaMo? Short brusque answer: no - it's ~1300 lines of code, much of it arcane. Slightly longer answer: The cache's structure is a list of the positions of each successively enclosing brace/bracket/paren from point going back to the top level. Additionally, if there is a brace pair preceding such a b/b/p, it is recorded as a cons. Also there is a "good position", a position where the cache is known to be valid. When c-state-cache is called from a new position, the cache is usually updated rather than being calculated from scratch. The involves removing entries from the cache which are now later than point, removing other entries which aren't relevant, since they've been "closed off", etc. - then scanning forward pairs of parens at a time successively entering deeper levels (see `c-append-to-state-cache'). Lots of dirty tricks are used to speed up the process as much as possible. Sorry I can't be more help, here. But if you've any specific questions, let me know. > Best wishes, > L -- Alan Mackenzie (Nuremberg, Germany).