I was expecting a similar result with the two snippets below, but this is what I've got:
(with-temp-buffer
(insert "(a)(b)(c)")
(goto-char (point-min))
(list
(prog1 (cons (point) (cons (sexp-at-point) nil)) (forward-sexp))
(prog1 (cons (point) (cons (sexp-at-point) nil)) (forward-sexp))
(prog1 (cons (point) (cons (sexp-at-point) nil)) (forward-sexp))))
;; result: ((1 (a)) (4 (b)) (7 (c)))
and
(with-temp-buffer
(insert "(a) (b) (c)")
(goto-char (point-min))
(list
(prog1 (cons (point) (cons (sexp-at-point) nil)) (forward-sexp))
(prog1 (cons (point) (cons (sexp-at-point) nil)) (forward-sexp))
(prog1 (cons (point) (cons (sexp-at-point) nil)) (forward-sexp))))
;; result: ((1 (a)) (4 (a)) (8 (b)))
I'm using GNU Emacs 26.3.
How can I get something similar to ((1 (a)) (? (b)) (? (c)))
on the second snippet? I think there is a proper way to parse things like this.
There is a caveat, if it matters, the buffer is and must remain read-only.