From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: martin rudalics Newsgroups: gmane.emacs.devel Subject: Re: Musings: Supposed places of safety, guaranteed by parse-partial-sexp are not safe. Date: Tue, 06 Dec 2011 14:39:22 +0100 Message-ID: <4EDE1B0A.2010508@gmx.at> References: <20111203232301.GD4566@acm.acm> <4EDB4E50.1060202@gmx.at> <4EDBA888.2060202@gmx.at> <20111205112549.GA3522@acm.acm> <4EDDEB3A.8020509@gmx.at> <20111206103311.GA3242@acm.acm> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Trace: dough.gmane.org 1323178785 29795 80.91.229.12 (6 Dec 2011 13:39:45 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Tue, 6 Dec 2011 13:39:45 +0000 (UTC) Cc: Stefan Monnier , emacs-devel@gnu.org To: Alan Mackenzie Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Tue Dec 06 14:39:41 2011 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([140.186.70.17]) by lo.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1RXvFD-0006x2-RE for ged-emacs-devel@m.gmane.org; Tue, 06 Dec 2011 14:39:40 +0100 Original-Received: from localhost ([::1]:34039 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RXvFD-0006Sp-7q for ged-emacs-devel@m.gmane.org; Tue, 06 Dec 2011 08:39:39 -0500 Original-Received: from eggs.gnu.org ([140.186.70.92]:60355) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RXvF6-0006P1-8P for emacs-devel@gnu.org; Tue, 06 Dec 2011 08:39:37 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1RXvEz-0002Bn-IX for emacs-devel@gnu.org; Tue, 06 Dec 2011 08:39:32 -0500 Original-Received: from mailout-de.gmx.net ([213.165.64.23]:43556) by eggs.gnu.org with smtp (Exim 4.71) (envelope-from ) id 1RXvEz-0002BZ-4b for emacs-devel@gnu.org; Tue, 06 Dec 2011 08:39:25 -0500 Original-Received: (qmail invoked by alias); 06 Dec 2011 13:39:23 -0000 Original-Received: from 62-47-49-125.adsl.highway.telekom.at (EHLO [62.47.49.125]) [62.47.49.125] by mail.gmx.net (mp061) with SMTP; 06 Dec 2011 14:39:23 +0100 X-Authenticated: #14592706 X-Provags-ID: V01U2FsdGVkX19IvhBlplpIOpXoFxPQ2jHo49GM4OwVbronC9X1Wr AiZsAX8TmpG4v/ User-Agent: Thunderbird 2.0.0.21 (Windows/20090302) In-Reply-To: <20111206103311.GA3242@acm.acm> X-Y-GMX-Trusted: 0 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 213.165.64.23 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:146505 Archived-At: > One can delete anything inside a comment and it is still a comment. We > (i.e. I :-) don't want to introduce an extra special case about the first > character of a comment. What is "the first character of a comment"? With current Emacs sources the first character of a "/* ... */" comment is the leading "/" when looking at (nth 8 ppss). But at the position to the right of that character we're still not "within" that comment. Doesn't that strike you as paradoxical at least? > p-p-s is a finite state machine. If it starts looking to the right, it > will still be a fsm, but with many more states. I think there won't be any more states than with your proposal. > Again, what of "/*/" mentioned by Stefan? If we're already in the > comment after the first "/", then we're apparently looking at a comment > ender. This complication (and it is complicated) surely condemns the > approach. This complication exists already as you can verify by looking at the corresponding code. The value of the last comment start position (the position before the leading "/") is IMHO sufficient to handle this case well. > I think we should use the same approach as for escape characters: record > the fact in (nth 5 state) that we've passed one, but otherwise take no > action. Since you're the person most affected, the choice should be yours. Nevertheless, I think that your initial claim In particular, checking (nth 3 state) and (nth 4 state) is insufficient to know that one is at a "safe place". could be easily corrected. martin