Function: calc-check-user-syntax
calc-check-user-syntax is an autoloaded and byte-compiled function
defined in calc-aent.el.gz.
Signature
(calc-check-user-syntax &optional X PREC)
Source Code
;; Defined in /usr/src/emacs/lisp/calc/calc-aent.el.gz
;;;###autoload
(defun calc-check-user-syntax (&optional x prec)
(let ((p calc-user-parse-table)
(matches nil)
match rule)
(while (and p
(or (not (progn
(setq rule (car (car p)))
(if x
(and (integerp (car rule))
(>= (car rule) prec)
(equal math-expr-data
(car (setq rule (cdr rule)))))
(equal math-expr-data (car rule)))))
(let ((save-exp-pos math-exp-pos)
(save-exp-old-pos math-exp-old-pos)
(save-exp-token math-exp-token)
(save-exp-data math-expr-data))
(or (not (listp
(setq matches (calc-match-user-syntax rule))))
(let ((args (progn
(require 'calc-ext)
calc-arg-values))
(conds nil)
temp)
(if x
(setq matches (cons x matches)))
(setq match (cdr (car p)))
(while (and (eq (car-safe match)
'calcFunc-condition)
(= (length match) 3))
(setq conds (append (math-flatten-lands
(nth 2 match))
conds)
match (nth 1 match)))
(while (and conds match)
(require 'calc-ext)
(cond ((eq (car-safe (car conds))
'calcFunc-let)
(setq temp (car conds))
(or (= (length temp) 3)
(and (= (length temp) 2)
(eq (car-safe (nth 1 temp))
'calcFunc-assign)
(= (length (nth 1 temp)) 3)
(setq temp (nth 1 temp)))
(setq match nil))
(setq matches (cons
(math-normalize
(math-multi-subst
(nth 2 temp)
args matches))
matches)
args (cons (nth 1 temp)
args)))
((and (eq (car-safe (car conds))
'calcFunc-matches)
(= (length (car conds)) 3))
(setq temp (calcFunc-vmatches
(math-multi-subst
(nth 1 (car conds))
args matches)
(nth 2 (car conds))))
(if (eq temp 0)
(setq match nil)
(while (setq temp (cdr temp))
(setq matches (cons (nth 2 (car temp))
matches)
args (cons (nth 1 (car temp))
args)))))
(t
(or (math-is-true (math-simplify
(math-multi-subst
(car conds)
args matches)))
(setq match nil))))
(setq conds (cdr conds)))
(if match
(not (setq match (math-multi-subst
match args matches)))
(setq math-exp-old-pos save-exp-old-pos
math-exp-token save-exp-token
math-expr-data save-exp-data
math-exp-pos save-exp-pos)))))))
(setq p (cdr p)))
(and p match)))