Mercurial > emacs
comparison lisp/calc/calc-ext.el @ 58132:349b9aab8e82
(math-read-expr): Use declared variables math-exp-pos,
math-exp-old-pos, math-exp-str, math-exp-token,
math-exp-keep-spaces.
author | Jay Belanger <jay.p.belanger@gmail.com> |
---|---|
date | Thu, 11 Nov 2004 05:50:09 +0000 |
parents | 57dc7bb5ee57 |
children | ad1cd229b771 |
comparison
equal
deleted
inserted
replaced
58131:be4a8443df49 | 58132:349b9aab8e82 |
---|---|
2885 | 2885 |
2886 ;;; Expression parsing. | 2886 ;;; Expression parsing. |
2887 | 2887 |
2888 (defvar math-expr-data) | 2888 (defvar math-expr-data) |
2889 | 2889 |
2890 (defun math-read-expr (exp-str) | 2890 (defun math-read-expr (math-exp-str) |
2891 (let ((exp-pos 0) | 2891 (let ((math-exp-pos 0) |
2892 (exp-old-pos 0) | 2892 (math-exp-old-pos 0) |
2893 (exp-keep-spaces nil) | 2893 (math-exp-keep-spaces nil) |
2894 exp-token math-expr-data) | 2894 math-exp-token math-expr-data) |
2895 (while (setq exp-token (string-match "\\.\\.\\([^.]\\|.[^.]\\)" exp-str)) | 2895 (while (setq math-exp-token (string-match "\\.\\.\\([^.]\\|.[^.]\\)" math-exp-str)) |
2896 (setq exp-str (concat (substring exp-str 0 exp-token) "\\dots" | 2896 (setq math-exp-str (concat (substring math-exp-str 0 math-exp-token) "\\dots" |
2897 (substring exp-str (+ exp-token 2))))) | 2897 (substring math-exp-str (+ math-exp-token 2))))) |
2898 (math-build-parse-table) | 2898 (math-build-parse-table) |
2899 (math-read-token) | 2899 (math-read-token) |
2900 (let ((val (catch 'syntax (math-read-expr-level 0)))) | 2900 (let ((val (catch 'syntax (math-read-expr-level 0)))) |
2901 (if (stringp val) | 2901 (if (stringp val) |
2902 (list 'error exp-old-pos val) | 2902 (list 'error math-exp-old-pos val) |
2903 (if (equal exp-token 'end) | 2903 (if (equal math-exp-token 'end) |
2904 val | 2904 val |
2905 (list 'error exp-old-pos "Syntax error")))))) | 2905 (list 'error math-exp-old-pos "Syntax error")))))) |
2906 | 2906 |
2907 (defun math-read-plain-expr (exp-str &optional error-check) | 2907 (defun math-read-plain-expr (exp-str &optional error-check) |
2908 (let* ((calc-language nil) | 2908 (let* ((calc-language nil) |
2909 (math-expr-opers math-standard-opers) | 2909 (math-expr-opers math-standard-opers) |
2910 (val (math-read-expr exp-str))) | 2910 (val (math-read-expr exp-str))) |