Skip to content

Commit

Permalink
fix #28506, consistently treat comma at end-of-input as incomplete
Browse files Browse the repository at this point in the history
  • Loading branch information
JeffBezanson committed Sep 5, 2018
1 parent 11e32a4 commit 3fd18e4
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/julia-parser.scm
Original file line number Diff line number Diff line change
Expand Up @@ -767,7 +767,7 @@
;; (ex1) => ex1
(car ex))
(begin (take-token s)
(if (or (eof-object? (peek-token s)) (eq? (peek-token s) '=))
(if (eq? (peek-token s) '=) ;; allow x, = ...
(loop ex #f (peek-token s))
(loop (cons (parse-pair s) ex) #f (peek-token s)))))))

Expand Down
8 changes: 8 additions & 0 deletions test/syntax.jl
Original file line number Diff line number Diff line change
Expand Up @@ -1692,3 +1692,11 @@ f28900(; kwarg) = kwarg
let g = @foo28900 f28900(kwarg = x->2x)
@test g(10) == 20
end

# issue #28506
@test Meta.isexpr(Meta.parse("1,"), :incomplete)
@test Meta.isexpr(Meta.parse("1, "), :incomplete)
@test Meta.isexpr(Meta.parse("1,\n"), :incomplete)
@test Meta.isexpr(Meta.parse("1, \n"), :incomplete)
@test_throws LoadError include_string(@__MODULE__, "1,")
@test_throws LoadError include_string(@__MODULE__, "1,\n")

0 comments on commit 3fd18e4

Please sign in to comment.