Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:110773 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 68404 invoked from network); 29 Jun 2020 12:27:13 -0000 Received: from unknown (HELO php-smtp4.php.net) (45.112.84.5) by pb1.pair.com with SMTP; 29 Jun 2020 12:27:13 -0000 Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id C79631804C7 for ; Mon, 29 Jun 2020 04:15:53 -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,HTML_MESSAGE, RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H2,SPF_HELO_NONE,SPF_PASS 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-il1-f169.google.com (mail-il1-f169.google.com [209.85.166.169]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (P-256) server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by php-smtp4.php.net (Postfix) with ESMTPS for ; Mon, 29 Jun 2020 04:15:53 -0700 (PDT) Received: by mail-il1-f169.google.com with SMTP id a11so5818439ilk.0 for ; Mon, 29 Jun 2020 04:15:53 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to; bh=fW/amCEg6/AS+dhaBGnuWsPj0WEqMyDEXfcyoamaGZI=; b=T9BVkviinHZn9TSkqYzPL1/7drUUVedsfShLfTOju5rwIAqBTOQphUG4MAdu3BCgzE rnwG0xrJanaSY+yFdR55qEEMvxV11rHSUIFof9rZQUPXHof3Sni596Uo4PyPrvZtFo1B T2WRdMVWBfXkFoh6MCKz570iQLds2xFSspRhVBePzEZ0t5Rt31t64UjvhqAxJaXfg5QP tytlf6ilwWz6YhowivW/yfzyeXYRD8DbuZ11re675ghQveZQbbbRbgalV9HK9oXo7oV5 VR58gztNvqISfCmEy/Kg1MaT7lPNE+qdPP1IQnfK7Z9/KTPO9CPJASFRD43kuFX7bCoc W1cw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to; bh=fW/amCEg6/AS+dhaBGnuWsPj0WEqMyDEXfcyoamaGZI=; b=Miv/PUcaBE7mEAR6lOXsydjMdKeovr9qevgQB1pTRRs2/B3nlTr2AlJbkx4DTORfU+ wDO2HI9Yu0C/GCXOS9vSppNjd3sN/oqOXFn6e8g2O89bVEFGXlJ7nrc6DVXFxtHKc2hD 6kr46QIF3dt4Zm8x7kT4bFJX5RxJATEiX0snA3hr6NhwtXEWDfcgEb+0UmPNnYEsNHeO saW89LE6Zi+9q2N3CJh3JdrVcpSJteW5LPjG/u6Sz8YBgmMjMAd6VQI0LuoJx5GjDcs2 b1ZLHe9iOsOXQAJMjdejxUF8lgPjIQ6GuQxyvUCIc2gXJWEYhDsVZc0h8cz15+qFut/1 /mtw== X-Gm-Message-State: AOAM532U1qR3vgBqh8aF723d5lTrgtPR9b4gcOZgUlCEGZcsFi8Z1SIh UoW823KZNKuJ0TiLkiRKM0xBonNG6/2fBsebMx5Kyw== X-Google-Smtp-Source: ABdhPJya0f3KJ9OKFLPxBw3ceuKLTgZWYkLUUajY6BF2lxzF0cUTzEFp+YGq6GPabSnrz+G2E+xtTioDoXZNj6XYSjs= X-Received: by 2002:a92:10a:: with SMTP id 10mr15055928ilb.172.1593429351887; Mon, 29 Jun 2020 04:15:51 -0700 (PDT) MIME-Version: 1.0 References: <0915B96B-DFF1-4F24-993B-350D36EB9A74@gmail.com> In-Reply-To: <0915B96B-DFF1-4F24-993B-350D36EB9A74@gmail.com> Date: Mon, 29 Jun 2020 12:15:40 +0100 Message-ID: To: PHP Internals Content-Type: multipart/alternative; boundary="0000000000007e786d05a9372e0d" Subject: Re: [PHP-DEV] Improving output of syntax errors From: rowan.collins@gmail.com (Rowan Tommins) --0000000000007e786d05a9372e0d Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable On Mon, 29 Jun 2020 at 10:42, Claude Pache wrote: > > At this point, I don=E2=80=99t feel strongly, because currently, when I s= ee > =E2=80=9Cunexpected '''' (T_CONSTANT_ENCAPSED_STRING)=E2=80=9D, > my automatism is not looking for a string with specific quote style (whic= h > is not evident by looking at four consecutive quotes), but for a missing = or > misplaced punctuation mark, because, by experience, it is most of the tim= e > the root cause of an error message containing that specific token name. > Yes, there's a bunch of cases where what the parser sees and expects isn't really that helpful, and what's parsed as a zero-length string may not actually look that way in the source. There's probably diminishing returns trying to handle that at the message level, rather than extending the parser itself as has been done for mis-matched brackets. > Another way to give the programmer the appropriate information, is > replacing =E2=80=9Cquoted string=E2=80=9D with =E2=80=9Csingle-quoted str= ing=E2=80=9D and =E2=80=9Cdouble-quoted > string=E2=80=9D. > That would actually make a lot of sense. I'll have a look if it can be done without changing the actual parser definitions (which recognise both forms as the same token type). > And while I am thinking about it: a case that tends to cause divergent > squint is: unexpected '"', which you changed into: unexpected token """. = In > that specific case, it would be nice if it the common name of the offendi= ng > token was spelt out, something like: unexpected double quotation mark. > That would be a reasonable special-case; theoretically, the same would apply for a lone single-quote, although I think the parser happens never to see that as a separate token. Thanks for the feedback, --=20 Rowan Tommins [IMSoP] --0000000000007e786d05a9372e0d--