From aed7db1ac8bb250c65eab3db1a066051dafa3e1f Mon Sep 17 00:00:00 2001 From: "resyntax-ci[bot]" <181813515+resyntax-ci[bot]@users.noreply.github.com> Date: Wed, 4 Dec 2024 00:32:30 +0000 Subject: [PATCH 1/5] Fix 5 occurrences of `tidy-require` Keep imports in `require` sorted and grouped by phase, with collections before files. --- scribble-doc/scribblings/scribble/class-diagrams.rkt | 10 +++++----- scribble-doc/scribblings/scribble/struct-hierarchy.rkt | 10 +++++----- scribble-doc/scribblings/scribble/utils.rkt | 4 +++- scribble-test/tests/scriblib/autobib.rkt | 5 ++++- scribble-test/tests/scriblib/bibtex.rkt | 6 +++--- 5 files changed, 20 insertions(+), 15 deletions(-) diff --git a/scribble-doc/scribblings/scribble/class-diagrams.rkt b/scribble-doc/scribblings/scribble/class-diagrams.rkt index 5f13dff7e6..26292e1dbb 100644 --- a/scribble-doc/scribblings/scribble/class-diagrams.rkt +++ b/scribble-doc/scribblings/scribble/class-diagrams.rkt @@ -1,12 +1,12 @@ #lang racket/base -(require (prefix-in etc: mzlib/etc) +(require racket/class + racket/contract + racket/draw + racket/runtime-path texpict/mrpict + (prefix-in etc: mzlib/etc) (only-in pict pin-line pin-arrow-line) (except-in texpict/utils pin-line pin-arrow-line) - racket/class - racket/runtime-path - racket/draw - racket/contract (only-in racket/list last)) (define the-font-size 12) diff --git a/scribble-doc/scribblings/scribble/struct-hierarchy.rkt b/scribble-doc/scribblings/scribble/struct-hierarchy.rkt index b70dd3f5bd..6103e0763d 100644 --- a/scribble-doc/scribblings/scribble/struct-hierarchy.rkt +++ b/scribble-doc/scribblings/scribble/struct-hierarchy.rkt @@ -1,12 +1,12 @@ #lang racket/base -(require "class-diagrams.rkt" - (only-in pict pin-arrow-line) +(require racket/class + racket/draw + racket/system texpict/mrpict + (only-in pict pin-arrow-line) (except-in texpict/utils pin-arrow-line) - racket/system - racket/class - racket/draw) + "class-diagrams.rkt") (define (mk-ps-diagram) ;; thicken up the lines for postscript diff --git a/scribble-doc/scribblings/scribble/utils.rkt b/scribble-doc/scribblings/scribble/utils.rkt index 417c6e433a..691ece3178 100644 --- a/scribble-doc/scribblings/scribble/utils.rkt +++ b/scribble-doc/scribblings/scribble/utils.rkt @@ -102,7 +102,9 @@ ;; stuff for the scribble/text examples -(require racket/list (for-syntax racket/base racket/list)) +(require (for-syntax racket/base + racket/list) + racket/list) (define max-textsample-width 45) diff --git a/scribble-test/tests/scriblib/autobib.rkt b/scribble-test/tests/scriblib/autobib.rkt index 560bc0515f..000afd2126 100644 --- a/scribble-test/tests/scriblib/autobib.rkt +++ b/scribble-test/tests/scriblib/autobib.rkt @@ -1,6 +1,9 @@ #lang racket/base -(require rackunit scriblib/autobib scribble/base scribble/core) +(require rackunit + scribble/base + scribble/core + scriblib/autobib) (test-case "define-cite" ;; Check that `define-cite` binds the expected identifiers diff --git a/scribble-test/tests/scriblib/bibtex.rkt b/scribble-test/tests/scriblib/bibtex.rkt index 04cc5ee1e7..ec2674c28f 100644 --- a/scribble-test/tests/scriblib/bibtex.rkt +++ b/scribble-test/tests/scriblib/bibtex.rkt @@ -1,9 +1,9 @@ #lang racket (require racket/runtime-path - tests/eli-tester - scriblib/bibtex - scriblib/autobib scribble/render + scriblib/autobib + scriblib/bibtex + tests/eli-tester (prefix-in text: scribble/text-render)) (define-runtime-path example.bib "example.bib") From 5d5dac7e919614f7b3aec2292ed2f5010e075e01 Mon Sep 17 00:00:00 2001 From: "resyntax-ci[bot]" <181813515+resyntax-ci[bot]@users.noreply.github.com> Date: Wed, 4 Dec 2024 00:32:30 +0000 Subject: [PATCH 2/5] Fix 1 occurrence of `if-let-to-cond` `cond` with internal definitions is preferred over `if` with `let`, to reduce nesting --- scribble-doc/scribblings/scribble/utils.rkt | 30 ++++++++++----------- 1 file changed, 14 insertions(+), 16 deletions(-) diff --git a/scribble-doc/scribblings/scribble/utils.rkt b/scribble-doc/scribblings/scribble/utils.rkt index 691ece3178..742937b087 100644 --- a/scribble-doc/scribblings/scribble/utils.rkt +++ b/scribble-doc/scribblings/scribble/utils.rkt @@ -49,22 +49,20 @@ [pos base] [second #f] [accum null]) - (if (null? e) - (datum->syntax - p (reverse accum) - (list (syntax-source p) (syntax-line p) base (add1 base) - (- pos base)) - p) - (let* ([v ((norm-spacing (if (= line (syntax-line (car e))) - pos - (or second pos))) - (car e))] - [next-pos (+ (syntax-column v) (syntax-span v) 1)]) - (loop (cdr e) - (syntax-line v) - next-pos - (or second next-pos) - (cons v accum)))))] + (cond + [(null? e) + (datum->syntax p + (reverse accum) + (list (syntax-source p) (syntax-line p) base (add1 base) (- pos base)) + p)] + [else + (define v + ((norm-spacing (if (= line (syntax-line (car e))) + pos + (or second pos))) + (car e))) + (define next-pos (+ (syntax-column v) (syntax-span v) 1)) + (loop (cdr e) (syntax-line v) next-pos (or second next-pos) (cons v accum))]))] [else (datum->syntax p (syntax-e p) (list (syntax-source p) (syntax-line p) base (add1 base) 1) From 5beca04c492ced800d1ee15c1d87173d52710f3e Mon Sep 17 00:00:00 2001 From: "resyntax-ci[bot]" <181813515+resyntax-ci[bot]@users.noreply.github.com> Date: Wed, 4 Dec 2024 00:32:30 +0000 Subject: [PATCH 3/5] Fix 12 occurrences of `let-to-define` Internal definitions are recommended instead of `let` expressions, to reduce nesting. --- .../scribblings/scribble/class-diagrams.rkt | 224 +++++++++--------- .../scribblings/scribble/struct-hierarchy.rkt | 72 +++--- scribble-doc/scribblings/scribble/utils.rkt | 43 ++-- 3 files changed, 162 insertions(+), 177 deletions(-) diff --git a/scribble-doc/scribblings/scribble/class-diagrams.rkt b/scribble-doc/scribblings/scribble/class-diagrams.rkt index 26292e1dbb..3d5e3b248c 100644 --- a/scribble-doc/scribblings/scribble/class-diagrams.rkt +++ b/scribble-doc/scribblings/scribble/class-diagrams.rkt @@ -70,41 +70,32 @@ (unless (even? (length args)) (error 'method-spec "expected a list of types and argument names, but found ~a arguments" (length args))) - (let ([first-line - (hbl-append - (type-spec range) - (normal-font " ") - (var-font name) - (cond - [(null? args) - (normal-font "()")] - [else - (hbl-append - (normal-font "(") - (let loop ([args args]) - (let* ([type (car args)] - [param (cadr args)] - [single-arg - (if param - (hbl-append (type-spec type) - (normal-font " ") - (var-font param)) - (type-spec type))]) - - (cond - [(null? (cddr args)) - (hbl-append single-arg (normal-font ")"))] - [else - (hbl-append single-arg - (normal-font ", ") - (loop (cddr args)))]))))]) - (if body - (hbl-append (normal-font " {")) - (blank)))]) - (if body - (vl-append first-line - (hbl-append (blank 8 0) body (normal-font "}"))) - first-line))) + (define first-line + (hbl-append + (type-spec range) + (normal-font " ") + (var-font name) + (cond + [(null? args) (normal-font "()")] + [else + (hbl-append + (normal-font "(") + (let loop ([args args]) + (let* ([type (car args)] + [param (cadr args)] + [single-arg (if param + (hbl-append (type-spec type) (normal-font " ") (var-font param)) + (type-spec type))]) + + (cond + [(null? (cddr args)) (hbl-append single-arg (normal-font ")"))] + [else (hbl-append single-arg (normal-font ", ") (loop (cddr args)))]))))]) + (if body + (hbl-append (normal-font " {")) + (blank)))) + (if body + (vl-append first-line (hbl-append (blank 8 0) body (normal-font "}"))) + first-line)) (define (type-spec str) (cond @@ -126,83 +117,86 @@ ;; class-box : pict (or/c #f (listof pict)) (or/c #f (listof pict)) -> pict (define (class-box name fields methods) - (let* ([mk-blank (λ () (blank 0 (+ class-box-margin class-box-margin)))]) - (cond - [(and methods fields) - (let* ([top-spacer (mk-blank)] - [bottom-spacer (mk-blank)] - [main (vl-append name - top-spacer - (if (null? fields) - (blank 0 4) - (apply vl-append fields)) - bottom-spacer - (if (null? methods) - (blank 0 4) - (apply vl-append methods)))]) - (add-hline - (add-hline (frame (inset main class-box-margin)) - top-spacer) - bottom-spacer))] - [fields - (let* ([top-spacer (mk-blank)] - [main (vl-append name - top-spacer - (if (null? fields) - (blank) - (apply vl-append fields)))]) - (add-hline (frame (inset main class-box-margin)) - top-spacer))] - [methods (class-box name methods fields)] - [else (frame (inset name class-box-margin))]))) + (define (mk-blank) + (blank 0 (+ class-box-margin class-box-margin))) + (cond + [(and methods fields) + (let* ([top-spacer (mk-blank)] + [bottom-spacer (mk-blank)] + [main (vl-append name + top-spacer + (if (null? fields) + (blank 0 4) + (apply vl-append fields)) + bottom-spacer + (if (null? methods) + (blank 0 4) + (apply vl-append methods)))]) + (add-hline (add-hline (frame (inset main class-box-margin)) top-spacer) bottom-spacer))] + [fields + (let* ([top-spacer (mk-blank)] + [main (vl-append name + top-spacer + (if (null? fields) + (blank) + (apply vl-append fields)))]) + (add-hline (frame (inset main class-box-margin)) top-spacer))] + [methods (class-box name methods fields)] + [else (frame (inset name class-box-margin))])) (define (add-hline main sub) - (let-values ([(x y) (cc-find main sub)]) - (pin-line main - sub (λ (p1 p2) (values 0 y)) - sub (λ (p1 p2) (values (pict-width main) y))))) + (define-values (x y) (cc-find main sub)) + (pin-line main sub (λ (p1 p2) (values 0 y)) sub (λ (p1 p2) (values (pict-width main) y)))) ;; hierarchy : pict (cons pict (listof pict)) (cons pict (listof pict)) -> pict (define (hierarchy main supers subs) - (let ([supers-bottoms (apply max (map (λ (x) (let-values ([(x y) (cb-find main x)]) y)) supers))] - [subs-tops (apply min (map (λ (x) (let-values ([(x y) (ct-find main x)]) y)) subs))] - [sorted-subs (sort subs (λ (x y) (< (left-edge-x main x) (left-edge-x main y))))]) - (unless (< supers-bottoms subs-tops) - (error 'hierarchy "expected supers to be on top of subs, supers bottom is at ~a, and subs tops is at ~a" - supers-bottoms - subs-tops)) - (let* ([main-line-y (max (- subs-tops 20) (/ (+ supers-bottoms subs-tops) 2))] - [main-line-start-x (center-x main (car sorted-subs))] - [main-line-end-x (center-x main (last sorted-subs))] - [w/main-line - (pin-line main - main (λ (_1 _2) (values main-line-start-x main-line-y)) - main (λ (_1 _2) (values main-line-end-x main-line-y)) - #:color hierarchy-color)] - [super-lines - (map (λ (super) - (let-values ([(x y) (cb-find main super)]) - (pin-over - (pin-line (ghost main) - super cb-find - main (λ (_1 _2) (values x main-line-y))) - (- x (/ (pict-width triangle) 2)) - (- (/ (+ y main-line-y) 2) - (/ (pict-height triangle) 2)) - triangle))) - supers)] - [sub-lines - (map (λ (sub) - (let-values ([(x y) (ct-find main sub)]) - (pin-line (ghost main) - sub ct-find - main (λ (_1 _2) (values x main-line-y)) - #:color hierarchy-color))) - subs)]) - (apply cc-superimpose - w/main-line - (append sub-lines - super-lines))))) + (define supers-bottoms + (apply max + (map (λ (x) + (let-values ([(x y) (cb-find main x)]) + y)) + supers))) + (define subs-tops + (apply min + (map (λ (x) + (let-values ([(x y) (ct-find main x)]) + y)) + subs))) + (define sorted-subs (sort subs (λ (x y) (< (left-edge-x main x) (left-edge-x main y))))) + (unless (< supers-bottoms subs-tops) + (error 'hierarchy + "expected supers to be on top of subs, supers bottom is at ~a, and subs tops is at ~a" + supers-bottoms + subs-tops)) + (define main-line-y (max (- subs-tops 20) (/ (+ supers-bottoms subs-tops) 2))) + (define main-line-start-x (center-x main (car sorted-subs))) + (define main-line-end-x (center-x main (last sorted-subs))) + (define w/main-line + (pin-line main + main + (λ (_1 _2) (values main-line-start-x main-line-y)) + main + (λ (_1 _2) (values main-line-end-x main-line-y)) + #:color hierarchy-color)) + (define super-lines + (map (λ (super) + (let-values ([(x y) (cb-find main super)]) + (pin-over (pin-line (ghost main) super cb-find main (λ (_1 _2) (values x main-line-y))) + (- x (/ (pict-width triangle) 2)) + (- (/ (+ y main-line-y) 2) (/ (pict-height triangle) 2)) + triangle))) + supers)) + (define sub-lines + (map (λ (sub) + (let-values ([(x y) (ct-find main sub)]) + (pin-line (ghost main) + sub + ct-find + main + (λ (_1 _2) (values x main-line-y)) + #:color hierarchy-color))) + subs)) + (apply cc-superimpose w/main-line (append sub-lines super-lines))) (define triangle-width 12) (define triangle-height 12) @@ -212,21 +206,21 @@ (make-object point% triangle-width triangle-height))]) (colorize (dc (λ (dc dx dy) - (let ([brush (send dc get-brush)]) - (send dc set-brush (send brush get-color) 'solid) - (send dc draw-polygon points dx dy) - (send dc set-brush brush))) + (define brush (send dc get-brush)) + (send dc set-brush (send brush get-color) 'solid) + (send dc draw-polygon points dx dy) + (send dc set-brush brush)) triangle-width triangle-height) hierarchy-color))) (define (center-x main pict) - (let-values ([(x y) (cc-find main pict)]) - x)) + (define-values (x y) (cc-find main pict)) + x) (define (left-edge-x main pict) - (let-values ([(x y) (lc-find main pict)]) - x)) + (define-values (x y) (lc-find main pict)) + x) (define (add-dot-right main class field) (add-dot-left-right/offset main class field 0 rc-find)) diff --git a/scribble-doc/scribblings/scribble/struct-hierarchy.rkt b/scribble-doc/scribblings/scribble/struct-hierarchy.rkt index 6103e0763d..94e087ec7a 100644 --- a/scribble-doc/scribblings/scribble/struct-hierarchy.rkt +++ b/scribble-doc/scribblings/scribble/struct-hierarchy.rkt @@ -315,20 +315,15 @@ (inset (panorama w/delayed-connections) 0 0 1 0)) (define (double f p0 a b c d [count 1]) - (let ([arrows1 (launder (f (ghost p0) a b c d count #:dot-delta 1))] - [arrows2 (launder (f (ghost p0) a b c d count #:dot-delta -1))]) - (cc-superimpose p0 - arrows1 - arrows2))) + (define arrows1 (launder (f (ghost p0) a b c d count #:dot-delta 1))) + (define arrows2 (launder (f (ghost p0) a b c d count #:dot-delta -1))) + (cc-superimpose p0 arrows1 arrows2)) (define (triple f p0 a b c d [count 1]) - (let ([arrows (launder (f (ghost p0) a b c d count))] - [up-arrows (launder (f (ghost p0) a b c d count #:dot-delta 2))] - [down-arrows (launder (f (ghost p0) a b c d count #:dot-delta -2))]) - (cc-superimpose p0 - arrows - up-arrows - down-arrows))) + (define arrows (launder (f (ghost p0) a b c d count))) + (define up-arrows (launder (f (ghost p0) a b c d count #:dot-delta 2))) + (define down-arrows (launder (f (ghost p0) a b c d count #:dot-delta -2))) + (cc-superimpose p0 arrows up-arrows down-arrows)) (define (connect-circly-dots show-arrowhead? main dot1 . dots) (let loop ([prev-dot dot1] @@ -343,38 +338,35 @@ ;; this is a hack -- it will only work with right-right-reference (define (connect-two-circly-dots pict dot1 dot2 arrowhead?) - (let ([base - (let*-values ([(sx sy) (cc-find pict dot1)] - [(raw-ex ey) (cc-find pict dot2)] - [(ex) (if arrowhead? - (+ raw-ex 2) - raw-ex)]) - (cc-superimpose - (dc - (λ (dc dx dy) - (let ([pen (send dc get-pen)]) - (send dc set-pen - type-link-color ;(send pen get-color) - (if (is-a? dc post-script-dc%) - 4 - 2) - 'dot) - (send dc draw-line - (+ dx sx) (+ dy sy) - (+ dx ex) (+ dy ey)) - (send dc set-pen pen))) - (pict-width pict) - (pict-height pict)) - pict))]) + (define base + (let*-values ([(sx sy) (cc-find pict dot1)] + [(raw-ex ey) (cc-find pict dot2)] + [(ex) (if arrowhead? + (+ raw-ex 2) + raw-ex)]) + (cc-superimpose (dc (λ (dc dx dy) + (let ([pen (send dc get-pen)]) + (send dc + set-pen + type-link-color ;(send pen get-color) + (if (is-a? dc post-script-dc%) 4 2) + 'dot) + (send dc draw-line (+ dx sx) (+ dy sy) (+ dx ex) (+ dy ey)) + (send dc set-pen pen))) + (pict-width pict) + (pict-height pict)) + pict))) (if arrowhead? (pin-arrow-line field-arrowhead-size base - dot1 (λ (ignored1 ignored2) - (let-values ([(x y) (cc-find pict dot2)]) - (values (+ x 2) y))) - dot2 cc-find + dot1 + (λ (ignored1 ignored2) + (let-values ([(x y) (cc-find pict dot2)]) + (values (+ x 2) y))) + dot2 + cc-find #:color type-link-color) - base))) + base)) (define (dotted-right-right-reference p0 a b c d [count 1]) (right-right-reference p0 a b c d count #:connect-dots connect-circly-dots)) diff --git a/scribble-doc/scribblings/scribble/utils.rkt b/scribble-doc/scribblings/scribble/utils.rkt index 742937b087..5f5dc3791d 100644 --- a/scribble-doc/scribblings/scribble/utils.rkt +++ b/scribble-doc/scribblings/scribble/utils.rkt @@ -75,28 +75,27 @@ (port-count-lines! p) (let loop ([r '()] [newlines? #f]) (regexp-match? #px#"^[[:space:]]*" p) - (let* ([p1 (file-position p)] - [stx (scribble:read-syntax #f p)] - [p2 (file-position p)]) - (if (not (eof-object? stx)) + (define p1 (file-position p)) + (define stx (scribble:read-syntax #f p)) + (define p2 (file-position p)) + (if (not (eof-object? stx)) (let ([str (substring lines p1 p2)]) - (loop (cons (list str stx) r) - (or newlines? (regexp-match? #rx#"\n" str)))) + (loop (cons (list str stx) r) (or newlines? (regexp-match? #rx#"\n" str)))) (let* ([r (reverse r)] [r (if newlines? - (cdr (apply append (map (lambda (x) (list #f x)) r))) - r)]) - (make-table - plain - (map (lambda (x) - (let ([@expr (if x (litchar/lines (car x)) "")] - [sexpr (if x - (racket:to-paragraph - ((norm-spacing 0) (cadr x))) - "")] - [reads-as (if x reads-as "")]) - (map as-flow (list spacer @expr reads-as sexpr)))) - r)))))))) + (cdr (apply append (map (lambda (x) (list #f x)) r))) + r)]) + (make-table plain + (map (lambda (x) + (let ([@expr (if x + (litchar/lines (car x)) + "")] + [sexpr (if x + (racket:to-paragraph ((norm-spacing 0) (cadr x))) + "")] + [reads-as (if x reads-as "")]) + (map as-flow (list spacer @expr reads-as sexpr)))) + r))))))) ;; stuff for the scribble/text examples @@ -112,12 +111,12 @@ (define strs2 (split out-text)) (define strsm (map (compose split cdr) more)) (define (str->elts str) - (let ([spaces (regexp-match-positions #rx"(?:^| ) +" str)]) - (if spaces + (define spaces (regexp-match-positions #rx"(?:^| ) +" str)) + (if spaces (list* (str->elts (substring str 0 (caar spaces))) (smaller (hspace (- (cdar spaces) (caar spaces)))) (str->elts (substring str (cdar spaces)))) - (list (smaller (make-element 'tt str)))))) + (list (smaller (make-element 'tt str))))) (define (make-line str) (list (as-flow (if (equal? str "") (smaller (hspace 1)) From c65027e19b7804433932da5987d80226e93b7901 Mon Sep 17 00:00:00 2001 From: "resyntax-ci[bot]" <181813515+resyntax-ci[bot]@users.noreply.github.com> Date: Wed, 4 Dec 2024 00:32:30 +0000 Subject: [PATCH 4/5] Fix 1 occurrence of `define-let-to-double-define` This `let` expression can be pulled up into a `define` expression. --- scribble-doc/scribblings/scribble/utils.rkt | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/scribble-doc/scribblings/scribble/utils.rkt b/scribble-doc/scribblings/scribble/utils.rkt index 5f5dc3791d..34755c3ed7 100644 --- a/scribble-doc/scribblings/scribble/utils.rkt +++ b/scribble-doc/scribblings/scribble/utils.rkt @@ -128,15 +128,16 @@ (filebox file t) t)))) (define filenames (map car more)) - (define indent (let ([d (- max-textsample-width - (for*/fold ([m 0]) - ([s (in-list (cons strs1 strsm))] - [s (in-list s)]) - (max m (string-length s))))]) - (if (negative? d) - (error 'textsample-verbatim-boxes - "left box too wide for sample at line ~s" line) - (make-element 'tt (list (hspace d)))))) + (define d + (- max-textsample-width + (for*/fold ([m 0]) + ([s (in-list (cons strs1 strsm))] + [s (in-list s)]) + (max m (string-length s))))) + (define indent + (if (negative? d) + (error 'textsample-verbatim-boxes "left box too wide for sample at line ~s" line) + (make-element 'tt (list (hspace d))))) ;; Note: the font-size property is reset for every table, so we need it ;; everywhere there's text, and they don't accumulate for nested tables (values From 893e52f685cd98e313a990e3472aab134d0a8d68 Mon Sep 17 00:00:00 2001 From: "resyntax-ci[bot]" <181813515+resyntax-ci[bot]@users.noreply.github.com> Date: Wed, 4 Dec 2024 00:32:30 +0000 Subject: [PATCH 5/5] Fix 1 occurrence of `always-throwing-if-to-when` Using `when` and `unless` is simpler than a conditional with an always-throwing branch. --- scribble-doc/scribblings/scribble/utils.rkt | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/scribble-doc/scribblings/scribble/utils.rkt b/scribble-doc/scribblings/scribble/utils.rkt index 34755c3ed7..40e146516a 100644 --- a/scribble-doc/scribblings/scribble/utils.rkt +++ b/scribble-doc/scribblings/scribble/utils.rkt @@ -186,11 +186,9 @@ (and (string? (syntax-e #'sep)) (regexp-match? sep-rx (syntax-e #'sep))) (let ([m (cond [(regexp-match sep-rx (syntax-e #'sep)) => cadr] [else #f])]) - (if (and m (not (regexp-match? file-rx m))) - (raise-syntax-error #f "bad filename specified" stx #'sep) - (loop #'xs - (list (and m (datum->syntax #'sep m #'sep #'sep))) - (cons (reverse text) texts))))] + (when (and m (not (regexp-match? file-rx m))) + (raise-syntax-error #f "bad filename specified" stx #'sep)) + (loop #'xs (list (and m (datum->syntax #'sep m #'sep #'sep))) (cons (reverse text) texts)))] [(x . xs) (loop #'xs (cons #'x text) texts)] [() (let ([texts (reverse (cons (reverse text) texts))] [line (syntax-line stx)])