Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:72442 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 59646 invoked from network); 10 Feb 2014 15:39:07 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 10 Feb 2014 15:39:07 -0000 Authentication-Results: pb1.pair.com smtp.mail=julienpauli@gmail.com; spf=pass; sender-id=pass Authentication-Results: pb1.pair.com header.from=julienpauli@gmail.com; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 209.85.220.179 as permitted sender) X-PHP-List-Original-Sender: julienpauli@gmail.com X-Host-Fingerprint: 209.85.220.179 mail-vc0-f179.google.com Received: from [209.85.220.179] ([209.85.220.179:33499] helo=mail-vc0-f179.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id CC/60-57220-892F8F25 for ; Mon, 10 Feb 2014 10:39:05 -0500 Received: by mail-vc0-f179.google.com with SMTP id lh14so4980313vcb.10 for ; Mon, 10 Feb 2014 07:39:01 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:sender:in-reply-to:references:from:date:message-id :subject:to:cc:content-type; bh=fFOvlbpDJGWogqOd/I/bHkgyVM1R29ZhlVrklrpkh2k=; b=qAM0G6K0SM0HCNpyCZL6iU0a83Z3YTJ6fH1CK9umuc0SIRQ1s2chRCf75PahN0ilPD Lpecht+wPar+acidik8UA0wDp/pjNw8YToZXcSADMVFEjjLDiW1OXKHjNRIctrXlx4C5 ZfTUjADhGmz8X00uq6X5Sky8mt8Lk7tVehmLWFsL9ii6McZKzzPmK6FzdoB9VR58Ki9x yr+yB3QiMRYzEXThi778XkZ1ccwcp/SqWJk3FvdubhVt5nQn86BpJ1pfxbWeYT3Ww+Bx VQCMGFANUqqcL6Cy0EoA540BifXeLg2QQ2PkzqK9tHtcGf39hyo449LgrLvax0487ykb hmDg== X-Received: by 10.52.90.1 with SMTP id bs1mr83931vdb.56.1392046741249; Mon, 10 Feb 2014 07:39:01 -0800 (PST) MIME-Version: 1.0 Sender: julienpauli@gmail.com Received: by 10.221.8.129 with HTTP; Mon, 10 Feb 2014 07:38:21 -0800 (PST) In-Reply-To: References: Date: Mon, 10 Feb 2014 16:38:21 +0100 X-Google-Sender-Auth: LtHg99t1Jxs6GdB3z9q0kt-Z3_Y Message-ID: To: Nikita Popov Cc: PHP Internals Content-Type: text/plain; charset=ISO-8859-1 Subject: Re: [PHP-DEV] token_get_all() new API From: jpauli@php.net (Julien Pauli) On Mon, Feb 10, 2014 at 4:29 PM, Nikita Popov wrote: > On Mon, Feb 10, 2014 at 3:54 PM, Julien Pauli wrote: >> >> Hi all, >> >> I recently worked on token_get_all() implementation to add an extra >> argument to the function to show token names directly in the output >> instead of having to call token_name() on every output (usually what >> is done nowadays). >> >> I also added a flag so that the parsed scanner value can become >> optionnal in the output, as sometimes one just wants a token stream >> and is not interested in dealing with the scanner ouput. >> >> If you have ideas or thoughts ? >> >> https://github.com/jpauli/php-src/compare/token_names >> >> Julien.P > > > Do you have some examples for practical uses of these modes? E.g. in what > situation would you need only the token names, but not their content? Well, having a token stream. T_A + T_B + T_C = something , I don't care about those ';' and '}'. They make parsing the array output of token_get_all() harder :-p > > What I don't like about this change is that it introduces an additional > llist indirection, which presumably will have the function slower and more > memory heavy. Yes, I could use HashTable directly, that's a detail and can be patched very quickly :-) Julien