[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Parsing beyond sexps
From: |
Damien Cassou |
Subject: |
Parsing beyond sexps |
Date: |
Sun, 19 Jan 2020 09:11:50 +0100 |
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
- Parsing beyond sexps,
Damien Cassou <=