clojure-emacs / parseedn

EDN parser for Emacs Lisp
58 stars 14 forks source link

Add support for alist, plist and an explicit error for dotted pairs #4

Closed jackrusher closed 4 years ago

jackrusher commented 4 years ago

I tried to replicate the heuristics in json-encode, which converts the dotted pairs found in alists and the lists that it guesses are plists into reasonable JSON.

In addition, I added support for keywords and an error call when the parser encounters anything it doesn't know how to emit to make future debugging a bit easier.

Lastly, there's a line with a comment saying dotted pair to mark where one could add some sort of support for this as discussed in ticket #3. (N.B. that json-encode simply fails when fed a dotted pair that's not part of an alist.)

This patch allows JSON -> elisp -> EDN -> elisp -> JSON round tripping, in case that ever comes up. 😹

jackrusher commented 4 years ago

Oops! Looks like I hadn't saved that file before commit. Should be fixed in now.