Part of Slepp's ProjectsPastebinTURLImagebinFilebin
Feedback -- English French German Japanese
Create Upload Newest Tools Donate
Sign In | Create Account

Advertising

Stuff
Sunday, July 29th, 2012 at 3:06:53pm MDT 

  1. (defpackage :net.etenil.lisp)
  2.  
  3. (in-package :net.etenil.lisp)
  4.  
  5. ;;; A few global variables for scoping and defaults.
  6. (defvar *readtable*)
  7.  
  8. ;;; Utility functions for the reader.
  9. (defun whitespacep (char &optional (rt *readtable*))
  10.   (test-attribute char +char-attr-whitespace+ rt))
  11.  
  12.  
  13. ;;; The main functions.
  14. (defun read-preserving-whitespace (&optional (stream *standard-input*)
  15.                                                                    (eof-error-p t)
  16.                                                                    (eof-value nil)
  17.                                                                    (recursive-p nil))
  18.   "Reads from STREAM and returns the value read while preserving
  19. the whitespace that followed the object."
  20.   (if recursive-p
  21.           (loop
  22.                  (let ((char (read-char stream eof-error-p *eof-object*)))
  23.                    (cond ((eofp char) (return eof-value))
  24.                                  ((whitespacep char))
  25.                                  (t
  26.                                   (let* ((macrofun (get-coerced-cmt-entry char *readtable*))
  27.                                                  (result (multiple-value-list
  28.                                                                   (funcall macrofun stream char)))))))))
  29.           (let ((*sharp-equal-alist* nil))
  30.                 (with-read-buffer ()
  31.                   (read-preserving-whitespace stream eof-error-p eof-value t)))))
  32.  
  33. (defun read (&optional (stream *standard-input*)
  34.                          (eof-error-p t)
  35.                          (eof-value nil)
  36.                          (recursive-p nil))
  37.   "Reads the next token from stream."
  38.   (let ((result (read-preserving-whitespace stream eof-error-p eof-value recursive-p)))
  39.         )
  40.   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.

update paste below
details of the post (optional)

Note: Only the paste content is required, though the following information can be useful to others.

Save name / title?

(space separated, optional)



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.

worth-right