Skip to content

Commit

Permalink
fix bug in parsing extended colon-like operators (#29314)
Browse files Browse the repository at this point in the history
  • Loading branch information
JeffBezanson authored Sep 24, 2018
1 parent 64a4f18 commit 99e0b3b
Show file tree
Hide file tree
Showing 2 changed files with 8 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 @@ -830,7 +830,7 @@
(first? #t))
(let* ((t (peek-token s))
(spc (ts:space? s)))
(cond ((and first? (eq? t '|..|))
(cond ((and first? (is-prec-colon? t) (not (eq? t ':)))
(take-token s)
`(call ,t ,ex ,(parse-expr s)))
((and range-colon-enabled (eq? t ':))
Expand Down
7 changes: 7 additions & 0 deletions test/syntax.jl
Original file line number Diff line number Diff line change
Expand Up @@ -1728,3 +1728,10 @@ function test_26037()
end
end
@test test_26037() === nothing # no UndefVarError

# range and interval operators
@test Meta.parse("1…2") == Expr(:call, :, 1, 2)
@test Meta.parse("1⁝2") == Expr(:call, :, 1, 2)
@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")

0 comments on commit 99e0b3b

Please sign in to comment.