Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:53540 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 81800 invoked from network); 23 Jun 2011 18:09:24 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 23 Jun 2011 18:09:24 -0000 Authentication-Results: pb1.pair.com smtp.mail=felipensp@gmail.com; spf=pass; sender-id=pass Authentication-Results: pb1.pair.com header.from=felipensp@gmail.com; sender-id=pass; domainkeys=bad 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:34180] helo=mail-pw0-f42.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id C1/E0-09437-351830E4 for ; Thu, 23 Jun 2011 14:09:23 -0400 Received: by pwi4 with SMTP id 4so1451154pwi.29 for ; Thu, 23 Jun 2011 11:09:20 -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; bh=xepqF9+k2n/8UfEIjnexQGXLaZRgh6U296qAWmvP59I=; b=CMstWArmdm0e/jCjI3e4yMNJ60l5+SqeealxG6GG3mzzadx34+nTHcJ0AOgwPWV9Uh LhFjIus1lVxYvq8Af40K0wnXbzg6tHywzMugwbHTOJSLI+/0TWzO2/ON3htNrJ/1bRWo TYl/34uCiVPK+b/X8bHokdtC5cpbf3CNTRA6s= 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; b=iAP1TBzXUdWcEyYxD5eTOv/whXrf6FUj+1W25+f8IzyHs0QhAcThcPJVZp4wWXKf92 5nIPGUwsPXgEfZpaH12Pfkk6cnh2RuquI3+8pglVu+99TFWK9um8FGjtyrnHF1s4UhsJ L+bDpINg1zTqbMJtMrTHcECImZgBQVvs/8Ogc= Received: by 10.143.20.35 with SMTP id x35mr608155wfi.114.1308852559126; Thu, 23 Jun 2011 11:09:19 -0700 (PDT) MIME-Version: 1.0 Received: by 10.142.125.4 with HTTP; Thu, 23 Jun 2011 11:08:59 -0700 (PDT) In-Reply-To: References: <887FE7CFF6F8DE4BB3A9535F53AFD06A492D09D2@il-ex2.zend.net> <4DD2A731.9000400@sugarcrm.com> Date: Thu, 23 Jun 2011 15:08:59 -0300 Message-ID: To: Gustavo Lopes Cc: internals@lists.php.net Content-Type: text/plain; charset=UTF-8 Subject: Re: [PHP-DEV] Re: [RFC] Improved parser error message From: felipensp@gmail.com (Felipe Pena) 2011/5/18 Gustavo Lopes : > Em Tue, 17 May 2011 17:49:53 +0100, Stas Malyshev > escreveu: > >> I think we need to keep token name in the message, since it makes it >> easier to understand what parser expected if you need to debug the parser >> (as opposed to your code). So I think we need to have both the >> human-readable name and the token name, as Andi suggested. > > I think this alternative has very little value for debugging the parser. > There are no repeated labels for the tokens, so even if you don't know the > token name by heart, you can look it up in 10 seconds. > > Keeping the token name will only perpetuate the confusion it has caused. I > think it ought to be dropped, but if no consensus can be reached, this would > be better than the status quo. > > -- > Gustavo Lopes > > -- > PHP Internals - PHP Runtime Development Mailing List > To unsubscribe, visit: http://www.php.net/unsub.php > > So, following some suggestion I made a patch wich displays such messages: $ sapi/cli/php -r 'class ' Current: Parse error: syntax error, unexpected $end, expecting T_STRING Patched: Parse error: syntax error, unexpected end of file, expecting 'identifier' (T_STRING) $ sapi/cli/php -r 'class abc foo' Current: Parse error: syntax error, unexpected T_STRING, expecting '{' in Command line code on line 1 Patched: Parse error: syntax error, unexpected 'foo' (T_STRING), expecting '{' in Command line code on line 1 As can be noticed, I added the actual scanned string in the "unexpected" part. This might be useful for finding really which makes the parser error. (It was a bit tricky though :D) Any thoughts? https://wiki.php.net/rfc/improved-parser-error-message -- Regards, Felipe Pena