summaryrefslogtreecommitdiff
path: root/load.lisp
diff options
context:
space:
mode:
Diffstat (limited to 'load.lisp')
-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)))