[Top][All Lists]

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

Re: How to add pseudo vector types

From: Eli Zaretskii
Subject: Re: How to add pseudo vector types
Date: Sat, 17 Jul 2021 20:54:56 +0300

> From: Stefan Monnier <monnier@iro.umontreal.ca>
> Cc: emacs-devel@gnu.org
> Date: Sat, 17 Jul 2021 13:30:40 -0400
> Clément said:
> > I have no idea if it makes sense, but: does the initial parse need to be
> > synchronous, or could you instead run the parsing in one thread, and the
> > rest of Emacs in another? (I'm talking about concurrent execution, not
> > cooperative threading).
> If we copy the buffer's content to a freshly malloc area before passing
> that to TS, then there should be no problem running TS in a separate
> concurrent thread, indeed.

Making a copy of the buffer is a non-starter from where I stand.  It
doesn't scale, for starters.  I don't see any reason to go to such a
complex design at this early stage.

> Eli said:
> > Why do you update the entire parser list for every modification?
> > This comment:
> If having multiple parsers in a single buffer is a not-uncommon case,
> then indeed we'll need to do better, but if we assume this is an
> anomalous situation, then Yuan's code is optimal ;-)
> > Yes, I think we should only ask TS to parse what we need, not more.
> We'll need to experiment with that.

We can experiment, but I think the basic design should be clean and
reasonable from the get-go.

> Using an approach like `syntax-ppss` where we only parse up to some
> high-watermark might be a good approach, but it's also possible that
> it will work poorly: if TS assumes it works on the whole buffer,
> then it will see the truncated text as a syntax error and while it
> is supposed to handle syntax errors nicely it may still lead to
> suboptimal behavior when parts of perfectly valid code is misparsed
> because the parser was not allowed to see the closing braces that
> make it "perfectly valid".

TS must be able to handle these situation well enough, because they
happen during editing all the time.  I wouldn't worry about that,
definitely not at this stage.

Different uses of the parse results will need to pass different chunks
of buffer text, and that is okay.

reply via email to

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