Skip to content

Commit

Permalink
Merge pull request #20420 from JuliaLang/jb/tilde
Browse files Browse the repository at this point in the history
fix #20406, parse infix `~` as a normal operator
  • Loading branch information
JeffBezanson authored Feb 3, 2017
2 parents c9d023e + dcf331c commit c52bad9
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
3 changes: 3 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,9 @@ This section lists changes that do not have deprecation warnings.
* In macro calls with parentheses, e.g. `@m(a=1)`, assignments are now parsed as
`=` expressions, instead of as `kw` expressions. ([#7669])

* When used as an infix operator, `~` is now parsed as a call to an ordinary operator
with assignment precedence, instead of as a macro call. ([#20406])

* (µ "micro" and ɛ "latin epsilon") are considered equivalent to
the corresponding Greek characters in identifiers. `\varepsilon`
now tab-completes to U+03B5 (greek small letter epsilon) ([#19464]).
Expand Down
1 change: 0 additions & 1 deletion doc/src/devdocs/ast.md
Original file line number Diff line number Diff line change
Expand Up @@ -422,7 +422,6 @@ call. Finally, chains of comparisons have their own special expression structure
| `x"y"z` | `(macrocall @x_str "y" "z")` |
| `"x = $x"` | `(string "x = " x)` |
| ``` `a b c` ``` | `(macrocall @cmd "a b c")` |
| `x ~ distr` | `(macrocall @~ x distr)` |

Doc string syntax:

Expand Down
4 changes: 1 addition & 3 deletions src/julia-parser.scm
Original file line number Diff line number Diff line change
Expand Up @@ -754,9 +754,7 @@
(not (eqv? (peek-char (ts:port s)) #\ )))
(begin (ts:put-back! s t)
ex)
(let ((args (parse-chain s down '~)))
`(macrocall @~ ,ex ,@(butlast args)
,(loop (last args) (peek-token s)))))
(list 'call t ex (parse-assignment s down)))
(list t ex (parse-assignment s down)))))))

(define (parse-eq s)
Expand Down

0 comments on commit c52bad9

Please sign in to comment.