emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Musings: Supposed places of safety, guaranteed by parse-partial-sexp


From: martin rudalics
Subject: Re: Musings: Supposed places of safety, guaranteed by parse-partial-sexp are not safe.
Date: Tue, 06 Dec 2011 14:39:22 +0100
User-agent: Thunderbird 2.0.0.21 (Windows/20090302)

> 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



reply via email to

[Prev in Thread] Current Thread [Next in Thread]