aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJay Belanger2004-11-09 20:32:37 +0000
committerJay Belanger2004-11-09 20:32:37 +0000
commitabd880c33ecde1e4549934094b6b645ffadf89e2 (patch)
tree7ec29732dc9698d1881a5b7337bc48592a36a11d
parent54961aa0cacb28bb28a71cec28e92cc5fb0b1761 (diff)
downloademacs-abd880c33ecde1e4549934094b6b645ffadf89e2.tar.gz
emacs-abd880c33ecde1e4549934094b6b645ffadf89e2.zip
(math-read-exprs, math-read-expr-list, math-read-expr-level,
math-read-token, calc-check-user-syntax, calc-match-user-syntax, math-read-if, math-factor-after, math-read-factor): Use declared variable math-expr-data.
-rw-r--r--lisp/calc/calc-aent.el162
1 files changed, 81 insertions, 81 deletions
diff --git a/lisp/calc/calc-aent.el b/lisp/calc/calc-aent.el
index 2db722ccb2d..fef561742dc 100644
--- a/lisp/calc/calc-aent.el
+++ b/lisp/calc/calc-aent.el
@@ -464,7 +464,7 @@
464 (let ((exp-pos 0) 464 (let ((exp-pos 0)
465 (exp-old-pos 0) 465 (exp-old-pos 0)
466 (exp-keep-spaces nil) 466 (exp-keep-spaces nil)
467 exp-token exp-data) 467 exp-token math-expr-data)
468 (if calc-language-input-filter 468 (if calc-language-input-filter
469 (setq exp-str (funcall calc-language-input-filter exp-str))) 469 (setq exp-str (funcall calc-language-input-filter exp-str)))
470 (while (setq exp-token (string-match "\\.\\.\\([^.]\\|.[^.]\\)" exp-str)) 470 (while (setq exp-token (string-match "\\.\\.\\([^.]\\|.[^.]\\)" exp-str))
@@ -483,7 +483,7 @@
483 (let* ((exp-keep-spaces nil) 483 (let* ((exp-keep-spaces nil)
484 (val (list (math-read-expr-level 0))) 484 (val (list (math-read-expr-level 0)))
485 (last val)) 485 (last val))
486 (while (equal exp-data ",") 486 (while (equal math-expr-data ",")
487 (math-read-token) 487 (math-read-token)
488 (let ((rest (list (math-read-expr-level 0)))) 488 (let ((rest (list (math-read-expr-level 0))))
489 (setcdr last rest) 489 (setcdr last rest)
@@ -545,21 +545,21 @@
545 (if (>= exp-pos (length exp-str)) 545 (if (>= exp-pos (length exp-str))
546 (setq exp-old-pos exp-pos 546 (setq exp-old-pos exp-pos
547 exp-token 'end 547 exp-token 'end
548 exp-data "\000") 548 math-expr-data "\000")
549 (let ((ch (aref exp-str exp-pos))) 549 (let ((ch (aref exp-str exp-pos)))
550 (setq exp-old-pos exp-pos) 550 (setq exp-old-pos exp-pos)
551 (cond ((memq ch '(32 10 9)) 551 (cond ((memq ch '(32 10 9))
552 (setq exp-pos (1+ exp-pos)) 552 (setq exp-pos (1+ exp-pos))
553 (if exp-keep-spaces 553 (if exp-keep-spaces
554 (setq exp-token 'space 554 (setq exp-token 'space
555 exp-data " ") 555 math-expr-data " ")
556 (math-read-token))) 556 (math-read-token)))
557 ((and (memq ch calc-user-token-chars) 557 ((and (memq ch calc-user-token-chars)
558 (let ((case-fold-search nil)) 558 (let ((case-fold-search nil))
559 (eq (string-match calc-user-tokens exp-str exp-pos) 559 (eq (string-match calc-user-tokens exp-str exp-pos)
560 exp-pos))) 560 exp-pos)))
561 (setq exp-token 'punc 561 (setq exp-token 'punc
562 exp-data (math-match-substring exp-str 0) 562 math-expr-data (math-match-substring exp-str 0)
563 exp-pos (match-end 0))) 563 exp-pos (match-end 0)))
564 ((or (and (>= ch ?a) (<= ch ?z)) 564 ((or (and (>= ch ?a) (<= ch ?z))
565 (and (>= ch ?A) (<= ch ?Z))) 565 (and (>= ch ?A) (<= ch ?Z)))
@@ -569,21 +569,21 @@
569 exp-str exp-pos) 569 exp-str exp-pos)
570 (setq exp-token 'symbol 570 (setq exp-token 'symbol
571 exp-pos (match-end 0) 571 exp-pos (match-end 0)
572 exp-data (math-restore-dashes 572 math-expr-data (math-restore-dashes
573 (math-match-substring exp-str 0))) 573 (math-match-substring exp-str 0)))
574 (if (eq calc-language 'eqn) 574 (if (eq calc-language 'eqn)
575 (let ((code (assoc exp-data math-eqn-ignore-words))) 575 (let ((code (assoc math-expr-data math-eqn-ignore-words)))
576 (cond ((null code)) 576 (cond ((null code))
577 ((null (cdr code)) 577 ((null (cdr code))
578 (math-read-token)) 578 (math-read-token))
579 ((consp (nth 1 code)) 579 ((consp (nth 1 code))
580 (math-read-token) 580 (math-read-token)
581 (if (assoc exp-data (cdr code)) 581 (if (assoc math-expr-data (cdr code))
582 (setq exp-data (format "%s %s" 582 (setq math-expr-data (format "%s %s"
583 (car code) exp-data)))) 583 (car code) math-expr-data))))
584 ((eq (nth 1 code) 'punc) 584 ((eq (nth 1 code) 'punc)
585 (setq exp-token 'punc 585 (setq exp-token 'punc
586 exp-data (nth 2 code))) 586 math-expr-data (nth 2 code)))
587 (t 587 (t
588 (math-read-token) 588 (math-read-token)
589 (math-read-token)))))) 589 (math-read-token))))))
@@ -602,7 +602,7 @@
602 (string-match "0[xX][0-9a-fA-F]+" exp-str exp-pos)) 602 (string-match "0[xX][0-9a-fA-F]+" exp-str exp-pos))
603 (string-match "_?\\([0-9]+.?0*@ *\\)?\\([0-9]+.?0*' *\\)?\\(0*\\([2-9]\\|1[0-4]\\)\\(#\\|\\^\\^\\)[0-9a-dA-D.]+[eE][-+_]?[0-9]+\\|0*\\([2-9]\\|[0-2][0-9]\\|3[0-6]\\)\\(#\\|\\^\\^\\)[0-9a-zA-Z:.]+\\|[0-9]+:[0-9:]+\\|[0-9.]+\\([eE][-+_]?[0-9]+\\)?\"?\\)?" exp-str exp-pos)) 603 (string-match "_?\\([0-9]+.?0*@ *\\)?\\([0-9]+.?0*' *\\)?\\(0*\\([2-9]\\|1[0-4]\\)\\(#\\|\\^\\^\\)[0-9a-dA-D.]+[eE][-+_]?[0-9]+\\|0*\\([2-9]\\|[0-2][0-9]\\|3[0-6]\\)\\(#\\|\\^\\^\\)[0-9a-zA-Z:.]+\\|[0-9]+:[0-9:]+\\|[0-9.]+\\([eE][-+_]?[0-9]+\\)?\"?\\)?" exp-str exp-pos))
604 (setq exp-token 'number 604 (setq exp-token 'number
605 exp-data (math-match-substring exp-str 0) 605 math-expr-data (math-match-substring exp-str 0)
606 exp-pos (match-end 0))) 606 exp-pos (match-end 0)))
607 ((eq ch ?\$) 607 ((eq ch ?\$)
608 (if (and (eq calc-language 'pascal) 608 (if (and (eq calc-language 'pascal)
@@ -611,30 +611,30 @@
611 exp-str exp-pos) 611 exp-str exp-pos)
612 exp-pos)) 612 exp-pos))
613 (setq exp-token 'number 613 (setq exp-token 'number
614 exp-data (math-match-substring exp-str 1) 614 math-expr-data (math-match-substring exp-str 1)
615 exp-pos (match-end 1)) 615 exp-pos (match-end 1))
616 (if (eq (string-match "\\$\\([1-9][0-9]*\\)" exp-str exp-pos) 616 (if (eq (string-match "\\$\\([1-9][0-9]*\\)" exp-str exp-pos)
617 exp-pos) 617 exp-pos)
618 (setq exp-data (- (string-to-int (math-match-substring 618 (setq math-expr-data (- (string-to-int (math-match-substring
619 exp-str 1)))) 619 exp-str 1))))
620 (string-match "\\$+" exp-str exp-pos) 620 (string-match "\\$+" exp-str exp-pos)
621 (setq exp-data (- (match-end 0) (match-beginning 0)))) 621 (setq math-expr-data (- (match-end 0) (match-beginning 0))))
622 (setq exp-token 'dollar 622 (setq exp-token 'dollar
623 exp-pos (match-end 0)))) 623 exp-pos (match-end 0))))
624 ((eq ch ?\#) 624 ((eq ch ?\#)
625 (if (eq (string-match "#\\([1-9][0-9]*\\)" exp-str exp-pos) 625 (if (eq (string-match "#\\([1-9][0-9]*\\)" exp-str exp-pos)
626 exp-pos) 626 exp-pos)
627 (setq exp-data (string-to-int 627 (setq math-expr-data (string-to-int
628 (math-match-substring exp-str 1)) 628 (math-match-substring exp-str 1))
629 exp-pos (match-end 0)) 629 exp-pos (match-end 0))
630 (setq exp-data 1 630 (setq math-expr-data 1
631 exp-pos (1+ exp-pos))) 631 exp-pos (1+ exp-pos)))
632 (setq exp-token 'hash)) 632 (setq exp-token 'hash))
633 ((eq (string-match "~=\\|<=\\|>=\\|<>\\|/=\\|\\+/-\\|\\\\dots\\|\\\\ldots\\|\\*\\*\\|<<\\|>>\\|==\\|!=\\|&&&\\||||\\|!!!\\|&&\\|||\\|!!\\|:=\\|::\\|=>" 633 ((eq (string-match "~=\\|<=\\|>=\\|<>\\|/=\\|\\+/-\\|\\\\dots\\|\\\\ldots\\|\\*\\*\\|<<\\|>>\\|==\\|!=\\|&&&\\||||\\|!!!\\|&&\\|||\\|!!\\|:=\\|::\\|=>"
634 exp-str exp-pos) 634 exp-str exp-pos)
635 exp-pos) 635 exp-pos)
636 (setq exp-token 'punc 636 (setq exp-token 'punc
637 exp-data (math-match-substring exp-str 0) 637 math-expr-data (math-match-substring exp-str 0)
638 exp-pos (match-end 0))) 638 exp-pos (match-end 0)))
639 ((and (eq ch ?\") 639 ((and (eq ch ?\")
640 (string-match "\\(\"\\([^\"\\]\\|\\\\.\\)*\\)\\(\"\\|\\'\\)" exp-str exp-pos)) 640 (string-match "\\(\"\\([^\"\\]\\|\\\\.\\)*\\)\\(\"\\|\\'\\)" exp-str exp-pos))
@@ -646,7 +646,7 @@
646 (aset exp-str (match-end 1) ?\})) 646 (aset exp-str (match-end 1) ?\}))
647 (math-read-token)) 647 (math-read-token))
648 (setq exp-token 'string 648 (setq exp-token 'string
649 exp-data (math-match-substring exp-str 1) 649 math-expr-data (math-match-substring exp-str 1)
650 exp-pos (match-end 0)))) 650 exp-pos (match-end 0))))
651 ((and (= ch ?\\) (eq calc-language 'tex) 651 ((and (= ch ?\\) (eq calc-language 'tex)
652 (< exp-pos (1- (length exp-str)))) 652 (< exp-pos (1- (length exp-str))))
@@ -654,20 +654,20 @@
654 (string-match "\\(\\\\\\([a-zA-Z]+\\|[^a-zA-Z]\\)\\)" exp-str exp-pos)) 654 (string-match "\\(\\\\\\([a-zA-Z]+\\|[^a-zA-Z]\\)\\)" exp-str exp-pos))
655 (setq exp-token 'symbol 655 (setq exp-token 'symbol
656 exp-pos (match-end 0) 656 exp-pos (match-end 0)
657 exp-data (math-restore-dashes 657 math-expr-data (math-restore-dashes
658 (math-match-substring exp-str 1))) 658 (math-match-substring exp-str 1)))
659 (let ((code (assoc exp-data math-tex-ignore-words))) 659 (let ((code (assoc math-expr-data math-tex-ignore-words)))
660 (cond ((null code)) 660 (cond ((null code))
661 ((null (cdr code)) 661 ((null (cdr code))
662 (math-read-token)) 662 (math-read-token))
663 ((eq (nth 1 code) 'punc) 663 ((eq (nth 1 code) 'punc)
664 (setq exp-token 'punc 664 (setq exp-token 'punc
665 exp-data (nth 2 code))) 665 math-expr-data (nth 2 code)))
666 ((and (eq (nth 1 code) 'mat) 666 ((and (eq (nth 1 code) 'mat)
667 (string-match " *{" exp-str exp-pos)) 667 (string-match " *{" exp-str exp-pos))
668 (setq exp-pos (match-end 0) 668 (setq exp-pos (match-end 0)
669 exp-token 'punc 669 exp-token 'punc
670 exp-data "[") 670 math-expr-data "[")
671 (let ((right (string-match "}" exp-str exp-pos))) 671 (let ((right (string-match "}" exp-str exp-pos)))
672 (and right 672 (and right
673 (setq exp-str (copy-sequence exp-str)) 673 (setq exp-str (copy-sequence exp-str))
@@ -676,24 +676,24 @@
676 (eq (string-match "\\.[a-zA-Z][a-zA-Z][a-zA-Z]?\\." 676 (eq (string-match "\\.[a-zA-Z][a-zA-Z][a-zA-Z]?\\."
677 exp-str exp-pos) exp-pos)) 677 exp-str exp-pos) exp-pos))
678 (setq exp-token 'punc 678 (setq exp-token 'punc
679 exp-data (upcase (math-match-substring exp-str 0)) 679 math-expr-data (upcase (math-match-substring exp-str 0))
680 exp-pos (match-end 0))) 680 exp-pos (match-end 0)))
681 ((and (eq calc-language 'math) 681 ((and (eq calc-language 'math)
682 (eq (string-match "\\[\\[\\|->\\|:>" exp-str exp-pos) 682 (eq (string-match "\\[\\[\\|->\\|:>" exp-str exp-pos)
683 exp-pos)) 683 exp-pos))
684 (setq exp-token 'punc 684 (setq exp-token 'punc
685 exp-data (math-match-substring exp-str 0) 685 math-expr-data (math-match-substring exp-str 0)
686 exp-pos (match-end 0))) 686 exp-pos (match-end 0)))
687 ((and (eq calc-language 'eqn) 687 ((and (eq calc-language 'eqn)
688 (eq (string-match "->\\|<-\\|+-\\|\\\\dots\\|~\\|\\^" 688 (eq (string-match "->\\|<-\\|+-\\|\\\\dots\\|~\\|\\^"
689 exp-str exp-pos) 689 exp-str exp-pos)
690 exp-pos)) 690 exp-pos))
691 (setq exp-token 'punc 691 (setq exp-token 'punc
692 exp-data (math-match-substring exp-str 0) 692 math-expr-data (math-match-substring exp-str 0)
693 exp-pos (match-end 0)) 693 exp-pos (match-end 0))
694 (and (eq (string-match "\\\\dots\\." exp-str exp-pos) exp-pos) 694 (and (eq (string-match "\\\\dots\\." exp-str exp-pos) exp-pos)
695 (setq exp-pos (match-end 0))) 695 (setq exp-pos (match-end 0)))
696 (if (memq (aref exp-data 0) '(?~ ?^)) 696 (if (memq (aref math-expr-data 0) '(?~ ?^))
697 (math-read-token))) 697 (math-read-token)))
698 ((eq (string-match "%%.*$" exp-str exp-pos) exp-pos) 698 ((eq (string-match "%%.*$" exp-str exp-pos) exp-pos)
699 (setq exp-pos (match-end 0)) 699 (setq exp-pos (match-end 0))
@@ -706,7 +706,7 @@
706 (if (and (eq ch ?\&) (eq calc-language 'tex)) 706 (if (and (eq ch ?\&) (eq calc-language 'tex))
707 (setq ch ?\,)) 707 (setq ch ?\,))
708 (setq exp-token 'punc 708 (setq exp-token 'punc
709 exp-data (char-to-string ch) 709 math-expr-data (char-to-string ch)
710 exp-pos (1+ exp-pos))))))) 710 exp-pos (1+ exp-pos)))))))
711 711
712 712
@@ -716,10 +716,10 @@
716 (setq op (calc-check-user-syntax x exp-prec)) 716 (setq op (calc-check-user-syntax x exp-prec))
717 (setq x op 717 (setq x op
718 op '("2x" ident 999999 -1))) 718 op '("2x" ident 999999 -1)))
719 (and (setq op (assoc exp-data math-expr-opers)) 719 (and (setq op (assoc math-expr-data math-expr-opers))
720 (/= (nth 2 op) -1) 720 (/= (nth 2 op) -1)
721 (or (and (setq op2 (assoc 721 (or (and (setq op2 (assoc
722 exp-data 722 math-expr-data
723 (cdr (memq op math-expr-opers)))) 723 (cdr (memq op math-expr-opers))))
724 (eq (= (nth 3 op) -1) 724 (eq (= (nth 3 op) -1)
725 (/= (nth 3 op2) -1)) 725 (/= (nth 3 op2) -1))
@@ -729,12 +729,12 @@
729 t)) 729 t))
730 (and (or (eq (nth 2 op) -1) 730 (and (or (eq (nth 2 op) -1)
731 (memq exp-token '(symbol number dollar hash)) 731 (memq exp-token '(symbol number dollar hash))
732 (equal exp-data "(") 732 (equal math-expr-data "(")
733 (and (equal exp-data "[") 733 (and (equal math-expr-data "[")
734 (not (eq calc-language 'math)) 734 (not (eq calc-language 'math))
735 (not (and exp-keep-spaces 735 (not (and exp-keep-spaces
736 (eq (car-safe x) 'vec))))) 736 (eq (car-safe x) 'vec)))))
737 (or (not (setq op (assoc exp-data math-expr-opers))) 737 (or (not (setq op (assoc math-expr-data math-expr-opers)))
738 (/= (nth 2 op) -1)) 738 (/= (nth 2 op) -1))
739 (or (not calc-user-parse-table) 739 (or (not calc-user-parse-table)
740 (not (eq exp-token 'symbol)) 740 (not (eq exp-token 'symbol))
@@ -744,11 +744,11 @@
744 (car (car (car p))))) 744 (car (car (car p)))))
745 (not (equal 745 (not (equal
746 (nth 1 (car (car p))) 746 (nth 1 (car (car p)))
747 exp-data)))) 747 math-expr-data))))
748 (setq p (cdr p))) 748 (setq p (cdr p)))
749 (not p))) 749 (not p)))
750 (setq op (assoc "2x" math-expr-opers)))) 750 (setq op (assoc "2x" math-expr-opers))))
751 (not (and exp-term (equal exp-data exp-term))) 751 (not (and exp-term (equal math-expr-data exp-term)))
752 (>= (nth 2 op) exp-prec)) 752 (>= (nth 2 op) exp-prec))
753 (if (not (equal (car op) "2x")) 753 (if (not (equal (car op) "2x"))
754 (math-read-token)) 754 (math-read-token))
@@ -787,13 +787,13 @@
787 (if x 787 (if x
788 (and (integerp (car rule)) 788 (and (integerp (car rule))
789 (>= (car rule) prec) 789 (>= (car rule) prec)
790 (equal exp-data 790 (equal math-expr-data
791 (car (setq rule (cdr rule))))) 791 (car (setq rule (cdr rule)))))
792 (equal exp-data (car rule))))) 792 (equal math-expr-data (car rule)))))
793 (let ((save-exp-pos exp-pos) 793 (let ((save-exp-pos exp-pos)
794 (save-exp-old-pos exp-old-pos) 794 (save-exp-old-pos exp-old-pos)
795 (save-exp-token exp-token) 795 (save-exp-token exp-token)
796 (save-exp-data exp-data)) 796 (save-exp-data math-expr-data))
797 (or (not (listp 797 (or (not (listp
798 (setq matches (calc-match-user-syntax rule)))) 798 (setq matches (calc-match-user-syntax rule))))
799 (let ((args (progn 799 (let ((args (progn
@@ -858,7 +858,7 @@
858 match args matches))) 858 match args matches)))
859 (setq exp-old-pos save-exp-old-pos 859 (setq exp-old-pos save-exp-old-pos
860 exp-token save-exp-token 860 exp-token save-exp-token
861 exp-data save-exp-data 861 math-expr-data save-exp-data
862 exp-pos save-exp-pos))))))) 862 exp-pos save-exp-pos)))))))
863 (setq p (cdr p))) 863 (setq p (cdr p)))
864 (and p match))) 864 (and p match)))
@@ -868,10 +868,10 @@
868 (save-exp-pos exp-pos) 868 (save-exp-pos exp-pos)
869 (save-exp-old-pos exp-old-pos) 869 (save-exp-old-pos exp-old-pos)
870 (save-exp-token exp-token) 870 (save-exp-token exp-token)
871 (save-exp-data exp-data)) 871 (save-exp-data math-expr-data))
872 (while (and p 872 (while (and p
873 (cond ((stringp (car p)) 873 (cond ((stringp (car p))
874 (and (equal exp-data (car p)) 874 (and (equal math-expr-data (car p))
875 (progn 875 (progn
876 (math-read-token) 876 (math-read-token)
877 t))) 877 t)))
@@ -918,7 +918,7 @@
918 (setq exp-pos save-exp-pos 918 (setq exp-pos save-exp-pos
919 exp-old-pos save-exp-old-pos 919 exp-old-pos save-exp-old-pos
920 exp-token save-exp-token 920 exp-token save-exp-token
921 exp-data save-exp-data 921 math-expr-data save-exp-data
922 matches "Failed")) 922 matches "Failed"))
923 matches)) 923 matches))
924 924
@@ -940,25 +940,25 @@
940 940
941(defun math-read-if (cond op) 941(defun math-read-if (cond op)
942 (let ((then (math-read-expr-level 0))) 942 (let ((then (math-read-expr-level 0)))
943 (or (equal exp-data ":") 943 (or (equal math-expr-data ":")
944 (throw 'syntax "Expected ':'")) 944 (throw 'syntax "Expected ':'"))
945 (math-read-token) 945 (math-read-token)
946 (list 'calcFunc-if cond then (math-read-expr-level (nth 3 op))))) 946 (list 'calcFunc-if cond then (math-read-expr-level (nth 3 op)))))
947 947
948(defun math-factor-after () 948(defun math-factor-after ()
949 (let ((exp-pos exp-pos) 949 (let ((exp-pos exp-pos)
950 exp-old-pos exp-token exp-data) 950 exp-old-pos exp-token math-expr-data)
951 (math-read-token) 951 (math-read-token)
952 (or (memq exp-token '(number symbol dollar hash string)) 952 (or (memq exp-token '(number symbol dollar hash string))
953 (and (assoc exp-data '(("-") ("+") ("!") ("|") ("/"))) 953 (and (assoc math-expr-data '(("-") ("+") ("!") ("|") ("/")))
954 (assoc (concat "u" exp-data) math-expr-opers)) 954 (assoc (concat "u" math-expr-data) math-expr-opers))
955 (eq (nth 2 (assoc exp-data math-expr-opers)) -1) 955 (eq (nth 2 (assoc math-expr-data math-expr-opers)) -1)
956 (assoc exp-data '(("(") ("[") ("{")))))) 956 (assoc math-expr-data '(("(") ("[") ("{"))))))
957 957
958(defun math-read-factor () 958(defun math-read-factor ()
959 (let (op) 959 (let (op)
960 (cond ((eq exp-token 'number) 960 (cond ((eq exp-token 'number)
961 (let ((num (math-read-number exp-data))) 961 (let ((num (math-read-number math-expr-data)))
962 (if (not num) 962 (if (not num)
963 (progn 963 (progn
964 (setq exp-old-pos exp-pos) 964 (setq exp-old-pos exp-pos)
@@ -971,14 +971,14 @@
971 ((and calc-user-parse-table 971 ((and calc-user-parse-table
972 (setq op (calc-check-user-syntax))) 972 (setq op (calc-check-user-syntax)))
973 op) 973 op)
974 ((or (equal exp-data "-") 974 ((or (equal math-expr-data "-")
975 (equal exp-data "+") 975 (equal math-expr-data "+")
976 (equal exp-data "!") 976 (equal math-expr-data "!")
977 (equal exp-data "|") 977 (equal math-expr-data "|")
978 (equal exp-data "/")) 978 (equal math-expr-data "/"))
979 (setq exp-data (concat "u" exp-data)) 979 (setq math-expr-data (concat "u" math-expr-data))
980 (math-read-factor)) 980 (math-read-factor))
981 ((and (setq op (assoc exp-data math-expr-opers)) 981 ((and (setq op (assoc math-expr-data math-expr-opers))
982 (eq (nth 2 op) -1)) 982 (eq (nth 2 op) -1))
983 (if (consp (nth 1 op)) 983 (if (consp (nth 1 op))
984 (funcall (car (nth 1 op)) op) 984 (funcall (car (nth 1 op)) op)
@@ -991,18 +991,18 @@
991 (math-neg val)) 991 (math-neg val))
992 (t (list (nth 1 op) val)))))) 992 (t (list (nth 1 op) val))))))
993 ((eq exp-token 'symbol) 993 ((eq exp-token 'symbol)
994 (let ((sym (intern exp-data))) 994 (let ((sym (intern math-expr-data)))
995 (math-read-token) 995 (math-read-token)
996 (if (equal exp-data calc-function-open) 996 (if (equal math-expr-data calc-function-open)
997 (let ((f (assq sym math-expr-function-mapping))) 997 (let ((f (assq sym math-expr-function-mapping)))
998 (math-read-token) 998 (math-read-token)
999 (if (consp (cdr f)) 999 (if (consp (cdr f))
1000 (funcall (car (cdr f)) f sym) 1000 (funcall (car (cdr f)) f sym)
1001 (let ((args (if (or (equal exp-data calc-function-close) 1001 (let ((args (if (or (equal math-expr-data calc-function-close)
1002 (eq exp-token 'end)) 1002 (eq exp-token 'end))
1003 nil 1003 nil
1004 (math-read-expr-list)))) 1004 (math-read-expr-list))))
1005 (if (not (or (equal exp-data calc-function-close) 1005 (if (not (or (equal math-expr-data calc-function-close)
1006 (eq exp-token 'end))) 1006 (eq exp-token 'end)))
1007 (throw 'syntax "Expected `)'")) 1007 (throw 'syntax "Expected `)'"))
1008 (math-read-token) 1008 (math-read-token)
@@ -1045,18 +1045,18 @@
1045 4)) 1045 4))
1046 (cdr v)))))) 1046 (cdr v))))))
1047 (while (and (memq calc-language '(c pascal maple)) 1047 (while (and (memq calc-language '(c pascal maple))
1048 (equal exp-data "[")) 1048 (equal math-expr-data "["))
1049 (math-read-token) 1049 (math-read-token)
1050 (setq val (append (list 'calcFunc-subscr val) 1050 (setq val (append (list 'calcFunc-subscr val)
1051 (math-read-expr-list))) 1051 (math-read-expr-list)))
1052 (if (equal exp-data "]") 1052 (if (equal math-expr-data "]")
1053 (math-read-token) 1053 (math-read-token)
1054 (throw 'syntax "Expected ']'"))) 1054 (throw 'syntax "Expected ']'")))
1055 val))))) 1055 val)))))
1056 ((eq exp-token 'dollar) 1056 ((eq exp-token 'dollar)
1057 (let ((abs (if (> exp-data 0) exp-data (- exp-data)))) 1057 (let ((abs (if (> math-expr-data 0) math-expr-data (- math-expr-data))))
1058 (if (>= (length calc-dollar-values) abs) 1058 (if (>= (length calc-dollar-values) abs)
1059 (let ((num exp-data)) 1059 (let ((num math-expr-data))
1060 (math-read-token) 1060 (math-read-token)
1061 (setq calc-dollar-used (max calc-dollar-used num)) 1061 (setq calc-dollar-used (max calc-dollar-used num))
1062 (math-check-complete (nth (1- abs) calc-dollar-values))) 1062 (math-check-complete (nth (1- abs) calc-dollar-values)))
@@ -1067,22 +1067,22 @@
1067 (or calc-hashes-used 1067 (or calc-hashes-used
1068 (throw 'syntax "#'s not allowed in this context")) 1068 (throw 'syntax "#'s not allowed in this context"))
1069 (calc-extensions) 1069 (calc-extensions)
1070 (if (<= exp-data (length calc-arg-values)) 1070 (if (<= math-expr-data (length calc-arg-values))
1071 (let ((num exp-data)) 1071 (let ((num math-expr-data))
1072 (math-read-token) 1072 (math-read-token)
1073 (setq calc-hashes-used (max calc-hashes-used num)) 1073 (setq calc-hashes-used (max calc-hashes-used num))
1074 (nth (1- num) calc-arg-values)) 1074 (nth (1- num) calc-arg-values))
1075 (throw 'syntax "Too many # arguments"))) 1075 (throw 'syntax "Too many # arguments")))
1076 ((equal exp-data "(") 1076 ((equal math-expr-data "(")
1077 (let* ((exp (let ((exp-keep-spaces nil)) 1077 (let* ((exp (let ((exp-keep-spaces nil))
1078 (math-read-token) 1078 (math-read-token)
1079 (if (or (equal exp-data "\\dots") 1079 (if (or (equal math-expr-data "\\dots")
1080 (equal exp-data "\\ldots")) 1080 (equal math-expr-data "\\ldots"))
1081 '(neg (var inf var-inf)) 1081 '(neg (var inf var-inf))
1082 (math-read-expr-level 0))))) 1082 (math-read-expr-level 0)))))
1083 (let ((exp-keep-spaces nil)) 1083 (let ((exp-keep-spaces nil))
1084 (cond 1084 (cond
1085 ((equal exp-data ",") 1085 ((equal math-expr-data ",")
1086 (progn 1086 (progn
1087 (math-read-token) 1087 (math-read-token)
1088 (let ((exp2 (math-read-expr-level 0))) 1088 (let ((exp2 (math-read-expr-level 0)))
@@ -1090,7 +1090,7 @@
1090 (if (and exp2 (Math-realp exp) (Math-realp exp2)) 1090 (if (and exp2 (Math-realp exp) (Math-realp exp2))
1091 (math-normalize (list 'cplx exp exp2)) 1091 (math-normalize (list 'cplx exp exp2))
1092 (list '+ exp (list '* exp2 '(var i var-i)))))))) 1092 (list '+ exp (list '* exp2 '(var i var-i))))))))
1093 ((equal exp-data ";") 1093 ((equal math-expr-data ";")
1094 (progn 1094 (progn
1095 (math-read-token) 1095 (math-read-token)
1096 (let ((exp2 (math-read-expr-level 0))) 1096 (let ((exp2 (math-read-expr-level 0)))
@@ -1103,22 +1103,22 @@
1103 (list '* 1103 (list '*
1104 (math-to-radians-2 exp2) 1104 (math-to-radians-2 exp2)
1105 '(var i var-i))))))))) 1105 '(var i var-i)))))))))
1106 ((or (equal exp-data "\\dots") 1106 ((or (equal math-expr-data "\\dots")
1107 (equal exp-data "\\ldots")) 1107 (equal math-expr-data "\\ldots"))
1108 (progn 1108 (progn
1109 (math-read-token) 1109 (math-read-token)
1110 (let ((exp2 (if (or (equal exp-data ")") 1110 (let ((exp2 (if (or (equal math-expr-data ")")
1111 (equal exp-data "]") 1111 (equal math-expr-data "]")
1112 (eq exp-token 'end)) 1112 (eq exp-token 'end))
1113 '(var inf var-inf) 1113 '(var inf var-inf)
1114 (math-read-expr-level 0)))) 1114 (math-read-expr-level 0))))
1115 (setq exp 1115 (setq exp
1116 (list 'intv 1116 (list 'intv
1117 (if (equal exp-data ")") 0 1) 1117 (if (equal math-expr-data ")") 0 1)
1118 exp 1118 exp
1119 exp2))))))) 1119 exp2)))))))
1120 (if (not (or (equal exp-data ")") 1120 (if (not (or (equal math-expr-data ")")
1121 (and (equal exp-data "]") (eq (car-safe exp) 'intv)) 1121 (and (equal math-expr-data "]") (eq (car-safe exp) 'intv))
1122 (eq exp-token 'end))) 1122 (eq exp-token 'end)))
1123 (throw 'syntax "Expected `)'")) 1123 (throw 'syntax "Expected `)'"))
1124 (math-read-token) 1124 (math-read-token)
@@ -1126,13 +1126,13 @@
1126 ((eq exp-token 'string) 1126 ((eq exp-token 'string)
1127 (calc-extensions) 1127 (calc-extensions)
1128 (math-read-string)) 1128 (math-read-string))
1129 ((equal exp-data "[") 1129 ((equal math-expr-data "[")
1130 (calc-extensions) 1130 (calc-extensions)
1131 (math-read-brackets t "]")) 1131 (math-read-brackets t "]"))
1132 ((equal exp-data "{") 1132 ((equal math-expr-data "{")
1133 (calc-extensions) 1133 (calc-extensions)
1134 (math-read-brackets nil "}")) 1134 (math-read-brackets nil "}"))
1135 ((equal exp-data "<") 1135 ((equal math-expr-data "<")
1136 (calc-extensions) 1136 (calc-extensions)
1137 (math-read-angle-brackets)) 1137 (math-read-angle-brackets))
1138 (t (throw 'syntax "Expected a number"))))) 1138 (t (throw 'syntax "Expected a number")))))