From: Volker v. N. <va...@us...> - 2007-05-29 08:46:12
|
Update of /cvsroot/maxima/maxima/share/contrib/stringproc In directory sc8-pr-cvs16.sourceforge.net:/tmp/cvs-serv2604/share/contrib/stringproc Modified Files: stringproc.lisp Log Message: $parsetoken now parses bigfloats Index: stringproc.lisp =================================================================== RCS file: /cvsroot/maxima/maxima/share/contrib/stringproc/stringproc.lisp,v retrieving revision 1.18 retrieving revision 1.19 diff -u -d -r1.18 -r1.19 --- stringproc.lisp 25 May 2007 22:09:20 -0000 1.18 +++ stringproc.lisp 29 May 2007 08:46:07 -0000 1.19 @@ -291,18 +291,24 @@ (defun $parsetoken (mstr) (if (not (mstringp mstr)) (merror "parsetoken needs a string argument: ~M" mstr)) (let ((res (with-input-from-string - (lstr (l-string mstr)) - (handler-case (read lstr) - (error nil nil))))) ; ignore errors + (lstr (l-string mstr)) + (handler-case (read lstr) + (error nil nil)))) ; ignore errors + bf) (cond ((or (integerp res) - (floatp res)) - ;; Maxima does not accept complex numbers, etc. - ;; parsetoken will still accept Lisp syntax, e.g. #C(2 `,0), 2.1s1 - ;; but we're not fixing that for now - res) - ((rationalp res) - (list '(rat simp) (numerator res) (denominator res))) - (t nil)))) + (floatp res)) + ;; Maxima does not accept complex numbers, etc. + ;; parsetoken will still accept Lisp syntax, e.g. #C(2 `,0), 2.1s1 + ;; but we're not fixing that for now + res) + ((rationalp res) + (list '(rat simp) (numerator res) (denominator res))) + ((and (symbolp res) + (setf bf (maxima-nregex::regex "[0-9]*\\.*[0-9]*[b,B]+[+,-]*[0-9]+" (string res))) ) + (with-input-from-string + (s (concatenate 'string (car bf) "$")) + (third (mread s)) )) + (t nil) ))) ;; $sconcat for lists, allows an optional user defined separator string ;; returns maxima-string |