Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:98610 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 32828 invoked from network); 23 Mar 2017 17:16:35 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 23 Mar 2017 17:16:35 -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 74.125.82.52 as permitted sender) X-PHP-List-Original-Sender: nikita.ppv@gmail.com X-Host-Fingerprint: 74.125.82.52 mail-wm0-f52.google.com Received: from [74.125.82.52] ([74.125.82.52:35421] helo=mail-wm0-f52.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 38/71-03150-2F204D85 for ; Thu, 23 Mar 2017 12:16:35 -0500 Received: by mail-wm0-f52.google.com with SMTP id u132so67220356wmg.0 for ; Thu, 23 Mar 2017 10:16:34 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:from:date:message-id:subject:to; bh=YbPjMuqaT1D+2A29DEn5lHs/Hev3lTS3LvVdUxxtc1U=; b=iq7RAoeru8x6hvHQGJZssc7TGXQR7YPllGQz2HuYHcJJfvouYECu/SpEU0WZRM2SPt 8fWNJs/pKp9ZHvJP3QH4j5LytA/SSiDcZL/wlg9QbG0j1CU4n5PuRjw2oO1qGc139FVB XwS7qDAoPiDcdKtY6CMvj5hAsX8Bj4WYDbmx0ISSA4AzDcxMzYuTtqpxq8PCnCnyeOd8 iSgh8C6cuAWsHlt/Ww/pkQgPX4Gzyn1yD6F8HfKgJ3C9nxID00VRa1WC2vM7d/nGh2m7 gpTZx7HlsQnZv07wtVMZR3kNbBNOscDuBJQBhU+jLlFb2jGrb0YMBPCnvRi3fuXPuWi4 XIsw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:from:date:message-id:subject:to; bh=YbPjMuqaT1D+2A29DEn5lHs/Hev3lTS3LvVdUxxtc1U=; b=aM53twC3H7S2SZRZbotEZALMFnnT+kvq6KXnhcOH7n2m/RDyUUJQUkEfXM0J41fjZl QBxidkXGP5IT+2fzTVTmf3vIKbBfj75HM9z31N6js7dExmO7z8znDOt2kkMmZmm1sHzz ZGqHilUomBC2YdXOdAm06LzU8NdXs/TWmQfOFW4j3m0DqUiMt/I2PbQrFTJREnMqM9en tKdLmel9xhQFOpPULLiYM51UCpqzC/qe/3Cm4Y/gbIucz4mH70TcJ19iTG+e6D3As4nf 4GdjAiLSpHBlpOvtk6prV+OXtVao8n9NFXiMdUt85xA1irQ3rmUCBg06k9MQQLynx2o1 zVxw== X-Gm-Message-State: AFeK/H3TZ3zkdw8riUEja7JYl/eWifh8K3xHECU/noGQ0vaVx5C8YDlRPOIUruhwSVObfPN+CjLRVCgYOhFQrQ== X-Received: by 10.28.87.138 with SMTP id l132mr14506051wmb.95.1490289391754; Thu, 23 Mar 2017 10:16:31 -0700 (PDT) MIME-Version: 1.0 Received: by 10.223.170.216 with HTTP; Thu, 23 Mar 2017 10:16:31 -0700 (PDT) Date: Thu, 23 Mar 2017 18:16:31 +0100 Message-ID: To: PHP internals Content-Type: multipart/alternative; boundary=001a11444cb8cee222054b6909f0 Subject: TOKEN_AS_OBJECT for token_get_all() From: nikita.ppv@gmail.com (Nikita Popov) --001a11444cb8cee222054b6909f0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Hi internals, I'd like to add a new TOKEN_AS_OBJECT flag to token_get_all(), which returns an array of PhpToken objects, rather than the mix of plain strings and arrays we currently have. The PhpToken class is defined as: class PhpToken { public $type; public $text; public $line; } This has been previously suggested and implemented by Rouven We=C3=9Fling [= 1], I've just ported this feature to master and optimized the implementation [2]. Apart from being a nicer interface than the current format, an additional advantage is that the TOKEN_AS_OBJECT mode uses about 1.8x less memory and is 1.4x times faster. Are there any objections to this change? Regards, Nikita [1]: https://github.com/php/php-src/pull/1727 [2]: https://github.com/php/php-src/pull/2430 --001a11444cb8cee222054b6909f0--