Permalink
Browse files

Merge pull request #5 from thodg/master

Fix for lodash.js
  • Loading branch information...
2 parents c42d452 + 244106a commit 429c5e1d844e2f96b44db8fccc92d6e8e28afdd5 @mishoo committed Jun 20, 2015
Showing with 9 additions and 2 deletions.
  1. +6 −1 src/codegen.lisp
  2. +1 −0 src/constants.lisp
  3. +2 −1 src/squeeze.lisp
View
@@ -18,7 +18,12 @@ characters in string S to STREAM."
do (write-char #\\ stream) (write-char ch stream)
else if (setq special (car (rassoc ch +json-lisp-escaped-chars+)))
do (write-char #\\ stream) (write-char special stream)
- else do (write-char ch stream))
+ else if (< #x1f code #x7f)
+ do (write-char ch stream)
+ else
+ do (let ((special '#.(rassoc-if #'consp +json-lisp-escaped-chars+)))
+ (destructuring-bind (esc . (width . radix)) special
+ (format stream "\\~C~V,V,'0R" esc radix width code))))
(write-char quote stream))
;;; </cl-json>
View
@@ -3,6 +3,7 @@
;;; <cl-json> --- the following is taken from cl-json
(defparameter +json-lisp-escaped-chars+
'((#\\ . #\\)
+ (#\/ . #\/)
(#\b . #\Backspace)
(#\f . #\ )
(#\n . #\Newline)
View
@@ -18,7 +18,8 @@
(:method ((op (eql :*)) (left number) (right number))
(* left right))
(:method ((op (eql :/)) (left number) (right number))
- (/ left right))
+ (unless (zerop right)
+ (/ left right)))
(:method ((op (eql :<<)) (left number) (right number))
(ash left right))
(:method ((op (eql :>>)) (left number) (right number))

0 comments on commit 429c5e1

Please sign in to comment.