From 30afc32fc919e7238ec29aa18b0efb1ea5e5db66 Mon Sep 17 00:00:00 2001 From: Nicholas Bauer Date: Fri, 5 Feb 2021 18:30:49 -0500 Subject: [PATCH] Add deprecation warning for multiple successive semicolons (#37168) --- NEWS.md | 1 + src/julia-parser.scm | 10 +++++++++- 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/NEWS.md b/NEWS.md index 13ed6ef10732f..36839b41fa989 100644 --- a/NEWS.md +++ b/NEWS.md @@ -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 diff --git a/src/julia-parser.scm b/src/julia-parser.scm index dbd9c35ff4ff4..0b3f52ca61647 100644 --- a/src/julia-parser.scm +++ b/src/julia-parser.scm @@ -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)))