From 0e82bb6518a96917c31870a8f002d9bc3bdb9c43 Mon Sep 17 00:00:00 2001 From: Yichao Yu Date: Fri, 7 Aug 2015 08:40:55 -0400 Subject: [PATCH] Skip newlines before looking for closing tokens. --- src/julia-parser.scm | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/src/julia-parser.scm b/src/julia-parser.scm index 25ed1cbdc643e..c34e1103b0fa2 100644 --- a/src/julia-parser.scm +++ b/src/julia-parser.scm @@ -705,12 +705,12 @@ (define (parse-block s (down parse-eq)) (parse-Nary s down '(#\newline #\;) 'block - '(end else elseif catch finally) #t)) + '(end else elseif catch finally) #t)) ;; ";" at the top level produces a sequence of top level expressions (define (parse-stmts s) (let ((ex (parse-Nary s (lambda (s) (parse-docstring s parse-eq)) - '(#\;) 'toplevel '(#\newline) #t))) + '(#\;) 'toplevel '(#\newline) #t))) ;; check for unparsed junk after an expression (let ((t (peek-token s))) (if (not (or (eof-object? t) (eqv? t #\newline) (eq? t #f))) @@ -2077,7 +2077,12 @@ (define (parse-docstring s production) (let* ((ex (production s))) - (if (and (doc-string-literal? ex) (not (closing-token? (peek-token s)))) + (if (and (doc-string-literal? ex) + (let loop ((t (peek-token s))) + (cond + ((closing-token? t) #f) + ((newline? t) (take-token s) (loop (peek-token s))) + (else #t)))) `(macrocall (|.| Base (quote @doc)) ,ex ,(production s)) ex)))