From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Stefan Monnier Newsgroups: gmane.emacs.devel Subject: Re: [Emacs-diffs] master 9dcf599: Amend parse-partial-sexp correctly to handle two character comment delimiters Date: Sun, 20 Mar 2016 11:30:51 -0400 Message-ID: References: <20160320132125.5713.70103@vcs.savannah.gnu.org> <20160320144018.GC3603@acm.fritz.box> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: ger.gmane.org 1458487871 31951 80.91.229.3 (20 Mar 2016 15:31:11 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Sun, 20 Mar 2016 15:31:11 +0000 (UTC) Cc: Alan Mackenzie To: John Wiegley , emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Sun Mar 20 16:31:03 2016 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1ahfJl-00030c-TN for ged-emacs-devel@m.gmane.org; Sun, 20 Mar 2016 16:31:02 +0100 Original-Received: from localhost ([::1]:53346 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ahfJl-0000UP-Ay for ged-emacs-devel@m.gmane.org; Sun, 20 Mar 2016 11:31:01 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:50839) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ahfJi-0000Tu-0n for emacs-devel@gnu.org; Sun, 20 Mar 2016 11:30:58 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ahfJg-0004WP-V7 for emacs-devel@gnu.org; Sun, 20 Mar 2016 11:30:57 -0400 Original-Received: from chene.dit.umontreal.ca ([132.204.246.20]:37988) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ahfJc-0004Vh-Ma; Sun, 20 Mar 2016 11:30:52 -0400 Original-Received: from fmsmemgm.homelinux.net (lechon.iro.umontreal.ca [132.204.27.242]) by chene.dit.umontreal.ca (8.14.1/8.14.1) with ESMTP id u2KFVK8u014429; Sun, 20 Mar 2016 11:31:21 -0400 Original-Received: by fmsmemgm.homelinux.net (Postfix, from userid 20848) id 26D83AE248; Sun, 20 Mar 2016 11:30:51 -0400 (EDT) In-Reply-To: <20160320144018.GC3603@acm.fritz.box> (Alan Mackenzie's message of "Sun, 20 Mar 2016 14:40:18 +0000") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/25.1.50 (gnu/linux) X-NAI-Spam-Flag: NO X-NAI-Spam-Threshold: 5 X-NAI-Spam-Score: 0 X-NAI-Spam-Rules: 1 Rules triggered RV5616=0 X-NAI-Spam-Version: 2.3.0.9418 : core <5616> : inlines <4536> : streams <1606024> : uri <2170631> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 132.204.246.20 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:201940 Archived-At: What he says, Stefan >>>>> "Alan" == Alan Mackenzie writes: > Hello, John. > On Sun, Mar 20, 2016 at 09:47:58AM -0400, Stefan Monnier wrote: >> What was John's opinion on reusing nth 5? >> Stefan > Yes John, what is your opinion on reusing element 5 of the parser state? > Background: > The previous edition of `parse-partial-sexp' returned a ten-element list > which could be used for continuing that parse. Unfortunately, this list > was incomplete, leading to errors when the parse had stopped in the > middle of a two-character comment delimiter. This is bug #23019. > My patch, created with Stefan's help, has solved this bug, partly by > adding another element onto the parser state. But this new element > leaves element 5 ("t when just after an escape character") redundant. > Stefan is in favour of reusing position 5 for this new element, rather > than adding it at the end of the state (which has just been done). I am > against this, though not strongly. It might have some effects on > existing code, though this is not particularly likely. > What do you say? > -- > Alan Mackenzie (Nuremberg, Germany). >> >>>>> "Alan" == Alan Mackenzie writes: >> > branch: master >> > commit 9dcf5998935c8aaa846d7585b81f0dcfe1935b3d >> > Author: Alan Mackenzie >> > Commit: Alan Mackenzie >> > Amend parse-partial-sexp correctly to handle two character comment delimiters >> > Do this by adding a new field to the parser state: the syntax of the last >> > character scanned, should that be the first char of a (potential) two char >> > construct, nil otherwise. >> > This should make the parser state complete. >> > Also document element 9 of the parser state. Also refactor the code a bit. >> > * src/syntax.c (struct lisp_parse_state): Add a new field. >> > (SYNTAX_FLAGS_COMSTARTEND_FIRST): New function. >> > (internalize_parse_state): New function, extracted from scan_sexps_forward. >> > (back_comment): Call internalize_parse_state. >> > (forw_comment): Return the syntax of the last character scanned to the caller >> > when that character might be the first of a two character construct. >> > (Fforward_comment, scan_lists): New dummy variables, passed to forw_comment. >> > (scan_sexps_forward): Remove a redundant state parameter. Access all `state' >> > information via the address parameter `state'. Remove the code which converts >> > from external to internal form of `state'. Access buffer contents only from >> > `from' onwards. Reformulate code at the top of the main loop correctly to >> > recognize comment openers when starting in the middle of one. Call >> > forw_comment with extra argument (for return of syntax value of possible first >> > char of a two char construct). >> > (Fparse_partial_sexp): Document elements 9, 10 of the parser state in the >> > doc string. Clarify the doc string in general. Call >> > internalize_parse_state. Take account of the new elements when consing up the >> > output parser state. >> > * doc/lispref/syntax.texi: (Parser State): Document element 9 and the new >> > element 10. Minor wording corrections (remove reference to "trivial >> > cases"). >> > (Low Level Parsing): Minor corrections. >> > * etc/NEWS: Note new element 10, and documentation of element 9 of parser >> > state.