adding support for #![no-]fold-case in srfi.38 and chibi.repl

This commit is contained in:
Alex Shinn 2011-10-30 16:35:16 +09:00
parent 769ef4725d
commit 3f8ac7106f
2 changed files with 18 additions and 2 deletions

View file

@ -162,7 +162,12 @@
(guard
(exn
(else (print-exception exn (current-error-port))))
(let* ((expr (call-with-input-string line read/ss))
(let* ((expr (call-with-input-string line
(lambda (in2)
(set-port-fold-case! in2 (port-fold-case? in))
(let ((expr (read/ss in2)))
(set-port-fold-case! in (port-fold-case? in2))
expr))))
(thread
(make-thread
(lambda ()

View file

@ -180,7 +180,18 @@
(read-one))
((#\|)
(skip-comment in 0))
((#\!) (skip-line in) (read-one in))
((#\!)
(let ((name (read-name #f in)))
(cond
((string-ci=? name "!fold-case")
(set-port-fold-case! in #t))
((string-ci=? name "!no-fold-case")
(set-port-fold-case! in #f))
(else ;; assume a #!/bin/bash line
(skip-line in)))
(let ((res (read-one)))
(if (not (eof-object? res))
res))))
((#\() (list->vector (read-one)))
((#\') (read-char in) (list 'syntax (read-one)))
((#\`) (read-char in) (list 'quasisyntax (read-one)))