|
48 | 48 | (define port |
49 | 49 | (cond |
50 | 50 | [(input-port? input) input] |
51 | | - [else (let* ([text (drracket:language:text/pos-text input)] |
52 | | - [start (drracket:language:text/pos-start input)] |
53 | | - [end (drracket:language:text/pos-end input)] |
54 | | - [text-port (open-input-text-editor text start end values |
55 | | - (send text get-port-name))]) |
56 | | - (port-count-lines! text-port) |
57 | | - (let* ([line (send text position-paragraph start)] |
58 | | - [column (- start (send text paragraph-start-position line))] |
59 | | - [relocated-port (relocate-input-port text-port |
60 | | - (+ line 1) |
61 | | - column |
62 | | - (+ start 1))]) |
63 | | - (port-count-lines! relocated-port) |
64 | | - relocated-port))])) |
| 51 | + [else |
| 52 | + (define text (drracket:language:text/pos-text input)) |
| 53 | + (define start (drracket:language:text/pos-start input)) |
| 54 | + (define end (drracket:language:text/pos-end input)) |
| 55 | + (define text-port |
| 56 | + (open-input-text-editor text start end values |
| 57 | + (send text get-port-name))) |
| 58 | + (port-count-lines! text-port) |
| 59 | + (let* ([line (send text position-paragraph start)] |
| 60 | + [column (- start (send text paragraph-start-position line))] |
| 61 | + [relocated-port (relocate-input-port text-port |
| 62 | + (+ line 1) |
| 63 | + column |
| 64 | + (+ start 1))]) |
| 65 | + (port-count-lines! relocated-port) |
| 66 | + relocated-port)])) |
65 | 67 | (parameterize ([current-eventspace eventspace]) |
66 | 68 | (queue-callback |
67 | 69 | (λ () |
68 | | - (let ([read-thnk |
69 | | - (if complete-program? |
70 | | - (send language front-end/complete-program port settings) |
71 | | - (send language front-end/interaction port settings))]) |
72 | | - (let loop () |
73 | | - (let ([in (read-thnk)]) |
74 | | - (cond |
75 | | - [(eof-object? in) |
76 | | - (iter in (λ () (void)))] |
77 | | - [else |
78 | | - (iter in (λ () (loop)))]))))))))) |
| 70 | + (define read-thnk |
| 71 | + (if complete-program? |
| 72 | + (send language front-end/complete-program port settings) |
| 73 | + (send language front-end/interaction port settings))) |
| 74 | + (let loop () |
| 75 | + (let ([in (read-thnk)]) |
| 76 | + (cond |
| 77 | + [(eof-object? in) |
| 78 | + (iter in (λ () (void)))] |
| 79 | + [else |
| 80 | + (iter in (λ () (loop)))])))))))) |
79 | 81 |
|
80 | 82 | (define (expand-program/multiple language-settings |
81 | 83 | eval-compile-time-part? |
|
228 | 230 | [(equal? chars (string->list "WXME")) |
229 | 231 | (define text (make-object text%)) |
230 | 232 | (send text load-file filename) |
231 | | - (let ([port (open-input-text-editor text)]) |
232 | | - (port-count-lines! port) |
233 | | - (values port text))] |
| 233 | + (define port (open-input-text-editor text)) |
| 234 | + (port-count-lines! port) |
| 235 | + (values port text)] |
234 | 236 | [else |
235 | 237 | (define port (open-input-file filename)) |
236 | 238 | (port-count-lines! port) |
|
0 commit comments