/lib/skipwhite.arc
http://github.com/alimoeeny/arc · Unknown · 25 lines · 24 code · 1 blank · 0 comment · 0 complexity · bb8097cda62b2ac3beaec3bd6227323d MD5 · raw file
- ; place in own library to abide by the LGPL
- ;
- ; skip-whitespace is copied from
- ; http://download.plt-scheme.org/doc/352/html/mzscheme/mzscheme-Z-H-11.html#node_sec_11.2.8
- ; which has the following licence:
- ;
- ; Copyright Š1995-2006 Matthew Flatt
- ;
- ; Permission is granted to copy, distribute and/or modify this document under the terms of the GNU Library General Public License, Version 2 published by the Free Software Foundation.
- ;
- ; [ ] in source changed to ( ) to avoid conflict with brackets.scm
- ($:define (skip-whitespace port)
- ;; Skips whitespace characters, sensitive to the current
- ;; readtable's definition of whitespace
- (let ((ch (peek-char port)))
- (unless (eof-object? ch)
- ;; Consult current readtable:
- (let-values (((like-ch/sym proc dispatch-proc)
- (readtable-mapping (current-readtable) ch)))
- ;; If like-ch/sym is whitespace, then ch is whitespace
- (when (and (char? like-ch/sym)
- (char-whitespace? like-ch/sym))
- (read-char port)
- (skip-whitespace port))))))