Mercurial > emacs
comparison lisp/calc/calc-aent.el @ 108590:c84578d13e42
calc-aent.el (math-read-token, math-find-user-tokens):
calc-lang.el (math-read-big-rec, math-lang-read-symbol)
(math-compose-tex-func):
calccomp.el (math-compose-expr):
calc-ext.el (math-format-flat-expr-fancy):
calc-store.el (calc-read-var-name):
calc-units.el (calc-explain-units-rec): Allow Greek letters.
calc.el (var-¦Ð, var-¦Õ, var-¦Ã): New variables.
calc-aent.el (math-read-replacement-list): Add "micro" symbol.
calc-units.el (math-unit-prefixes): Add mu for micro.
(math-standard-units): Add units.
author | Jay Belanger <jay.p.belanger@gmail.com> |
---|---|
date | Fri, 14 May 2010 23:50:25 -0500 |
parents | 1d1d5d9bd884 |
children | d150a25a0eb9 |
comparison
equal
deleted
inserted
replaced
108589:b818f9578731 | 108590:c84578d13e42 |
---|---|
508 ("∞" "inf") ; infinity symbol | 508 ("∞" "inf") ; infinity symbol |
509 ("≤" "<=") | 509 ("≤" "<=") |
510 ("≥" ">=") | 510 ("≥" ">=") |
511 ("≦" "<=") | 511 ("≦" "<=") |
512 ("≧" ">=") | 512 ("≧" ">=") |
513 ("µ" "μ") | |
513 ;; fractions | 514 ;; fractions |
514 ("¼" "(1:4)") ; 1/4 | 515 ("¼" "(1:4)") ; 1/4 |
515 ("½" "(1:2)") ; 1/2 | 516 ("½" "(1:2)") ; 1/2 |
516 ("¾" "(3:4)") ; 3/4 | 517 ("¾" "(3:4)") ; 3/4 |
517 ("â…“" "(1:3)") ; 1/3 | 518 ("â…“" "(1:3)") ; 1/3 |
673 (defun math-find-user-tokens (p) | 674 (defun math-find-user-tokens (p) |
674 (while p | 675 (while p |
675 (cond ((and (stringp (car p)) | 676 (cond ((and (stringp (car p)) |
676 (or (> (length (car p)) 1) (equal (car p) "$") | 677 (or (> (length (car p)) 1) (equal (car p) "$") |
677 (equal (car p) "\"")) | 678 (equal (car p) "\"")) |
678 (string-match "[^a-zA-Z0-9]" (car p))) | 679 (string-match "[^a-zA-Zα-ωΑ-Ω0-9]" (car p))) |
679 (let ((s (regexp-quote (car p)))) | 680 (let ((s (regexp-quote (car p)))) |
680 (if (string-match "\\`[a-zA-Z0-9]" s) | 681 (if (string-match "\\`[a-zA-Zα-ωΑ-Ω0-9]" s) |
681 (setq s (concat "\\<" s))) | 682 (setq s (concat "\\<" s))) |
682 (if (string-match "[a-zA-Z0-9]\\'" s) | 683 (if (string-match "[a-zA-Zα-ωΑ-Ω0-9]\\'" s) |
683 (setq s (concat s "\\>"))) | 684 (setq s (concat s "\\>"))) |
684 (or (assoc s math-toks) | 685 (or (assoc s math-toks) |
685 (progn | 686 (progn |
686 (setq math-toks (cons (list s) math-toks)) | 687 (setq math-toks (cons (list s) math-toks)) |
687 (or (memq (aref (car p) 0) calc-user-token-chars) | 688 (or (memq (aref (car p) 0) calc-user-token-chars) |
716 math-exp-pos))) | 717 math-exp-pos))) |
717 (setq math-exp-token 'punc | 718 (setq math-exp-token 'punc |
718 math-expr-data (math-match-substring math-exp-str 0) | 719 math-expr-data (math-match-substring math-exp-str 0) |
719 math-exp-pos (match-end 0))) | 720 math-exp-pos (match-end 0))) |
720 ((or (and (>= ch ?a) (<= ch ?z)) | 721 ((or (and (>= ch ?a) (<= ch ?z)) |
721 (and (>= ch ?A) (<= ch ?Z))) | 722 (and (>= ch ?A) (<= ch ?Z)) |
723 (and (>= ch ?α) (<= ch ?ω)) | |
724 (and (>= ch ?Α) (<= ch ?Ω))) | |
722 (string-match | 725 (string-match |
723 (cond | 726 (cond |
724 ((and (memq calc-language calc-lang-allow-underscores) | 727 ((and (memq calc-language calc-lang-allow-underscores) |
725 (memq calc-language calc-lang-allow-percentsigns)) | 728 (memq calc-language calc-lang-allow-percentsigns)) |
726 "[a-zA-Z0-9_'#]*") | 729 "[a-zA-Zα-ωΑ-Ω0-9_'#]*") |
727 ((memq calc-language calc-lang-allow-underscores) | 730 ((memq calc-language calc-lang-allow-underscores) |
728 "[a-zA-Z0-9_#]*") | 731 "[a-zA-Zα-ωΑ-Ω0-9_#]*") |
729 (t "[a-zA-Z0-9'#]*")) | 732 (t "[a-zA-Zα-ωΑ-Ω0-9'#]*")) |
730 math-exp-str math-exp-pos) | 733 math-exp-str math-exp-pos) |
731 (setq math-exp-token 'symbol | 734 (setq math-exp-token 'symbol |
732 math-exp-pos (match-end 0) | 735 math-exp-pos (match-end 0) |
733 math-expr-data (math-restore-dashes | 736 math-expr-data (math-restore-dashes |
734 (math-match-substring math-exp-str 0))) | 737 (math-match-substring math-exp-str 0))) |
742 (eq (string-match "_\\.?[0-9]" math-exp-str math-exp-pos) | 745 (eq (string-match "_\\.?[0-9]" math-exp-str math-exp-pos) |
743 math-exp-pos) | 746 math-exp-pos) |
744 (or (eq math-exp-pos 0) | 747 (or (eq math-exp-pos 0) |
745 (and (not (memq calc-language | 748 (and (not (memq calc-language |
746 calc-lang-allow-underscores)) | 749 calc-lang-allow-underscores)) |
747 (eq (string-match "[^])}\"a-zA-Z0-9'$]_" | 750 (eq (string-match "[^])}\"a-zA-Zα-ωΑ-Ω0-9'$]_" |
748 math-exp-str (1- math-exp-pos)) | 751 math-exp-str (1- math-exp-pos)) |
749 (1- math-exp-pos)))))) | 752 (1- math-exp-pos)))))) |
750 (or (and (memq calc-language calc-lang-c-type-hex) | 753 (or (and (memq calc-language calc-lang-c-type-hex) |
751 (string-match "0[xX][0-9a-fA-F]+" math-exp-str math-exp-pos)) | 754 (string-match "0[xX][0-9a-fA-F]+" math-exp-str math-exp-pos)) |
752 (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]+\\)?\"?\\)?" | 755 (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]+\\)?\"?\\)?" |
753 math-exp-str math-exp-pos)) | 756 math-exp-str math-exp-pos)) |
754 (setq math-exp-token 'number | 757 (setq math-exp-token 'number |
755 math-expr-data (math-match-substring math-exp-str 0) | 758 math-expr-data (math-match-substring math-exp-str 0) |
756 math-exp-pos (match-end 0))) | 759 math-exp-pos (match-end 0))) |
757 ((and (setq adfn | 760 ((and (setq adfn |