Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:53456 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 38716 invoked from network); 21 Jun 2011 03:10:01 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 21 Jun 2011 03:10:01 -0000 Authentication-Results: pb1.pair.com header.from=felipensp@gmail.com; sender-id=pass; domainkeys=bad Authentication-Results: pb1.pair.com smtp.mail=felipensp@gmail.com; spf=pass; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 209.85.160.42 as permitted sender) DomainKey-Status: bad X-DomainKeys: Ecelerity dk_validate implementing draft-delany-domainkeys-base-01 X-PHP-List-Original-Sender: felipensp@gmail.com X-Host-Fingerprint: 209.85.160.42 mail-pw0-f42.google.com Received: from [209.85.160.42] ([209.85.160.42:46619] helo=mail-pw0-f42.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 8B/70-31231-88B000E4 for ; Mon, 20 Jun 2011 23:10:01 -0400 Received: by pwi4 with SMTP id 4so349183pwi.29 for ; Mon, 20 Jun 2011 20:09:57 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc:content-type:content-transfer-encoding; bh=2JYsRd6gjl14zhxH2BGLXX98j5hXQoCEeO17uJyGdko=; b=ASvz2GZvCIavwoqccymjUc9EwtlUAXc/UxR911T1EnUdsIC0CXZDOR5N26q9qcaSmk AFIOjtGpcPqmkhJWPidefbCdbtD7uxvA01zWhjOVkmxAfD1WmkmHsN90dpyR55qOJbhp TbtTeXn7SL6AJHk2zZLV15zI1MFcyzeKxLE9Y= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc:content-type:content-transfer-encoding; b=cNrrgZnpA212aiBY2quPzgEtiffs96lx6R2bZoeiwKeWgb8KBpm7QsXfxqiwIPeCYP fHgSr9mibeSqCD0BANauR+muQzGdhuG3kXs6ITYF92zr/jT4eVE+EAXCn0u0uX5AqGL8 Es54F6ePF7be1Pu3ZQvWdZyi+w8ot9xU44Qas= Received: by 10.142.230.9 with SMTP id c9mr1158796wfh.342.1308625797087; Mon, 20 Jun 2011 20:09:57 -0700 (PDT) MIME-Version: 1.0 Received: by 10.142.125.4 with HTTP; Mon, 20 Jun 2011 20:09:37 -0700 (PDT) In-Reply-To: References: <4DFA7EDF.5050802@sugarcrm.com> Date: Tue, 21 Jun 2011 00:09:37 -0300 Message-ID: To: Derick Rethans Cc: Etienne Kneuss , Stas Malyshev , PHP Internals Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Subject: Re: [PHP-DEV] [RFC] 5.4 features for vote (long) From: felipensp@gmail.com (Felipe Pena) 2011/6/20 Derick Rethans > > On Mon, 20 Jun 2011, Felipe Pena wrote: > > > 2011/6/20 Etienne Kneuss > > > > > > I'd love to see the proposal from Felipe about the improved parse > > > errors in that list. I believe that the patch was ready or almost > > > ready? I can't find the RFC though, but maybe the RFC never existed..= . > > > > > > > https://wiki.php.net/rfc/improved-parser-error-message > > I think this is good and helpful. > I've two suggestions though: > > - Add the token name in parenthesis at the end of the string > - Add '' around the token strings > > Examples: > =C2=A0Parse error: syntax error, unexpected '<<=3D' (T_SL_EQUAL) in Comma= nd line code on line 1 > =C2=A0Parse error: syntax error, unexpected '::' (T_PAAMAYIM_NEKUDOTAYIM)= in Command line code on line 1 > =C2=A0Parse error: syntax error, unexpected 'quoted-string' (T_CONSTANT_E= NCAPSED_STRING), expecting identifier or '(' in Command line code on line 1 > To have the quoting message working as desired, we need to implement the yytnamerr function (based in the default one) e.g.: static YYSIZE_T zend_yytnamerr(char *yyres, const char *yystr) { if (!yyres) { return yystrlen(yystr); } =09 if (*yystr =3D=3D '"') { YYSIZE_T yyn =3D 0; char const *yyp =3D yystr; while (1) { if (*++yyp !=3D '"') { yyres[yyn++] =3D *yyp; } else { yyres[yyn] =3D '\0'; =09 return yyn; } } } return yystpcpy (yyres, yystr) - yyres; } I'm ok with this, I just think it's ugly to repeat the token name in the definition in the .y file. :P %token T_LNUMBER "'number' (T_LNUMBER)" %token T_STRING "'identifier' (T_STRING)" $ sapi/cli/php -r 'function 1' Parse error: syntax error, unexpected 'number' (T_LNUMBER), expecting 'identifier' (T_STRING) or '(' in Command line code on line 1 -- Regards, Felipe Pena