Function: READ-TAL-EXPRESSION-FROM-STRING

Documentation

Reads a single form from the string EXPRESSION using the TAL expression read table.

Source

(defun read-tal-expression-from-string (expression &optional implicit-progn-p)
  "Reads a single form from the string EXPRESSION using the TAL
 expression read table."
  (assert *expression-package*
          (*expression-package*)
          "No expression package!")
  (let ((*readtable* (copy-readtable nil))
        (*package* *expression-package*))
    ;; use $SYMBOL to access the value of the environment variable
    ;; SYMBOL
    (set-macro-character #\$ #'|$ tal reader| nil *readtable*)
    (if implicit-progn-p
        (iter (with pos = 0)
              (for (values obj new-pos) = (read-from-string expression nil nil :start pos))
              (while obj)
              (setf pos new-pos)
              (collect obj into result)
              (finally (return (if (> (length result) 1)
                                   (cons 'progn result)
                                   (first result)))))
        (read-from-string expression))))
Source Context