all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Alan Mackenzie <acm@muc.de>
To: John Wiegley <johnw@gnu.org>
Cc: Stefan Monnier <monnier@IRO.UMontreal.CA>, emacs-devel@gnu.org
Subject: Re: [Emacs-diffs] master 9dcf599: Amend parse-partial-sexp correctly to handle two character comment delimiters
Date: Sun, 20 Mar 2016 14:40:18 +0000	[thread overview]
Message-ID: <20160320144018.GC3603@acm.fritz.box> (raw)
In-Reply-To: <jwvshzlz2f9.fsf-monnier+emacsdiffs@gnu.org>

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 <acm@muc.de> writes:

> > branch: master
> > commit 9dcf5998935c8aaa846d7585b81f0dcfe1935b3d
> > Author: Alan Mackenzie <acm@muc.de>
> > Commit: Alan Mackenzie <acm@muc.de>

> >     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.



  parent reply	other threads:[~2016-03-20 14:40 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20160320132125.5713.70103@vcs.savannah.gnu.org>
     [not found] ` <E1ahdIL-0001Ul-Uz@vcs.savannah.gnu.org>
2016-03-20 13:47   ` [Emacs-diffs] master 9dcf599: Amend parse-partial-sexp correctly to handle two character comment delimiters Stefan Monnier
2016-03-20 14:22     ` Alan Mackenzie
2016-03-20 14:40     ` Alan Mackenzie [this message]
2016-03-20 15:30       ` Stefan Monnier

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20160320144018.GC3603@acm.fritz.box \
    --to=acm@muc.de \
    --cc=emacs-devel@gnu.org \
    --cc=johnw@gnu.org \
    --cc=monnier@IRO.UMontreal.CA \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.