Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:84455 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 88482 invoked from network); 9 Mar 2015 05:48:12 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 9 Mar 2015 05:48:12 -0000 Authentication-Results: pb1.pair.com header.from=marcio.web2@gmail.com; sender-id=pass Authentication-Results: pb1.pair.com smtp.mail=marcio.web2@gmail.com; spf=pass; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 209.85.215.53 as permitted sender) X-PHP-List-Original-Sender: marcio.web2@gmail.com X-Host-Fingerprint: 209.85.215.53 mail-la0-f53.google.com Received: from [209.85.215.53] ([209.85.215.53:33889] helo=mail-la0-f53.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 33/01-14455-A143DF45 for ; Mon, 09 Mar 2015 00:48:11 -0500 Received: by labhs14 with SMTP id hs14so68579819lab.1 for ; Sun, 08 Mar 2015 22:48:08 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:reply-to:in-reply-to:references:from:date:message-id :subject:to:cc:content-type; bh=wBqS1dq8xmgUIFWJUzBmTVg6Q1r1zosuI1PyKCs2ulc=; b=nUZGsXUvkz2ZemEoMLIYxZnTxN1iZsLA8Et68lKlwYYzTHxe+T/pcnsjTHnl5Vo66r CEP+ZkWkE0x1FP2bLYwjtTepAq9SGSAcz7rtYy4Jz2qE1DPSAyS+Ga4xhs8p8P9LDmMj 1P7t9Wt9gwHoOaxa9oVqUMv+V6MvBkbhPHN5HzqZn5z2by4n0/Mc7WGeYz9Q+3uDRGJ7 llPuBG/o8IbjCUI8GLhXl6FsjbkAJNPTLMkVFOeo3sAEriL+ADxXRDeXyzb1ZZKmgnOh ZmIJNhIOOtHthen4+c8pk9eb+QwTQ3NFfetDl0vcUwu2jE+dWPxCm4a7MTx8VRqfqyIW B4kA== X-Received: by 10.152.178.197 with SMTP id da5mr24605515lac.56.1425880088020; Sun, 08 Mar 2015 22:48:08 -0700 (PDT) MIME-Version: 1.0 Received: by 10.152.118.193 with HTTP; Sun, 8 Mar 2015 22:47:47 -0700 (PDT) Reply-To: marcio3w@gmail.com In-Reply-To: References: Date: Mon, 9 Mar 2015 02:47:47 -0300 Message-ID: To: Marcio Almada Cc: PHP internals Content-Type: multipart/alternative; boundary=001a11340c68238e250510d4944c Subject: Re: [PHP-DEV][RFC][VOTING] Context Sensitive Lexer From: marcio.web2@gmail.com (Marcio Almada) --001a11340c68238e250510d4944c Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Hi, Just passing by to announce I already have a working version of the new patch: https://github.com/php/php-src/pull/1158 The patch is 100% compatible with the proposed one with the advantages: - Has no regression or forward compatibility risks and is highly predictable - Has an very small footprint compared to the previous attempt involving a pure lexical approach - Is highly configurable, to make a word semi-reserved you only have to edit a single inclusive list in a parser rule. - Requires a single compile time check More than ever, I'd like to advice voters to vote for the feature as the new implementation is already on it's way. There still some work to be done, please refer to the task list on the pull request to see what still needs to be done. It would be nice to have the new patch reviewed too. Thanks, M=C3=A1rcio 2015-03-04 14:29 GMT-03:00 Marcio Almada : > Hi > > 2015-03-04 5:52 GMT-03:00 Nikita Popov : > >> >> After reviewing the implementation, I've decided to vote "no" on this RF= C. >> >> I had originally assumed that if this proposal is limited to method name= s >> and class constants only the implementation should be pretty simple and >> robust. However it turned out that there are a number of complications, = the >> two primary ones being: >> >> a) We allow to define multiple class constants in one declaration. I.e. >> you can write not only >> >> const FOO =3D 42; >> >> but also >> >> const FOO =3D 42, BAR =3D 24, BAZ =3D 0; >> >> This is further complicated by the fact that we allow many types of >> (static scalar) expressions to be used as values for constants, so a >> declaration might actually look like >> >> const FOO =3D 42, BAR =3D [24, BAZ]; >> >> as well. >> >> b) The trait adaptations syntax allows using method names without a >> generic prefix like "::" or "->" in a number of ways. E.g. in >> >> use A { A::foo as bar; } >> >> foo and bar are method names. On the other hand in >> >> use A { A::foo as public; } >> >> the "public" is not a method name, it is used for trait method visibilit= y >> aliasing. Trait aliasing (but not precedence!) adaptations also allow >> non-absolute method references on the left hand side, so >> >> use A { foo as bar; } >> >> without the leading A:: is possible as well. >> >> In order to support these kinds of things, the lexer has to track a bunc= h >> of state (e.g. to know if we're currently in a trait adaptation list as >> opposed to a namespace or closure "use" list) and also make extensive us= e >> of lexer lookahead. We also have to accurately track nesting of braces, >> which is easy to get wrong when considering details like string >> interpolation syntax. >> >> After a number of issues was fixed by Marcio, the patch still contains a >> few lexer rules that I don't really understand, but which seem to be >> required to avoid regressions in some edge case. >> >> So, tl;dr: I think the patch is too risky. Even if we can make sure that >> we've covered all the current edge-cases and don't regress anything, I'm >> afraid that this will cause complications with future changes. This ends= up >> replicating too many parsing aspects in the lexer in a rather ad-hoc man= ner. >> >> Nikita >> > > --001a11340c68238e250510d4944c--