From: Pascal J.B. <pj...@in...> - 2004-08-06 10:32:01
|
With SBCL 0.8.7, while compiling a file containing the following function: (DEFUN PARSE-ADDRESS (COMMAND POSITION) ;;address --> '.' | '$' | number ;; | '-' | '^' | '-' number | '^' number ;; | '+' | '+' number | space number ;; | '/' re '/' | '?' re '?' | '//' | '??' ;; | "'" lc . (declare (integer position)) (LET ((ADDRESS NIL) (CH)) (FLET ((PARSE-OPTIONAL-NUMBER () (SETQ POSITION (SKIP-SPACES COMMAND (1+ POSITION))) (WHEN (AND POSITION (SETQ CH (CHAR COMMAND POSITION)) (DIGIT-CHAR-P CH)) (MULTIPLE-VALUE-BIND (VALUE POS) (PARSE-INTEGER COMMAND :START POSITION :JUNK-ALLOWED T) (WHEN VALUE (SETQ ADDRESS (CONS ADDRESS VALUE))) (SETQ POSITION POS))))) (SETQ POSITION (SKIP-SPACES COMMAND POSITION)) (WHEN POSITION (SETQ CH (CHAR COMMAND POSITION)) (COND ((CHAR= CH (CHARACTER ".")) (SETQ ADDRESS :CURR) (INCF POSITION)) ((CHAR= CH (CHARACTER "$")) (SETQ ADDRESS :LAST) (INCF POSITION)) ((DIGIT-CHAR-P CH) (MULTIPLE-VALUE-BIND (VALUE POS) (PARSE-INTEGER COMMAND :START POSITION :JUNK-ALLOWED T) (WHEN VALUE (SETQ ADDRESS (CONS :LINUM VALUE))) (SETQ POSITION POS))) ((OR (CHAR= CH (CHARACTER "^")) (CHAR= CH (CHARACTER "-"))) (SETQ ADDRESS :PREV) (PARSE-OPTIONAL-NUMBER)) ((OR (CHAR= CH (CHARACTER " ")) (CHAR= CH (CHARACTER "+"))) (SETQ ADDRESS :NEXT) (PARSE-OPTIONAL-NUMBER)) ((OR (CHAR= CH (CHARACTER "/")) (CHAR= CH (CHARACTER "?"))) ;; TODO: regexp ;; eat regexp: (SETQ ADDRESS (CONS :REGEXP (DO ((TERMINATOR CH) (END POSITION (1+ END))) ((OR (>= END (LENGTH COMMAND) (CHAR= TERMINATOR (CHAR COMMAND END)))) (declare (integer end)) (PROG1 (SUBSEQ COMMAND POSITION (1+ END)) (SETQ POSITION (1+ END)))))))) ((CHAR= CH (CHARACTER "'")) (INCF POSITION) ;; TODO: when there is an error here it's: "Invalid mark character" ;; TODO: not: "Invalid address" ! (WHEN (< POSITION (LENGTH COMMAND)) (SETQ ADDRESS (CONS :MARK (CHAR COMMAND POSITION))) (INCF POSITION))) ))) (VALUES ADDRESS POSITION)) I get this error: ; compiling DEFUN PARSE-ADDRESS: ; file: /local/users/pascal/src/common/common-lisp/ed.lisp ; in: DEFUN PARSE-ADDRESS ; (>= COM.INFORMATIMAGO.COMMON-LISP.ED::END ; (LENGTH COM.INFORMATIMAGO.COMMON-LISP.ED::COMMAND) ; (CHAR= COM.INFORMATIMAGO.COMMON-LISP.ED::TERMINATOR ; (CHAR COM.INFORMATIMAGO.COMMON-LISP.ED::COMMAND ; COM.INFORMATIMAGO.COMMON-LISP.ED::END))) ; ==> ; ((LAMBDA (#:G1208 #:G1207 #:G1206) ; (DECLARE (TYPE REAL #:G1208 #:G1207 #:G1206)) ; (IF (< #:G1208 #:G1207) NIL (IF # NIL T))) ; COM.INFORMATIMAGO.COMMON-LISP.ED::END ; (LENGTH COM.INFORMATIMAGO.COMMON-LISP.ED::COMMAND) ; (CHAR= COM.INFORMATIMAGO.COMMON-LISP.ED::TERMINATOR ; (CHAR COM.INFORMATIMAGO.COMMON-LISP.ED::COMMAND ; COM.INFORMATIMAGO.COMMON-LISP.ED::END))) ; ; caught WARNING: ; Asserted type REAL conflicts with derived type ; (VALUES (MEMBER T NIL) &OPTIONAL). What is the problem exactly? I don't handle any floating-point value in this program. -- __Pascal Bourguignon__ http://www.informatimago.com/ Nobody can fix the economy. Nobody can be trusted with their finger on the button. Nobody's perfect. VOTE FOR NOBODY. |