Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:66589 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 60649 invoked from network); 11 Mar 2013 14:43:19 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 11 Mar 2013 14:43:19 -0000 Authentication-Results: pb1.pair.com header.from=nikita.ppv@gmail.com; sender-id=pass Authentication-Results: pb1.pair.com smtp.mail=nikita.ppv@gmail.com; spf=pass; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 209.85.214.169 as permitted sender) X-PHP-List-Original-Sender: nikita.ppv@gmail.com X-Host-Fingerprint: 209.85.214.169 mail-ob0-f169.google.com Received: from [209.85.214.169] ([209.85.214.169:51413] helo=mail-ob0-f169.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 2C/91-52104-68DED315 for ; Mon, 11 Mar 2013 09:43:18 -0500 Received: by mail-ob0-f169.google.com with SMTP id ta14so3426912obb.0 for ; Mon, 11 Mar 2013 07:43:15 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:x-received:in-reply-to:references:date:message-id :subject:from:to:cc:content-type; bh=umnOASHgzTeaIwgKREiotjifK6hxFa3szI/vREbR5c8=; b=TAg5catf9hZ4sOs9ws0PE2BxlpnBPzcmNQAVGJDi3Q0BuityiX2VzmSxkyRJINoM9e nVaCjuspm6ZTX5Ag0ykIuhy5V9tFoZZZozxxO4PTHBR3jQo2W91E33/nzzyXycI9LC41 yboXkvfmEyHTlO3YAkqABQKZGF6FEexTZ/YJybexMBqUNSL9rcB2GGi2DpTGemXk4rX7 jO2BPstSmulOUGZo+FCjNPzi4d1eJZ2rRz4/oJlqLRPG4B50vNsMHpwHwCIFZwFiAe4g 40/wRZ6Dydfq1C/NFGyuStYA0RWMowRGoVgVffrQ3SYjz0+000zkKVKBLAQpDkr/9xdq EWgw== MIME-Version: 1.0 X-Received: by 10.60.14.71 with SMTP id n7mr8663838oec.135.1363012995754; Mon, 11 Mar 2013 07:43:15 -0700 (PDT) Received: by 10.182.49.136 with HTTP; Mon, 11 Mar 2013 07:43:15 -0700 (PDT) In-Reply-To: <513DBDD4.3010804@gmail.com> References: <513DBDD4.3010804@gmail.com> Date: Mon, 11 Mar 2013 15:43:15 +0100 Message-ID: To: Eric James Michael Ritz Cc: PHP internals Content-Type: multipart/alternative; boundary=e89a8f2353bf6fb0c604d7a731e8 Subject: Re: [PHP-DEV] Double-Colon Always Follows the 'parent' Keyword? From: nikita.ppv@gmail.com (Nikita Popov) --e89a8f2353bf6fb0c604d7a731e8 Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: quoted-printable On Mon, Mar 11, 2013 at 12:19 PM, Eric James Michael Ritz < lobbyjones@gmail.com> wrote: > Hello everyone, > > I have a question about the internals of PHP, but this is not about > advancing the development of the language, so I apologize if this is > on the wrong list. I am choosing to post to this list because I > believe the people here are most qualified to answer my question. > > This is what I want to know: Is there any valid situation in PHP where > the =91parent=92 keyword is not followed by the scope-resolution operator= ? > I am asking to help me decide on the best way to fix a bug for > php-mode[1] for GNU Emacs. Consider these three lines: > > echo $parent; > echo parent::$foo; > echo $this->parent; > > Emacs correctly highlights the first =91parent=92 as a variable name. It > also highlights =91parent=92 in the second line as a keyword, as it > should. But in the third line it treats =91parent=92 as a keyword instea= d > of a variable and applies the wrong syntax formatting. > > My idea to fix this problem is to only treat =91parent=92 as a keyword if > the scope-resolution operator immediately follows it. But before > doing that I want to know whether or not that is true. So is there > are valid situation where the keyword =91parent=92 does not have =91::=92 > after it? > > Thank you in advanced for any advice and help. > parent and self are not keywords, they are just special class names. Apart from that they can be freely used, e.g. you could also have a constant called "parent". The special meaning exists in (nearly) any classname context. parent::$foo is just one case. It's just as special if you do new parent() or something like that ;) So I don't think it makes sense to highlight only when followed by :: Nikita --e89a8f2353bf6fb0c604d7a731e8--