From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: =?utf-8?Q?Mattias_Engdeg=C3=A5rd?= Newsgroups: gmane.emacs.devel Subject: Re: Scheme Mode and Regular Expression Literals Date: Thu, 14 Mar 2024 12:38:53 +0100 Message-ID: References: <87sf105cw1.fsf@niceume.com> <86edcdb40m.fsf@gnu.org> Mime-Version: 1.0 (Mac OS X Mail 14.0 \(3654.120.0.1.15\)) Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: quoted-printable Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="40004"; mail-complaints-to="usenet@ciao.gmane.io" Cc: Toshi Umehara , Stefan Monnier , jcubic@onet.pl, emacs-devel@gnu.org To: Eli Zaretskii Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Thu Mar 14 12:39:59 2024 Return-path: Envelope-to: ged-emacs-devel@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1rkjRH-000AGt-2m for ged-emacs-devel@m.gmane-mx.org; Thu, 14 Mar 2024 12:39:59 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rkjQT-0004J7-Bg; Thu, 14 Mar 2024 07:39:09 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1rkjQP-0004HT-OA for emacs-devel@gnu.org; Thu, 14 Mar 2024 07:39:05 -0400 Original-Received: from mail-lf1-x129.google.com ([2a00:1450:4864:20::129]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rkjQN-0007xn-93; Thu, 14 Mar 2024 07:39:04 -0400 Original-Received: by mail-lf1-x129.google.com with SMTP id 2adb3069b0e04-512ed314881so780414e87.2; Thu, 14 Mar 2024 04:38:56 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1710416335; x=1711021135; darn=gnu.org; h=to:references:message-id:content-transfer-encoding:cc:date :in-reply-to:from:subject:mime-version:sender:from:to:cc:subject :date:message-id:reply-to; bh=nnh3AqGzErRhZnt8EvejrTS3XRQeOZz9/A3lmZhtFOQ=; b=Ao36oAZZUKSzL+2urn98O5AFE/JWdvEEiKMV/tsdkGZFXZwkU0aNuX6QW37hscuRFA 8+5BYj1Boe91KrVMrhiSAAggcQsG0F7VOOMpnSp55rSLQoiiQSdp5wdjDjuRqRVTTDnZ e4Xhv/d7+Fob1WHGsotsT+ZoiOqltylD1DXE7DCvEiaZNsoKmsjYo7bRIModQOejgB6b qE3MFJUQ1CinL0uYMBaDN9de+AidqBalTE9Ydypf2+daamCNP09Xpwk7HyKXNngzkYhS Sdvz2Con+k9Oq0Nt/Mo3xK6poyFupXcmdwBag5KzYdinHvC+37ZB69Jj01a3fuN28R3w DQRw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1710416335; x=1711021135; h=to:references:message-id:content-transfer-encoding:cc:date :in-reply-to:from:subject:mime-version:sender:x-gm-message-state :from:to:cc:subject:date:message-id:reply-to; bh=nnh3AqGzErRhZnt8EvejrTS3XRQeOZz9/A3lmZhtFOQ=; b=aBK4AMsmhfiXgx5ftNdiCzKOQ81y8027tNkksN7bI1C69h1Wiz1qw3gd8euX6QYDKG wkuvNfrCyKsDZ1ckITaXUsaPozyK6GYue/9GWksih0kC1HW+2jIuje170LxHsqyf8Ko0 dWGbtj2Hv0VKZsGRQoXdL5+pefE8znBb6WgIBqdA8C58aVUwstiKWchs4PCfZjcXhjzS 9y1XKS41gwGsxzpmGbDjhryD2UHuUcgU9+pzFiha/j6pinR1L4cXM2aPCPH68murY84G +EUntngPv8lJJTWbJKsLxBN/DL5yuSqDM40h6lcUYOcuZKGGtk+2xNykjcCpOeOv0g3P x4eQ== X-Forwarded-Encrypted: i=1; AJvYcCUXww01iTSZiS6UJmyuQfm3LGDL11gd5Lc3vCEAnWshD60opCfeGUMhpD7rmB82IKG8O4M2zMZs5tdBWIzzWrLjmvxd X-Gm-Message-State: AOJu0YwjvIUt04xBE/XA1J3WAf1sj5FIUa4fmjN2/mq72LeFRAtIl9oN F9XVqqKHWbIeQw47aqbxGbYrL1x2aW+3rOWcSqg5PMQwrP59noH2t4WlgvWP X-Google-Smtp-Source: AGHT+IGduw2qJiwJLhV+BUNQKkTVZiNNPdF/gu/AhYeQS/yoeT/UnlgCfPEQ+YCPzhTI5GAXx+8MLg== X-Received: by 2002:a19:ca4f:0:b0:513:cb41:3c7d with SMTP id h15-20020a19ca4f000000b00513cb413c7dmr999587lfj.27.1710416335056; Thu, 14 Mar 2024 04:38:55 -0700 (PDT) Original-Received: from smtpclient.apple (c80-217-1-132.bredband.tele2.se. [80.217.1.132]) by smtp.gmail.com with ESMTPSA id b15-20020a19644f000000b00513c86ec256sm241987lfj.192.2024.03.14.04.38.54 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Thu, 14 Mar 2024 04:38:54 -0700 (PDT) In-Reply-To: <86edcdb40m.fsf@gnu.org> X-Mailer: Apple Mail (2.3654.120.0.1.15) Received-SPF: pass client-ip=2a00:1450:4864:20::129; envelope-from=mattias.engdegard@gmail.com; helo=mail-lf1-x129.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.devel:317045 Archived-At: > (syntax-propertize-rules > + ;; For #/regexp/ syntax > + ("\\(#\\)/\\(\\\\/\\|\\\\\\\\\\|.\\)*?\\(/\\)" > + (1 "|") > + (3 "|")) That amount of leaning toothpicks confuses even someone used to reading = Elisp regexps so I'm switching notation here (`syntax-propertize-rules` = permits regexps in rx). The above means: ((rx (group "#") "/" (*? (group (| "\\/" "\\\\" nonl))) (group "/")) (1 "|") (3 "|")) This is a tad too ambiguous; it will match "#/ab\/", for instance, which = probably wasn't intended. What about the more robust ((rx (group "#") "/" (* (| (: "\\" nonl) (not (in "\n/\\")))) (group "/")) (1 "|") (2 "|")) instead? The Gauche documentation isn't entirely clear on how literal newlines = are lexed inside this construct. If newlines can be part of regexp literals, remove the \n from the third = line. If backslashed newlines are allowed, change `nonl` to `anychar`.