Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:118675 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 26836 invoked from network); 20 Sep 2022 18:34:33 -0000 Received: from unknown (HELO php-smtp4.php.net) (45.112.84.5) by pb1.pair.com with SMTP; 20 Sep 2022 18:34:33 -0000 Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id A99651804AB for ; Tue, 20 Sep 2022 11:34:32 -0700 (PDT) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on php-smtp4.php.net X-Spam-Level: X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM, RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H2,SPF_HELO_NONE,SPF_PASS, T_SCC_BODY_TEXT_LINE autolearn=no autolearn_force=no version=3.4.2 X-Spam-ASN: AS15169 209.85.128.0/17 X-Spam-Virus: No X-Envelope-From: Received: from mail-lf1-f48.google.com (mail-lf1-f48.google.com [209.85.167.48]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (P-256) server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by php-smtp4.php.net (Postfix) with ESMTPS for ; Tue, 20 Sep 2022 11:34:32 -0700 (PDT) Received: by mail-lf1-f48.google.com with SMTP id o2so5251510lfc.10 for ; Tue, 20 Sep 2022 11:34:32 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:cc:to:subject:message-id:date:from :references:in-reply-to:mime-version:from:to:cc:subject:date; bh=OiBIkaXQ2eAgfarzYArOqSFx7UTP63KivkSdhjM9s9I=; b=fMXvdGvfBRqu/uAjFwb5AU5okvIdWzeC+HPflNrU7Xulrl9QdVast02qgx5M7RHK2j Ty3zRye15VXzvUmL4+BWGORnGwXxF2HhvIznih+tuI6/ajWBRKLSeR3Y1RXuK6TMZZju DAsZm/v/jE4XHvIQ6hC0JhiWFMwCPxvbkvk4Lb+Sd3jB1r6AaIgwvcNvIYXCaH6oU+7w YZuITn8FBX2J8IpHwDeuzYZatple4zz630HmukfwmMdbDhWns6vA80dtmwY2MpS7U/xx +xUCX2OUnhFAWoEGjmR/L3BfLqzp3KKwJs9/uNu0cwFJ1vosnAQaVz24KrYqFpCgWcrl WLEQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:cc:to:subject:message-id:date:from :references:in-reply-to:mime-version:x-gm-message-state:from:to:cc :subject:date; bh=OiBIkaXQ2eAgfarzYArOqSFx7UTP63KivkSdhjM9s9I=; b=lN1me5eXCXR43UTgcEhkrUgBjr8jAPPHEiEkd7dclyu5JzL6FznsfqiQ/Ww+zWtzeD u1+XUsJwEAjP7TQny43AGLg3S719TA1DNkE0rbUDxPtYokTaENNCWv/OTZGD7feLpSWH XENYIiV/FffSmc8JtYgwWeVdDWmyQ8eOiHY292fiesINas6XriHJfA60ocWTtijJPSoW whrkwXiPDIl/o1ebwZgxM7eWeq7y2Gvcp2GvX5kR+uBcno6OcyiI90GGWlyQ4eYoQLyS jmZ4xxZ5D/+mI9B6gLu7iZpeF1um+lilsklkQhPoW9y2cPFpR10u/oaZoM4wW3LroXKd N4Uw== X-Gm-Message-State: ACrzQf1Fvy1GoU1Tf5GC047q+qz0mlYKvrw9Xe+Vbpfreyuav09r2Lkl 5df1jcOL5aldK3C6wGWu7WScbRhXKvoNqubHj7M= X-Google-Smtp-Source: AMsMyM4KMBfyEelLLobfacxr9a9sg+7chO0Fv2b9E5DqJB+XwVPy/Kz4Wvex0rEMf+LjgDd6yTYh6PTl2d4et4OIGJg= X-Received: by 2002:a05:6512:3584:b0:49f:517a:19da with SMTP id m4-20020a056512358400b0049f517a19damr7863844lfr.25.1663698871149; Tue, 20 Sep 2022 11:34:31 -0700 (PDT) MIME-Version: 1.0 Received: by 2002:a2e:5303:0:0:0:0:0 with HTTP; Tue, 20 Sep 2022 11:34:30 -0700 (PDT) In-Reply-To: References: <1835622d2ad.e718af7c86636.4041752759703113661@limesurvey.org> Date: Tue, 20 Sep 2022 20:34:30 +0200 Message-ID: To: Sara Golemon Cc: Internals Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Subject: Re: [PHP-DEV] One-line heredoc for better syntax highlightning From: olleharstedt@gmail.com (=?UTF-8?Q?Olle_H=C3=A4rstedt?=) 2022-09-20 17:00 GMT+02:00, Sara Golemon : > On 19 September 2022 15:24:26 BST, "Olle H=C3=A4rstedt" < > olle.haerstedt@limesurvey.org> wrote: >>Some editors can guess the domain-specific language inside heredoc, e.g. > if you do >> >>$query =3D <<>SELECT * FROM foo >>MySQL; >> >>It would be nice if this feature could be used in single lines as well: >> >>$query =3D <<> > Good news! This feature exists and was introduced by Rasmus **checks > notes** about 25 years ago. > > To use it, you'll want to hold down your shift key, then press the key ju= st > to the left of your enter key. This is called a "quote", and you can see > it demonstrated here around the word quote. > > Hope that helps! > > Seriously though, I know you're looking to help your editor find somethin= g > to syntax highlight, but this is an editor problem, not a PHP language > problem. If your editor can detect SQL in heredoc, then it should be abl= e > to improve and find it in interpolated strings. Nope, because you need to be explicit which type of SQL you're working with - MySQL, Postgres, SQL Server, etc. Would be hard to write a regexp to guess that for the editor. :) In the Vim case, it reads your delimiter name and applies syntax highlight from that (mysql, javascript, html). > Making the parser more > complex for no benefit to the actual language (some detriment, I would > argue) is not the fix here. > > -Sara > > P.S. - Yes, I'm assuming a US layout, you know where your quote key is. I you read my text more carefully, you'd see that I thought the parser would be simplified by my suggestion, by removing what I thought was an arbitrary limitation. I was wrong. :( Olle