1
Fork 0
mirror of https://git.savannah.gnu.org/git/guile.git synced 2025-05-21 12:10:26 +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))))) (take-until first (lambda (ch) (not (pred ch)))))
(define (delimiter? ch) (define (delimiter? ch)
(or (memv ch '(#\( #\) #\; #\" (case ch
#\space #\return #\ff #\newline #\tab)) ((#\( #\) #\; #\" #\space #\return #\ff #\newline #\tab) #t)
(and (memv ch '(#\[ #\])) (or (square-brackets?) (curly-infix?))) ((#\[ #\]) (or (square-brackets?) (curly-infix?)))
(and (memv ch '(#\{ #\})) (curly-infix?)))) ((#\{ #\}) (curly-infix?))
(else #f)))
(define (read-token ch) (define (read-token ch)
(take-until ch delimiter?)) (take-until ch delimiter?))