Function: math-read-big-expr

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

Signature

(math-read-big-expr STR)

Source Code

;; Defined in /usr/src/emacs/lisp/calc/calc-ext.el.gz
(defun math-read-big-expr (str)
  (and (> (length calc-left-label) 0)
       (string-match (concat "^" (regexp-quote calc-left-label)) str)
       (setq str (concat (substring str 0 (match-beginning 0))
			 (substring str (match-end 0)))))
  (and (> (length calc-right-label) 0)
       (string-match (concat (regexp-quote calc-right-label) " *$") str)
       (setq str (concat (substring str 0 (match-beginning 0))
			 (substring str (match-end 0)))))
  (if (string-match "\\\\[^ \n|]" str)
      (if (eq calc-language 'latex)
	  (math-read-expr str)
	(let ((calc-language 'latex)
	      (calc-language-option nil)
	      (math-expr-opers (get 'latex 'math-oper-table))
	      (math-expr-function-mapping (get 'latex 'math-function-table))
	      (math-expr-variable-mapping (get 'latex 'math-variable-table)))
	  (math-read-expr str)))
    (let ((math-read-big-lines nil)
	  (pos 0)
	  (width 0)
	  (math-read-big-err-msg nil)
	  math-read-big-baseline math-read-big-h2
	  new-pos p)
      (while (setq new-pos (string-search "\n" str pos))
	(setq math-read-big-lines
              (cons (substring str pos new-pos) math-read-big-lines)
	      pos (1+ new-pos)))
      (setq math-read-big-lines
            (nreverse (cons (substring str pos) math-read-big-lines))
	    p math-read-big-lines)
      (while p
	(setq width (max width (length (car p)))
	      p (cdr p)))
      (if (math-read-big-bigp math-read-big-lines)
	  (or (catch 'syntax
		(math-read-big-rec 0 0 width (length math-read-big-lines)))
	      math-read-big-err-msg
	      '(error 0 "Syntax error"))
	(math-read-expr str)))))