Function: calc-read-parse-table

calc-read-parse-table is an autoloaded and byte-compiled function defined in calc-prog.el.gz.

Signature

(calc-read-parse-table CALC-BUF LANG)

Source Code

;; Defined in /usr/src/emacs/lisp/calc/calc-prog.el.gz
(defun calc-read-parse-table (calc-buf lang)
  (let ((calc-lang lang)
        (tab nil))
    (while (progn
	     (skip-chars-forward "\n\t ")
	     (not (eobp)))
      (if (looking-at "%%")
	  (end-of-line)
	(let ((pt (point))
	      (p (calc-read-parse-table-part ":=[\n\t ]+" ":=")))
	  (or (stringp (car p))
	      (and (integerp (car p))
		   (stringp (nth 1 p)))
	      (progn
		(goto-char pt)
		(error "Malformed syntax rule")))
	  (let ((pos (point)))
	    (end-of-line)
	    (let* ((str (buffer-substring pos (point)))
		   (exp (with-current-buffer calc-buf
			  (let ((calc-user-parse-tables nil)
				(calc-language nil)
				(math-expr-opers (math-standard-ops))
				(calc-hashes-used 0))
			    (math-read-expr
			     (if (string-match ",[ \t]*\\'" str)
				 (substring str 0 (match-beginning 0))
			       str))))))
	      (if (eq (car-safe exp) 'error)
		  (progn
		    (goto-char (+ pos (nth 1 exp)))
		    (error (nth 2 exp))))
	      (setq tab (nconc tab (list (cons p exp)))))))))
    tab))