Robust parsing of map literals.
This commit is contained in:
parent
55aeec08d3
commit
e14ffc164f
|
@ -23,10 +23,10 @@
|
||||||
(reverse (concatenate 'string x)))
|
(reverse (concatenate 'string x)))
|
||||||
(finalise-kv-pair ()
|
(finalise-kv-pair ()
|
||||||
(if key-p
|
(if key-p
|
||||||
(progn
|
(unless (null k)
|
||||||
(setq key-p nil
|
(setq key-p nil
|
||||||
k (read-from-string (finalise-read k))))
|
k (read-from-string (finalise-read k))))
|
||||||
(progn
|
(unless (null v)
|
||||||
(setq key-p t
|
(setq key-p t
|
||||||
v (read-from-string (finalise-read v)))
|
v (read-from-string (finalise-read v)))
|
||||||
(setf (gethash k m) v)
|
(setf (gethash k m) v)
|
||||||
|
@ -39,8 +39,7 @@
|
||||||
(if key-p
|
(if key-p
|
||||||
(push prev k)
|
(push prev k)
|
||||||
(push prev v))))
|
(push prev v))))
|
||||||
(if (and (null k)
|
(if (and (null v) (not (null k)))
|
||||||
(null v))
|
|
||||||
(error "Mismatched key value pairs.")
|
(error "Mismatched key value pairs.")
|
||||||
(progn
|
(progn
|
||||||
(finalise-kv-pair)
|
(finalise-kv-pair)
|
||||||
|
|
Loading…
Reference in New Issue