Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:90679 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 72858 invoked from network); 17 Jan 2016 04:23:46 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 17 Jan 2016 04:23:46 -0000 Authentication-Results: pb1.pair.com header.from=php@golemon.com; sender-id=softfail Authentication-Results: pb1.pair.com smtp.mail=php@golemon.com; spf=softfail; sender-id=softfail Received-SPF: softfail (pb1.pair.com: domain golemon.com does not designate 209.85.215.53 as permitted sender) X-PHP-List-Original-Sender: php@golemon.com X-Host-Fingerprint: 209.85.215.53 mail-lf0-f53.google.com Received: from [209.85.215.53] ([209.85.215.53:34498] helo=mail-lf0-f53.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id FB/67-32157-1571B965 for ; Sat, 16 Jan 2016 23:23:46 -0500 Received: by mail-lf0-f53.google.com with SMTP id 17so100576298lfz.1 for ; Sat, 16 Jan 2016 20:23:45 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=golemon-com.20150623.gappssmtp.com; s=20150623; h=mime-version:sender:in-reply-to:references:date:message-id:subject :from:to:cc:content-type; bh=RRJwAjaKBJZHXvqQMdkJwFAaY0BGBlURBeGj4//bPSU=; b=Z883FAKLlinUXPwsSZl6WLOl3BmROBdmZA00mvf8hbytkvhe5RbsRs1iaRUY4Af642 4JQe39tW3++1CnZz3ZwijApiTnFV1K4k+6MktD3hQ/rX8oM9UKlEKi3dqn+S9lIIsmIp eXlLuTPRjuZOe3qEzGQlkV5l1f425TbYkshntwSmIL1/5V7MQdPAFdKjRxGIgDO7WGx1 SNfs2v4YrhtSkrEag8FbJew1c6VJToWtwpUeKctBCqPQDD1f11tk5IRUiU/oI6Cfm7y0 5QBn59hdUVkUQUmnOhRigYuPlY9GsLPB3njOe6mv1V6ZWgF4Dqpk5t5lSGIyNzRZkFtd RulA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:sender:in-reply-to:references:date :message-id:subject:from:to:cc:content-type; bh=RRJwAjaKBJZHXvqQMdkJwFAaY0BGBlURBeGj4//bPSU=; b=ghy9LfJzXuOG7cSErM2lz7LXqXrQfRYVde+QyW8eJ5smpgANJ4PinNZDuUSIY51c+l +cMxSdQyDxIGeR9f6PRVfNaoOOV8wN49fkFu1MyHnpEL6td6vPL0jHPeTQSjHWabaThQ w1f6OHqatMDFEgUi5VYnEr5sSPg+3MHgl765XkKK53L/ajfWyZOSK7yFgiZzl4Y8kSeE +soLZowQ3mpp+9SAE89uNjG94fp0hY8WvfsqN+79cPBsZGZcUCl2H1OodEEhcSM4a3O0 F07T1tqm2jGK5qJij6TLXF0RG7Dkvnn9/s0/LmRpInOrLmHo8h/PBkQ2xzTLSy7iV5Uj gPGQ== X-Gm-Message-State: ALoCoQmotnVQNibbtsbjI3hs9oNgbIsN41jixtPlFYJD7u8GP0KmXyjixEHhqfYSrdNXPogM+ldBpMQzDbxT1lvDJmpeVD22gA== MIME-Version: 1.0 X-Received: by 10.25.17.89 with SMTP id g86mr5060227lfi.82.1453004621725; Sat, 16 Jan 2016 20:23:41 -0800 (PST) Sender: php@golemon.com Received: by 10.112.37.44 with HTTP; Sat, 16 Jan 2016 20:23:41 -0800 (PST) X-Originating-IP: [2620:10d:c090:180::38b1] In-Reply-To: <3F.20.05337.CEE68965@pb1.pair.com> References: <77.F6.12097.81D2C865@pb1.pair.com> <3F.20.05337.CEE68965@pb1.pair.com> Date: Sat, 16 Jan 2016 20:23:41 -0800 X-Google-Sender-Auth: U6gKKnNyWh1LBg6kRGPxKqF0R08 Message-ID: To: Andrea Faulds Cc: PHP internals Content-Type: text/plain; charset=UTF-8 Subject: Re: [PHP-DEV] Re: [RFC] Normalize token_get_all() output (with flag) From: pollita@php.net (Sara Golemon) On Thu, Jan 14, 2016 at 7:59 PM, Andrea Faulds wrote: >> 2. Make a new extension to prototype this PhpToken class outside of >> the php-src tree, add all the extra goodies we want (array of token >> return, iterator of token return, extra info, limited info, etc...) >> 3. When this extension is good and solid, propose merging into core. >> >> I had reserved the github.com/phplang project for the specification, >> but didn't end up using it. We can share a repo there if you'd like. > > > Like Stas, I think this sounds good. I might even look over what's created, > if I find the time. > > Regarding arrays versus iterators, you can create the former from the > latter, but not the other way around. I'd go for just having an iterator and > no array.. It maps better to how PHP actually works, anyway. > > But enough discussion here, I shall await your git repository... > Okay, i've got a starting point up at https://github.com/phplang/php-token . It's basically just token_get_all() and token_name() as they currently stand (I didn't even bother overriding the behavior in token_name() yet). I did change some of the codeflow layout a bit (and add support for scanning files in the process), but that's it. Unfortunately... I realized a few issues with my plans to add support for callbacks and iterators... The tokenizer uses a global state that is REALLY easy to invalidate, so once we allow userspace code to resume, we're going to have to be careful about how we preserve/restore/guard the tokenizer's state. This is usually not an issue since there are no scanner callbacks in PHP currently. I've added TazeTSchnitzel(Andrea), smalyshev(Stas), and nikic(Nikita) to the ACL so far. Poke me here or on twitter with your github id if you're interested in contributing... -Sara