X-Git-Url: https://git.distorted.org.uk/~mdw/lisp/blobdiff_plain/d7d819976cb5d84766bffd2c5272c86203687ee9..53ccd04251004c520ab714e8ffc5b80f40536459:/infix.lisp diff --git a/infix.lisp b/infix.lisp index 64a0a30..ff5a3c9 100644 --- a/infix.lisp +++ b/infix.lisp @@ -94,8 +94,12 @@ ;;;-------------------------------------------------------------------------- ;;; The tokenizer. -(defconstant eof (cons :eof nil) - "A magical object which `get-token' returns at end-of-file.") +(eval-when (:compile-toplevel :load-toplevel :execute) + (let ((value (cons :eof nil))) + (unless (and (boundp 'eof) + (equal (symbol-value 'eof) value)) + (defconstant eof (cons :eof nil) + "A magical object which `get-token' returns at end-of-file.")))) (defun default-get-token () "Read a token from *stream* and store it in *token*." @@ -279,7 +283,7 @@ the value stack." `(progn (setf (get ',op ',kind) - (lambda () ,@body)) + (lambda () ,@body)) ',op)) (defmacro definfix (op prec &body body) @@ -423,7 +427,7 @@ (let ((stuff nil)) (loop (unless (symbolp *token*) - (error "expected symbol; found ~S" *token*)) + (error "expected symbol; found ~S" *token*)) (push *token* stuff) (get-token) (unless (delim '|,| nil) @@ -817,8 +821,8 @@ (defun foo (x) (- x 6))) ("bind x = 3 in x - 2" . (let ((x 3)) (- x 2))) ("bind x, y = values(1, 2), - z = 3, - docs, decls, body = parse-body(body) in complicated" . + z = 3, + docs, decls, body = parse-body(body) in complicated" . (multiple-value-bind (x y) (values 1 2) (let ((z 3)) (multiple-value-bind (docs decls body) (parse-body body)