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: Alan Mackenzie
Subject: Re: Musings: Supposed places of safety, guaranteed by parse-partial-sexp are not safe.
Date: Mon, 5 Dec 2011 11:25:49 +0000
User-agent: Mutt/1.5.21 (2010-09-15)

Hello, Martin.

On Sun, Dec 04, 2011 at 06:06:16PM +0100, martin rudalics wrote:
>  >> If you change (nth 5 ppss) you would still have to say that (nth 4 ppss)
>  >> is unreliable in this special case.

>  > Not if (nth 5 ppss) says that the buffer position is the one *after* the
>  > "/*" sequence.  Of course for "*/" we'd conversely want to use the state
>  > *before* "*/".

> What I meant was that the caller would have to care about (nth 5 ppss)
> too, wherever she now looked only at (nth 3 ppss) and (nth 4 ppss).  If
> we say that a comment is everything in between and including both
> delimiters she won't have to care about (nth 5 ppss) in the first place.

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.

Admittedly CC Mode records the entire comment, including /* and */.

> Admittedly, it's not entirely trivial to implement.  But the fact that
> between "/" and "*" we are not in a comment whilst between "*" and "/"
> we are doesn't strike me as very intuitive.

I disagree.  I think keeping the stricly L to R invariant of the parse is
critically important (but don't ask me why :-).

> martin

-- 
Alan Mackenzie (Nuremberg, Germany).



reply via email to

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