1
Fork 0
mirror of https://git.savannah.gnu.org/git/guile.git synced 2025-05-20 11:40:18 +02:00

Micro-optimization to delimiter?

* module/ice-9/read.scm (read): Make sure we hit the "case"
  optimization.
This commit is contained in:
Andy Wingo 2021-02-17 12:04:18 +01:00
parent b6df67fe06
commit 5cd28ae0ac

View file

@ -182,10 +182,11 @@
(take-until first (lambda (ch) (not (pred ch)))))
(define (delimiter? ch)
(or (memv ch '(#\( #\) #\; #\"
#\space #\return #\ff #\newline #\tab))
(and (memv ch '(#\[ #\])) (or (square-brackets?) (curly-infix?)))
(and (memv ch '(#\{ #\})) (curly-infix?))))
(case ch
((#\( #\) #\; #\" #\space #\return #\ff #\newline #\tab) #t)
((#\[ #\]) (or (square-brackets?) (curly-infix?)))
((#\{ #\}) (curly-infix?))
(else #f)))
(define (read-token ch)
(take-until ch delimiter?))