From efd572e4260d5176cc4f30ae42bc0e525ceb8d02 Mon Sep 17 00:00:00 2001 From: Robby Findler Date: Sun, 15 Feb 2009 21:05:03 +0000 Subject: [PATCH] svn: r13614 original commit: 965110bc551acfdcfac53262903aed13c71826b5 --- collects/games/chat-noir/chat-noir-doc.ss | 33 ++++++++++++----------- 1 file changed, 17 insertions(+), 16 deletions(-) diff --git a/collects/games/chat-noir/chat-noir-doc.ss b/collects/games/chat-noir/chat-noir-doc.ss index d7981e0f..f3692c93 100644 --- a/collects/games/chat-noir/chat-noir-doc.ss +++ b/collects/games/chat-noir/chat-noir-doc.ss @@ -32,22 +32,6 @@ @;(require scheme/include) @;(include/reader "chat-noir-literate.ss" scr:read-syntax-inside) -@(define-syntax (content-elsewhere stx) - (syntax-case stx () - [(_ fn) - (string? (syntax-e #'fn)) - (let ([fn (syntax-e #'fn)]) - (register-external-file (path->complete-path fn)) - (call-with-input-file fn - (λ (port) - (port-count-lines! port) - (let ([reader-line (read-line port)]) - (unless (regexp-match #rx"^#reader" reader-line) - (raise-syntax-error #f (format "expected a #reader line, found ~s" reader-line) stx)) - (let* ([content (scr:read-syntax-inside fn port)] - [w/context (give-lexical-content stx content)]) - #`(begin #,@w/context))))))])) - @;{ stolen from include.ss. Should probably be refactored to just have one of these.} @(define-for-syntax (give-lexical-content ctx content) (let loop ([content content]) @@ -72,4 +56,21 @@ content content))]))) +@(define-syntax (content-elsewhere stx) + (syntax-case stx () + [(_ fn) + (string? (syntax-e #'fn)) + (let ([fn (syntax-e #'fn)]) + (register-external-file (path->complete-path fn)) + (call-with-input-file fn + (λ (port) + (port-count-lines! port) + (let ([reader-line (read-line port)]) + (unless (regexp-match #rx"^#reader" reader-line) + (raise-syntax-error #f (format "expected a #reader line, found ~s" reader-line) stx)) + (let* ([content (scr:read-syntax-inside fn port)] + [w/context (give-lexical-content stx content)]) + #`(begin #,@w/context))))))])) + + @content-elsewhere["chat-noir-literate.ss"]