/usr/share/racket/collects/compiler/module-suffix.rkt is in racket-common 6.3-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 | #lang racket/base
(require racket/list
racket/string
setup/getinfo
racket/contract/base)
(provide
(contract-out
[get-module-suffixes (()
(#:mode (or/c 'preferred 'all-available 'no-planet 'no-user)
#:group (or/c 'all 'libs 'docs)
#:namespace (or/c #f namespace?))
. ->* .
(listof bytes?))]
[get-module-suffix-regexp (()
(#:mode (or/c 'preferred 'all-available 'no-planet 'no-user)
#:group (or/c 'all 'libs 'docs)
#:namespace (or/c #f namespace?))
. ->* .
byte-regexp?)]))
(define (get-module-suffixes #:mode [key 'preferred]
#:group [group 'all]
#:namespace [namespace #f])
(define fields (case group
[(all) '(module-suffixes doc-module-suffixes)]
[(libs) '(module-suffixes)]
[(docs) '(doc-module-suffixes)]))
(define dirs (find-relevant-directories fields key))
(define rkt-ht (if (memq 'module-suffixes fields)
(hash #"rkt" #t #"ss" #t #"scm" #t)
(hash)))
(define init-ht (if (memq 'doc-module-suffixes fields)
(hash-set rkt-ht #"scrbl" #t)
rkt-ht))
(define ht
(for/fold ([ht init-ht]) ([dir (in-list dirs)])
(define info (get-info/full dir #:namespace namespace))
(for/fold ([ht init-ht]) ([field (in-list fields)])
(define suffixes (info field (lambda () null)))
(cond
[(list? suffixes)
(for/fold ([ht ht]) ([suffix (in-list suffixes)])
(cond
[(bytes? suffix) (hash-set ht suffix #t)]
[else ht]))]))))
(sort (hash-keys ht) bytes<?))
(define (get-module-suffix-regexp #:mode [key 'preferred]
#:group [group 'all]
#:namespace [namespace #f])
(define suffixes
(get-module-suffixes #:mode key #:group group #:namespace namespace))
(byte-pregexp
(bytes-append #"^(.*)\\.(?i:"
(apply bytes-append
(add-between suffixes #"|"))
#")$")))
|