bug-gnu-emacs
[Top][All Lists]
Advanced

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

bug#49944: parse-partial-sexp fails to signal an error when (> START LIM


From: Lars Ingebrigtsen
Subject: bug#49944: parse-partial-sexp fails to signal an error when (> START LIMIT).
Date: Tue, 10 Aug 2021 16:54:59 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux)

Stefan Monnier <monnier@iro.umontreal.ca> writes:

> I think the case of `parse-partial-sexp` is different because it
> receives the argument OLDSTATE which provides the parser's state which
> should apply at START.  If START and END are swapped you'll generally
> get an incorrect result.
>
> So, I don't care if we signal an error when START > END or if we "do
> nothing" (as is customary in some language's `for` loops), but we should
> always consider that OLDSTATE is the state that belongs with START and
> hence we can't start parsing at END towards START because we don't know
> what parsing state to use at END.

Ah; thanks for the explanation.

But I guess you'll get incorrect results if you pass in any OLDSTATE
that doesn't belong to START, not just when START and END are swapped?
It's just that if START/END obviously wrong (i.e., END is smaller than
START), then the function here "helpfully" swaps them and things get
even more confusing than they would normally be if you pass in a wrong
OLDSTATE (or wrong START).

So perhaps signalling an error here is the correct thing after all?  (Or
just not doing any swapping.)

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no





reply via email to

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