diff --git a/zo-lib/compiler/zo-marshal.rkt b/zo-lib/compiler/zo-marshal.rkt index 5066aa3d49..d2d55248f3 100644 --- a/zo-lib/compiler/zo-marshal.rkt +++ b/zo-lib/compiler/zo-marshal.rkt @@ -431,12 +431,26 @@ [esrcloc (let () (define (avail? n) (n . >= . 0)) (define (xvector a b c d e) + ;; Add paren-shape info, if any: (case (hash-ref props 'paren-shape #f) - [(#\[) (vector a b c d e #\[)] - [(#\{) (vector a b c d e #\{)] + [(#\[) (yvector a b c d e #\[)] + [(#\{) (yvector a b c d e #\{)] [else (if (or a (avail? b) (avail? c) (avail? d)) - (vector a b c d e) + (yvector a b c d e #f) #f)])) + (define (yvector a b c d e f) + ;; Add properties, if any: + (if (positive? (- (hash-count props) (if f 1 0))) + (vector a b c d e f + (sort (for/list ([(k v) (in-hash props)] + #:unless (and f + (eq? k 'paren-shape))) + (cons k v)) + symbol . 5)) - (case (vector-ref esrcloc 5) - [(#\[) #hasheq((paren-shape . #\[))] - [(#\{) #hasheq((paren-shape . #\{))] - [else #hasheq()]) - #hasheq()))))) + (let ([props + (if (and esrcloc ((vector-length esrcloc) . > . 5)) + (case (vector-ref esrcloc 5) + [(#\[) #hasheq((paren-shape . #\[))] + [(#\{) #hasheq((paren-shape . #\{))] + [else #hasheq()]) + #hasheq())]) + (if (and esrcloc ((vector-length esrcloc) . > . 6)) + (for/fold ([props props]) ([p (in-list (vector-ref esrcloc 6))]) + (hash-set props (car p) (cdr p))) + props)))))) (values (car p) (cdr p))) ;; ----------------------------------------