From: Alan Mackenzie <acm@muc.de>
To: martin rudalics <rudalics@gmx.at>
Cc: Stefan Monnier <monnier@IRO.UMontreal.CA>, emacs-devel@gnu.org
Subject: Re: Musings: Supposed places of safety, guaranteed by parse-partial-sexp are not safe.
Date: Tue, 6 Dec 2011 10:33:11 +0000 [thread overview]
Message-ID: <20111206103311.GA3242@acm.acm> (raw)
In-Reply-To: <4EDDEB3A.8020509@gmx.at>
Hello, Martin.
On Tue, Dec 06, 2011 at 11:15:22AM +0100, martin rudalics wrote:
> > The parse-partial scanner works strictly left to right. If (nth 5
> > ppss) records the left hand bit of "/*", we are not yet in a
> > comment. We're probably about to do a division. Similarly, after *
> > of "*/", we're still in the comment, probably just passed a comment
> > prefix.
> If we can look ahead by one character, there is no probability but
> certainty. And the latter is what you want in (nth 4 ppss). The
> remaining case is with an "/" at the end of a buffer and that case
> wouldn't trouble me.
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.
> > I disagree. I think keeping the stricly L to R invariant of the
> > parse is critically important (but don't ask me why :-).
> Why would looking ahead violate a L to R rule?
Think of it as the direction one's head is turned on a British street
when about to cross it suicidally. At the moment, parse-partial-sexp
looks only at the characters to the left; it never pays any attention
whatsoever to characters on the right.
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.
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.
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.
> martin
--
Alan Mackenzie (Nuremberg, Germany).
next prev parent reply other threads:[~2011-12-06 10:33 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-12-03 23:23 Musings: Supposed places of safety, guaranteed by parse-partial-sexp are not safe Alan Mackenzie
2011-12-03 23:40 ` Daniel Colascione
2011-12-04 3:39 ` Stefan Monnier
2011-12-04 10:41 ` martin rudalics
2011-12-04 15:21 ` Stefan Monnier
2011-12-04 17:06 ` martin rudalics
2011-12-04 20:47 ` Andreas Röhler
2011-12-05 3:33 ` Stefan Monnier
2011-12-05 7:41 ` martin rudalics
2011-12-05 14:01 ` Stefan Monnier
2011-12-05 11:35 ` Alan Mackenzie
2011-12-05 11:25 ` Alan Mackenzie
2011-12-06 10:15 ` martin rudalics
2011-12-06 10:33 ` Alan Mackenzie [this message]
2011-12-06 13:39 ` martin rudalics
2011-12-06 13:50 ` 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=20111206103311.GA3242@acm.acm \
--to=acm@muc.de \
--cc=emacs-devel@gnu.org \
--cc=monnier@IRO.UMontreal.CA \
--cc=rudalics@gmx.at \
/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.