A simple package to parse Emacs Lisp expressions from Python.
>>> import elisp
>>> numbers = elisp.loads("(1 2 3)")
>>> numbers.car
1
>>> numbers.cdr.cdr.car
3
>>> numbers.cdr.cdr.cdr is elisp.NIL
True
The following types are supported and are mapped to the respective Python types.
integer
toint
float
tofloat
symbol
toelisp.ELispSymbol
, a subclass ofstr
list
,cons
toelisp.ELispCons
unibyte string
tobytearray
multibyte string
tounicode
(without the\C-a
syntax)vector
tolist
The following types are not supported:
- Characters (like
?a
or?\C-f
) - Char-Table
- Bool-Vector
- Hash Table
- Byte-Code
See the file elisp.ebnf for the grammar used by this package.