Skip to content

Commit

Permalink
fix #6139
Browse files Browse the repository at this point in the history
  • Loading branch information
JeffBezanson committed Mar 13, 2014
1 parent a49856e commit cd03a8a
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 12 deletions.
2 changes: 2 additions & 0 deletions src/ast.c
Original file line number Diff line number Diff line change
Expand Up @@ -477,6 +477,8 @@ jl_value_t *jl_parse_next(void)
if (c == FL_EOF)
return NULL;
if (iscons(c)) {
if (cdr_(c) == FL_EOF)
return NULL;
value_t a = car_(c);
if (isfixnum(a)) {
jl_lineno = numval(a);
Expand Down
27 changes: 15 additions & 12 deletions src/jlfrontend.scm
Original file line number Diff line number Diff line change
Expand Up @@ -181,19 +181,22 @@
(set! *ts-stack* (cdr *ts-stack*)))

(define (jl-parser-next)
(skip-ws-and-comments (ts:port current-token-stream))
(let ((lineno (input-port-line (ts:port current-token-stream))))
(let ((e (parser-wrap (lambda ()
(julia-parse current-token-stream)))))
(if (eof-object? e)
e
(cons lineno
(parser-wrap
(lambda ()
(if (and (pair? e) (or (eq? (car e) 'error)
(eq? (car e) 'continue)))
(let* ((err (parser-wrap
(lambda ()
(skip-ws-and-comments (ts:port current-token-stream)))))
(lineno (input-port-line (ts:port current-token-stream))))
(cons lineno
(if (pair? err)
err
(parser-wrap
(lambda ()
(let ((e (julia-parse current-token-stream)))
(if (eof-object? e)
e
(expand-toplevel-expr e)))))))))
(if (and (pair? e) (or (eq? (car e) 'error)
(eq? (car e) 'continue)))
e
(expand-toplevel-expr e))))))))))

; expand a piece of raw surface syntax to an executable thunk
(define (jl-expand-to-thunk expr)
Expand Down

0 comments on commit cd03a8a

Please sign in to comment.