Create and export read-from-string. Add a test for it
authorAlfredo Beaumont <alfredo.beaumont@gmail.com>
Fri, 26 Apr 2013 15:22:14 +0000 (17:22 +0200)
committerAlfredo Beaumont <alfredo.beaumont@gmail.com>
Fri, 26 Apr 2013 15:25:02 +0000 (17:25 +0200)
src/read.lisp
src/toplevel.lisp
tests/read.lisp [new file with mode: 0644]

index 43628a4..c99604a 100644 (file)
 
 (defun ls-read-from-string (string &optional (eof-error-p t) eof-value)
   (ls-read (make-string-stream string) eof-error-p eof-value))
+
+#+jscl
+(defun read-from-string (string &optional (eof-errorp t) eof-value)
+  (ls-read-from-string string eof-errorp eof-value))
index 0a1b4dd..6fb2569 100644 (file)
           nconc nil not nreconc nth nthcdr null numberp or
           package-name package-use-list packagep parse-integer plusp
           prin1-to-string print proclaim prog1 prog2 progn psetq push
-          quote remove remove-if remove-if-not return return-from
-          revappend reverse rplaca rplacd second set setf setq some
-          string string-upcase string= stringp subseq symbol-function
-          symbol-name symbol-package symbol-plist symbol-value symbolp
-          t tagbody third throw truncate unless unwind-protect values
-          values-list variable warn when write-line write-string zerop))
+          quote read-from-string remove remove-if remove-if-not return
+          return-from revappend reverse rplaca rplacd second set setf
+          setq some string string-upcase string= stringp subseq
+          symbol-function symbol-name symbol-package symbol-plist
+          symbol-value symbolp t tagbody third throw truncate unless
+          unwind-protect values values-list variable warn when write-line
+          write-string zerop))
 
 (setq *package* *user-package*)
 
diff --git a/tests/read.lisp b/tests/read.lisp
new file mode 100644 (file)
index 0000000..6f10ca2
--- /dev/null
@@ -0,0 +1,4 @@
+;; TODO: Uncomment when either read-from-string supports all these parameters
+;; or when test macro supports error handling, whichever comes first
+;; (test (equal (read-from-string " 1 3 5" t nil :start 2) (values 3 5)))
+(test (equal (read-from-string "(a b c)") (values '(A B C) 7)))