diff --git a/collects/honu/core/read.rkt b/collects/honu/core/read.rkt index b169814433..1feb369686 100644 --- a/collects/honu/core/read.rkt +++ b/collects/honu/core/read.rkt @@ -10,6 +10,8 @@ (for-syntax racket/base syntax/parse)) +(require "private/debug.rkt") + (define-tokens honu-tokens (number identifier string)) (define-empty-tokens honu-empty-tokens @@ -152,7 +154,7 @@ (define (read-tokens port) (let loop ([tokens '()]) (define next (honu-lexer port)) - ;; (printf "next ~a\n" next) + ;; (debug "next token ~a\n" next) (match next [(struct* position-token ([token (? token-eof?)] [start-pos start] [end-pos end])) ; (printf "done lexing ~a\n" tokens) diff --git a/collects/honu/core/runtime.rkt b/collects/honu/core/runtime.rkt index 439689306e..258b2f8702 100644 --- a/collects/honu/core/runtime.rkt +++ b/collects/honu/core/runtime.rkt @@ -1,7 +1,27 @@ #lang racket/base -(require "read.rkt") +(require "read.rkt" + "private/honu-typed-scheme.rkt" + racket/port) + +(define (read-one-line name input) + (define quit? #f) + (define one-line + (with-output-to-string + (lambda () + (let loop () + (define next (read-char input)) + (when (eof-object? next) + (set! quit? #t)) + (when (not (or (eof-object? next) + (char=? next #\newline))) + (display next) + (loop)))))) + (if quit? + ;; this isn't right, somehow communicate to the system that the repl should close + #'(exit) + (honu-read-syntax name (open-input-string one-line)))) (provide configure) (define (configure . args) - (current-read-interaction honu-read-syntax)) + (current-read-interaction read-one-line))