Advertising
- Stuff
- Sunday, July 29th, 2012 at 3:06:53pm MDT
- (defpackage :net.etenil.lisp)
- (in-package :net.etenil.lisp)
- ;;; A few global variables for scoping and defaults.
- (defvar *readtable*)
- ;;; Utility functions for the reader.
- (defun whitespacep (char &optional (rt *readtable*))
- (test-attribute char +char-attr-whitespace+ rt))
- ;;; The main functions.
- (defun read-preserving-whitespace (&optional (stream *standard-input*)
- (eof-error-p t)
- (eof-value nil)
- (recursive-p nil))
- "Reads from STREAM and returns the value read while preserving
- the whitespace that followed the object."
- (if recursive-p
- (loop
- (let ((char (read-char stream eof-error-p *eof-object*)))
- (cond ((eofp char) (return eof-value))
- ((whitespacep char))
- (t
- (let* ((macrofun (get-coerced-cmt-entry char *readtable*))
- (result (multiple-value-list
- (funcall macrofun stream char)))))))))
- (let ((*sharp-equal-alist* nil))
- (with-read-buffer ()
- (read-preserving-whitespace stream eof-error-p eof-value t)))))
- (defun read (&optional (stream *standard-input*)
- (eof-error-p t)
- (eof-value nil)
- (recursive-p nil))
- "Reads the next token from stream."
- (let ((result (read-preserving-whitespace stream eof-error-p eof-value recursive-p)))
- )
- nil)
advertising
Update the Post
Either update this post and resubmit it with changes, or make a new post.
You may also comment on this post.
Please note that information posted here will expire by default in one month. If you do not want it to expire, please set the expiry time above. If it is set to expire, web search engines will not be allowed to index it prior to it expiring. Items that are not marked to expire will be indexable by search engines. Be careful with your passwords. All illegal activities will be reported and any information will be handed over to the authorities, so be good.