unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
* Supplying a default initial STATE to parse-partial-sexp. What about elt. 9?
@ 2009-06-30 16:20 Alan Mackenzie
  2009-06-30 20:22 ` Stefan Monnier
  0 siblings, 1 reply; 2+ messages in thread
From: Alan Mackenzie @ 2009-06-30 16:20 UTC (permalink / raw)
  To: emacs-devel

Hi, Emacs!

In a function, I want to parse-partial-sexp through a buffer,
successively feeding its result back as the STATE parameter of the next
call.

To avoid an irritating special case, I'd like to initialize the state to
a default value, rather than passing in nil.  Something like:

(let ((pps-state '(0 nil 0  nil nil nil 0 nil nil nil)))
              ;;   0   1 2    3   4   5 6   7   8   9
  ....)

However, this leaves me a bit uneasy about the 9th element, which is
documented as "Intermediate data for continuation of parsing (subject to
change)".  Is it valid to set elt 9 as nil, or will this cause some sort
of malfunction or signal in parse-partial-sexp?

Thanks in advance!

-- 
Alan Mackenzie (Nuremberg, Germany).




^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: Supplying a default initial STATE to parse-partial-sexp. What about elt. 9?
  2009-06-30 16:20 Supplying a default initial STATE to parse-partial-sexp. What about elt. 9? Alan Mackenzie
@ 2009-06-30 20:22 ` Stefan Monnier
  0 siblings, 0 replies; 2+ messages in thread
From: Stefan Monnier @ 2009-06-30 20:22 UTC (permalink / raw)
  To: Alan Mackenzie; +Cc: emacs-devel

> To avoid an irritating special case, I'd like to initialize the state to
> a default value, rather than passing in nil.  Something like:

I'm not sure what you mean by special case.  Usually I use nil for that
purpose and it works fine, since all the operations I use on the state
treat nil as '(nil . nil)

> However, this leaves me a bit uneasy about the 9th element, which is
> documented as "Intermediate data for continuation of parsing (subject to
> change)".  Is it valid to set elt 9 as nil, or will this cause some sort
> of malfunction or signal in parse-partial-sexp?

Yes, nil is fine there as well: it'll work just dandy!


        Stefan




^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2009-06-30 20:22 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-06-30 16:20 Supplying a default initial STATE to parse-partial-sexp. What about elt. 9? Alan Mackenzie
2009-06-30 20:22 ` Stefan Monnier

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).