From 5b73d23f270bd16e63bdab5b9c911d6e8971b122 Mon Sep 17 00:00:00 2001 From: Robby Findler Date: Thu, 31 Jul 2003 19:54:45 +0000 Subject: [PATCH] .. original commit: f13c702a5b40d4210e67ac8a0acc4a8e10e58abd --- collects/help/private/search.ss | 68 ++++++++++++++++++--------------- 1 file changed, 37 insertions(+), 31 deletions(-) diff --git a/collects/help/private/search.ss b/collects/help/private/search.ss index 7f31ed63..5983010b 100644 --- a/collects/help/private/search.ss +++ b/collects/help/private/search.ss @@ -180,37 +180,43 @@ (lambda (r start) (cond [(regexp-match re:keyword-line r) - (let* ([p (open-input-string (substring r 1 (string-length r)))] - [entry (parameterize ([read-accept-bar-quote #f]) - (read p))] - [key (let loop ([entry entry]) - (cond - [(symbol? entry) entry] - [(pair? entry) (if (eq? (car entry) 'quote) - (loop (cadr entry)) - (loop (car entry)))] - [else (error "bad entry")]))] - [content (if (symbol? entry) - (with-handlers ([not-break-exn? (lambda (x) #f)]) - (let ([s (read p)]) - (if (eq? s '::) - (read p) - #f))) - #f)]) - (list - ; Make the keyword entry: - (list (symbol->string key) ; the keyword name - (let ([p (open-output-string)]) - (if content - (display content p) - (if (and (pair? entry) - (eq? (car entry) 'quote)) - (fprintf p "'~s" (cadr entry)) - (display entry p))) - (get-output-string p)) ; the text to display - (cadr doc) ; file - start ; label (a position in this case) - "doc.txt")))] ; title + (let/ec k + (let* ([p (open-input-string (substring r 1 (string-length r)))] + [entry (parameterize ([read-accept-bar-quote #f]) + (with-handlers ([not-break-exn? + (lambda (x) + (k null))]) + (read p)))] + [key (let loop ([entry entry]) + (cond + [(symbol? entry) entry] + [(pair? entry) (if (and (eq? (car entry) 'quote) + (pair? (cdr entry))) + (loop (cadr entry)) + (loop (car entry)))] + [else (error "bad entry")]))] + [content (if (symbol? entry) + (with-handlers ([not-break-exn? (lambda (x) #f)]) + (let ([s (read p)]) + (if (eq? s '::) + (read p) + #f))) + #f)]) + (list + ; Make the keyword entry: + (list (symbol->string key) ; the keyword name + (let ([p (open-output-string)]) + (if content + (display content p) + (if (and (pair? entry) + (pair? (cdr entry)) + (eq? (car entry) 'quote)) + (fprintf p "'~s" (cadr entry)) + (display entry p))) + (get-output-string p)) ; the text to display + (cadr doc) ; file + start ; label (a position in this case) + "doc.txt"))))] ; title [else #f])))) (define re:index-line (regexp "_([^_]*)_(.*)"))