File tree 3 files changed +13
-12
lines changed
3 files changed +13
-12
lines changed Original file line number Diff line number Diff line change 10
10
:description " Examines JSON data and deduces the ECL RECORD definitions necessary to parse it."
11
11
:author " Dan S. Camper"
12
12
:license " MIT"
13
- :version " 0.0.2 "
13
+ :version " 0.0.3 "
14
14
:serial t
15
15
:depends-on (# :adopt # :com.inuoe.jzon # :with-user-abort)
16
16
:components ((:file " package" )
Original file line number Diff line number Diff line change 239
239
240
240
; ;;
241
241
242
- (defun process-file (input &optional (parsed-obj nil ))
242
+ (defun process-file-or-stream (input &optional (parsed-obj nil ))
243
243
(jzon :with-parser (parser input)
244
244
(setf parsed-obj (parse-obj parsed-obj parser t )))
245
245
parsed-obj)
Original file line number Diff line number Diff line change 42
42
(with-user-abort :user-abort () (adopt :exit 130 ))))
43
43
44
44
(defun run (args)
45
- (let ((argc (length args)))
46
- (when (plusp argc)
47
- (let ((toplevel-name (if (= argc 1 )
48
- (pathname-name (uiop :probe-file* (car args)))
49
- (format nil " ~A " (gensym " toplevel_" ))))
50
- (result-obj nil ))
51
- (loop for input in args
52
- do (setf result-obj (process-file (uiop :probe-file* input) result-obj)))
53
- (setf *layout-names* nil )
54
- (format t " ~A " (as-ecl-recdef result-obj toplevel-name))))))
45
+ (let* ((argc (length args))
46
+ (args (if (plusp argc) args (list *standard-input* ))))
47
+ (let ((toplevel-name (if (= argc 1 )
48
+ (pathname-name (uiop :probe-file* (car args)))
49
+ (format nil " ~A " (gensym " toplevel_" ))))
50
+ (result-obj nil ))
51
+ (loop for input in args
52
+ do (let ((one-item (or (uiop :probe-file* input) input)))
53
+ (setf result-obj (process-file-or-stream one-item result-obj))))
54
+ (setf *layout-names* nil )
55
+ (format t " ~A " (as-ecl-recdef result-obj toplevel-name)))))
55
56
56
57
(defun toplevel (argv)
57
58
(sb-ext :disable-debugger)
You can’t perform that action at this time.
0 commit comments