summaryrefslogtreecommitdiff
path: root/json.lisp
diff options
context:
space:
mode:
Diffstat (limited to 'json.lisp')
-rw-r--r--json.lisp5
1 files changed, 4 insertions, 1 deletions
diff --git a/json.lisp b/json.lisp
index 6fe95b8..23c9198 100644
--- a/json.lisp
+++ b/json.lisp
@@ -12,7 +12,10 @@
(defparameter number-literal
(let ((signed-digits
(comp ((sign (zero-or-one (some-char #\- #\+)))
- (natural (one-or-more (unit #'digit-char-p))))
+ (natural (if sign
+ (either (one-or-more (unit #'digit-char-p))
+ (fail "Malformed number."))
+ (one-or-more (unit #'digit-char-p)))))
(cons sign natural))))
(comp ((base signed-digits)
(dot (zero-or-one (the-char #\.)))