Review fixes: print fast-path + regex zero-width advance

- with-deeper-print only parameterizes the print depth when *print-level* is
  set, so printing pays no parameterize on the common nil-default path.
- re-find (the matcher) and re-seq advance past a zero-width match relative to
  the match's own start, not the search origin — a zero-width match found past
  the origin (lookahead/boundary) no longer repeats. (re-seq #"a*" "aba") now
  matches the JVM.
This commit is contained in:
Yogthos 2026-06-26 21:01:55 -04:00
parent cc26e3abba
commit 28d938c396
3 changed files with 17 additions and 6 deletions

View file

@ -234,10 +234,14 @@
(cond ((null? s) (reverse acc))
((fx>=? i lim) (reverse (cons "..." acc)))
(else (loop (cdr s) (fx+ i 1) (cons (car s) acc))))))))
;; bump the print depth around a collection's element rendering.
;; bump the print depth around a collection's element rendering — but only when
;; *print-level* is set, since depth is consulted only to enforce it. With the
;; common nil default this is a plain begin, so printing pays no parameterize.
(define-syntax with-deeper-print
(syntax-rules ()
((_ body ...) (parameterize ((jolt-print-depth (fx+ (jolt-print-depth) 1))) body ...))))
((_ body ...) (if (jolt-print-level)
(parameterize ((jolt-print-depth (fx+ (jolt-print-depth) 1))) body ...)
(begin body ...)))))
;; A host shim registers a type's str-style rendering via register-pr-str-arm! (or
;; register-pr-arm! in printing.ss for both printers at once) instead of