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 Oct 20, 2018
1 parent 2e2b14c commit 0552c7a
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 @@ -1735,3 +1735,11 @@ end
@test Meta.parse("1..2") == Expr(:call, :.., 1, 2)
# we don't parse chains of these since the associativity and meaning aren't clear
@test_throws ParseError Meta.parse("1..2..3")

# 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 0552c7a

Please sign in to comment.