From: Damien Cassou <damien@cassou.me>
To: emacs-devel@gnu.org
Subject: Parsing beyond sexps
Date: Sun, 19 Jan 2020 09:11:50 +0100 [thread overview]
Message-ID: <87wo9nn9vd.fsf@cassou.me> (raw)
Hi,
I'm trying to write a general-purpose linting engine for Emacs Lisp. It
currently uses a generator which repeatedly calls `(read buffer)` and
yields the result. It also uses a generator to iterate over the sexps of
a sexp, recursively. Here is the code:
https://gitlab.com/lintel/lintel/blob/2c98a02b17e34140f576e0bf2a9a7c47920dc1ce/lintel.el#L283
This is not enough though as I want comments and line/column positions
in the yielded values. Is there anything I could use from Emacs core
that would make my life easier?
I thought about using `parse-partial-sexp` and `syntax-ppss` but don't
know which iteration strategy to use to get information on the whole
buffer. I could also use `forward-sexp` and check for the presence of a
comment at point each time this function returns.
Any piece of advice would be appreciated.
Please keep me in CC when answering.
Thank you.
--
Damien Cassou
"Success is the ability to go from one failure to another without
losing enthusiasm." --Winston Churchill
next reply other threads:[~2020-01-19 8:11 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-01-19 8:11 Damien Cassou [this message]
2020-01-19 9:46 ` Parsing beyond sexps Mattias Engdegård
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://www.gnu.org/software/emacs/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87wo9nn9vd.fsf@cassou.me \
--to=damien@cassou.me \
--cc=emacs-devel@gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).