[honu] handle empty files

This commit is contained in:
Jon Rafkind 2011-08-09 11:49:54 -06:00
parent 182cded2a3
commit b823df23a7
2 changed files with 9 additions and 5 deletions

View File

@ -452,9 +452,12 @@ Then, in the pattern above for 'if', 'then' would be bound to the following synt
(define-syntax (honu-unparsed-begin stx)
(emit-remark "Honu unparsed begin!" stx)
(debug "honu unparsed begin: ~a at phase ~a\n" (syntax->datum stx) (syntax-local-phase-level))
(define expanded (honu-expand (stx-cdr stx)))
(debug "expanded ~a\n" expanded)
expanded)
(syntax-parse stx
[(_) #'(void)]
[(_ forms ...)
(define expanded (honu-expand #'(forms ...)))
(debug "expanded ~a\n" expanded)
expanded]))
(define-syntax (#%dynamic-honu-module-begin stx)
(syntax-case stx ()

View File

@ -153,7 +153,7 @@
;; (printf "next ~a\n" next)
(match next
[(struct* position-token ([token (? token-eof?)] [start-pos start] [end-pos end]))
;; (printf "done lexing\n")
; (printf "done lexing ~a\n" tokens)
(reverse tokens)]
[(struct* position-token ([token (? token-end-of-line-comment?)]
[start-pos start]
@ -357,7 +357,7 @@
[else (loop (cdr use))])))
(if (null? tokens)
eof
(datum->syntax #f '() #f)
(datum->syntax #f (do-parse '() tokens dispatch-table)
#f)))
@ -380,6 +380,7 @@
(port-count-lines! port)
port)
#;
(test-case
"Basic tests"
(check-equal? (strip (lex-string "5"))