diff --git a/NEWS.md b/NEWS.md index e4675001863e8..f227a8549fd32 100644 --- a/NEWS.md +++ b/NEWS.md @@ -185,6 +185,9 @@ Language changes * `=>` now has its own precedence level, giving it strictly higher precedence than `=` and `,` ([#25391]). + * `begin` is disallowed inside indexing expressions, in order to enable the syntax + `a[begin]` (for selecting the first element) in the future ([#23354]). + * Underscores for `_italics_` and `__bold__` are now supported by the Base Markdown parser. ([#25564]) diff --git a/src/julia-parser.scm b/src/julia-parser.scm index 80ab7f33fa933..4d4d9f616ff66 100644 --- a/src/julia-parser.scm +++ b/src/julia-parser.scm @@ -1318,6 +1318,8 @@ ;; parse expressions or blocks introduced by syntactic reserved words (define (parse-resword s word) + (if (and (eq? word 'begin) end-symbol) + (parser-depwarn s "\"begin\" inside indexing expression" "")) (with-bindings ((expect-end-current-line (input-port-line (ts:port s)))) (with-normal-context