diff options
author | Juan Manuel Tomás <jtomas1815@gmail.com> | 2022-11-12 03:16:55 -0300 |
---|---|---|
committer | Juan Manuel Tomás <jtomas1815@gmail.com> | 2022-11-12 03:16:55 -0300 |
commit | 6f70c5585f600d178c1bef4bd63bbe1d527ac44a (patch) | |
tree | 415ad75b7ea341e4d729505b2c600c603e8f64f7 /json.lisp | |
parent | d1424efebc162c21717c7e7288a1146c802b0636 (diff) | |
download | json-6f70c5585f600d178c1bef4bd63bbe1d527ac44a.tar.gz json-6f70c5585f600d178c1bef4bd63bbe1d527ac44a.zip |
Better error reporting for numbers
If sign has been parsed, there must be a natural after it.
Diffstat (limited to 'json.lisp')
-rw-r--r-- | json.lisp | 5 |
1 files changed, 4 insertions, 1 deletions
@@ -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 #\.))) |