Skip to content

Commit

Permalink
Add deprecation warning for multiple successive semicolons (JuliaLang…
Browse files Browse the repository at this point in the history
  • Loading branch information
BioTurboNick authored Feb 5, 2021
1 parent af353ec commit 30afc32
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
1 change: 1 addition & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,7 @@ Standard library changes

Deprecated or removed
---------------------
- Multiple successive semicolons in an array expresion were previously ignored (e.g. `[1 ;; 2] == [1 ; 2]`). Multiple semicolons are being reserved for future syntax and may have different behavior in a future release.


External dependencies
Expand Down
10 changes: 9 additions & 1 deletion src/julia-parser.scm
Original file line number Diff line number Diff line change
Expand Up @@ -1869,7 +1869,15 @@
(fix 'vect vec) ; [x] => (vect x)
(fix 'hcat vec)))) ; [x y] => (hcat x y)
(case t
((#\; #\newline)
((#\;)
(take-token s)
(if (eqv? (peek-token s) #\;)
(parser-depwarn s (string "Multiple semicolons in an array concatenation expression currently have no effect, "
"but may have a new meaning in a future version of Julia.")
"Please remove extra semicolons to preserve forward compatibility e.g. [1;;3] => [1;3]."))
(set! gotnewline #f)
(loop '() (update-outer vec outer)))
((#\newline)
(or gotnewline (take-token s))
(set! gotnewline #f)
(loop '() (update-outer vec outer)))
Expand Down

0 comments on commit 30afc32

Please sign in to comment.