From 2a001c9577b9364cc866638f94abd51ddb020b4f Mon Sep 17 00:00:00 2001 From: Jeff Bezanson Date: Wed, 17 Jan 2018 14:16:40 -0500 Subject: [PATCH] disallow `begin` inside indexing part of #23354, #25458 --- NEWS.md | 3 +++ src/julia-parser.scm | 2 ++ 2 files changed, 5 insertions(+) diff --git a/NEWS.md b/NEWS.md index 1d8be550428a8..1f9ff6c420a03 100644 --- a/NEWS.md +++ b/NEWS.md @@ -184,6 +184,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