summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJuan Manuel Tomás <jtomas1815@gmail.com>2023-05-01 23:09:58 -0300
committerJuan Manuel Tomás <jtomas1815@gmail.com>2023-05-01 23:09:58 -0300
commit23da3203aa908b1a6f24177d55fabf72c95d0331 (patch)
tree443b07046f4d55b8e5bb04dcc7c5015b826d9e2c
parentce4838b58104b589894081b6c5cbd52554cf87a7 (diff)
downloadjson-23da3203aa908b1a6f24177d55fabf72c95d0331.tar.gz
json-23da3203aa908b1a6f24177d55fabf72c95d0331.zip
Adapt to changes in Monparser
-rw-r--r--load.lisp14
1 files changed, 12 insertions, 2 deletions
diff --git a/load.lisp b/load.lisp
index a58e4a2..3158c18 100644
--- a/load.lisp
+++ b/load.lisp
@@ -1,5 +1,9 @@
(in-package #:json)
+(defparameter whitespace
+ (comp ((_ (optional (many (unit-if #'char:whitespace?)))))
+ nil))
+
(defparameter number-literal
(let ((signed-digits
(comp ((sign (optional (one-of (unit #\-)
@@ -113,8 +117,14 @@
(_ whitespace))
v))
+(defun run (input)
+ (let ((result (funcall json-value input)))
+ (if (parsing-p result)
+ (parsing-tree result)
+ result)))
+
(defun from-string (str)
- (run json-value (input:from-string str)))
+ (run (input:from-string str)))
(defun from-file (file)
- (run json-value (input:from-file file)))
+ (run (input:from-file file)))