PageRenderTime 13ms CodeModel.GetById 10ms app.highlight 0ms RepoModel.GetById 2ms app.codeStats 0ms

/lib/skipwhite.arc

http://github.com/alimoeeny/arc
Unknown | 25 lines | 24 code | 1 blank | 0 comment | 0 complexity | bb8097cda62b2ac3beaec3bd6227323d MD5 | raw file
 1; place in own library to abide by the LGPL
 2;
 3; skip-whitespace is copied from
 4; http://download.plt-scheme.org/doc/352/html/mzscheme/mzscheme-Z-H-11.html#node_sec_11.2.8
 5; which has the following licence:
 6;
 7; Copyright Š1995-2006 Matthew Flatt
 8;
 9; 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.
10;
11; [ ] in source changed to ( ) to avoid conflict with brackets.scm
12
13($:define (skip-whitespace port)
14  ;; Skips whitespace characters, sensitive to the current
15  ;; readtable's definition of whitespace
16  (let ((ch (peek-char port)))
17    (unless (eof-object? ch)
18      ;; Consult current readtable:
19      (let-values (((like-ch/sym proc dispatch-proc)
20                    (readtable-mapping (current-readtable) ch)))
21        ;; If like-ch/sym is whitespace, then ch is whitespace
22        (when (and (char? like-ch/sym)
23                   (char-whitespace? like-ch/sym))
24          (read-char port)
25          (skip-whitespace port))))))