Function: math-read-expr

math-read-expr is a byte-compiled function defined in calc-ext.el.gz.

Signature

(math-read-expr STR)

Source Code

;; Defined in /usr/src/emacs/lisp/calc/calc-ext.el.gz
(defun math-read-expr (str)
  (let ((math-exp-pos 0)
        (math-exp-str str)
	(math-exp-old-pos 0)
	(math-exp-keep-spaces nil)
	math-exp-token math-expr-data)
    (setq math-exp-str (math-read-preprocess-string math-exp-str))
    (while (setq math-exp-token (string-match "\\.\\.\\([^.]\\|.[^.]\\)" math-exp-str))
      (setq math-exp-str (concat (substring math-exp-str 0 math-exp-token) "\\dots"
			    (substring math-exp-str (+ math-exp-token 2)))))
    (math-build-parse-table)
    (math-read-token)
    (let ((val (catch 'syntax (math-read-expr-level 0))))
      (if (stringp val)
	  (list 'error math-exp-old-pos val)
	(if (equal math-exp-token 'end)
	    val
	  (list 'error math-exp-old-pos "Syntax error"))))))