Skip to content

Commit

Permalink
fix operator precendence printing of a in b. fixes #13822
Browse files Browse the repository at this point in the history
  • Loading branch information
vtjnash committed Nov 16, 2015
1 parent 2a40ca9 commit 265670c
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 0 deletions.
1 change: 1 addition & 0 deletions src/julia-parser.scm
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@
(pushprec (cdr L) (+ prec 1)))))
(pushprec (map eval prec-names) 1)
t))
(put! prec-table 'in (get prec-table '== 0)) ; add `in` to the prec-table
(define (operator-precedence op) (get prec-table op 0))

(define unary-ops '(+ - ! ¬ ~ |<:| |>:| √ ∛ ∜))
Expand Down
2 changes: 2 additions & 0 deletions test/show.jl
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,8 @@ end
#@test_repr "w = (x = y) = z" # Doesn't pass, but it's an invalid assignment loc
@test_repr "a & b && c"
@test_repr "a & (b && c)"
@test_repr "(a => b) in c"
@test_repr "a => b in c"

# precedence tie resolution
@test_repr "(a * b) * (c * d)"
Expand Down

3 comments on commit 265670c

@tkelman
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this seems completely unrelated to the PR?

@vtjnash
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes, this would be an easy one to cherry-pick onto master

@vtjnash
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

pushed to master as 4e904a6

Please sign in to comment.