Re: [PHP-DEV] [RFC] Normalize token_get_all() output (with flag)

2016-01-06 Thread Sara Golemon
On Wed, Jan 6, 2016 at 1:43 AM, Nikita Popov wrote: > Basically: token_get_all() is rather slow. I think it says something that > getting the tokens of a script is about as slow as lexing it, parsing it > into an internal AST and constructing an object-based userland AST for it. > If you use token

Re: [PHP-DEV] [RFC] Normalize token_get_all() output (with flag)

2016-01-06 Thread Sara Golemon
On Wed, Jan 6, 2016 at 1:43 AM, Nikita Popov wrote: > On Tue, Jan 5, 2016 at 8:45 PM, Sara Golemon wrote: >> Maybe TOKEN_ASSOC? Since it provides associative array elements (as >> opposed to the current indexed array behavior) > > I like that one. > Have updated the RFC accordingly. I've also ren

Re: [PHP-DEV] [RFC] Normalize token_get_all() output (with flag)

2016-01-06 Thread Nikita Popov
On Tue, Jan 5, 2016 at 8:45 PM, Sara Golemon wrote: > On Tue, Jan 5, 2016 at 6:16 AM, Nikita Popov wrote: > > Would be nice if someone could come up with a more explicit name for the > > flag. TOKEN_FULL is not obvious, at least to me. TOKEN_ALWAYS_ARRAY? > > > Yeah, I'm not a huge fan of the na

Re: [PHP-DEV] [RFC] Normalize token_get_all() output (with flag)

2016-01-05 Thread Sara Golemon
On Tue, Jan 5, 2016 at 6:16 AM, Nikita Popov wrote: > Would be nice if someone could come up with a more explicit name for the > flag. TOKEN_FULL is not obvious, at least to me. TOKEN_ALWAYS_ARRAY? > Yeah, I'm not a huge fan of the name either, but I couldn't come up with anything better at the ti

Re: [PHP-DEV] [RFC] Normalize token_get_all() output (with flag)

2016-01-05 Thread Nikita Popov
On Mon, Jan 4, 2016 at 11:56 PM, Sara Golemon wrote: > I swear, 2016 isn't going to be "An RFC per day" year, but... > > https://wiki.php.net/rfc/token-get-always-tokens > > This should be pretty non-controversial. I hope? > > +1 Would be nice if someone could come up with a more explicit name

Re: [PHP-DEV] [RFC] Normalize token_get_all() output (with flag)

2016-01-04 Thread Marcio Almada
Total +1. I wanted to propose that, without the flag, but it got too late for the PHP7 BC breaking season. Adding a flag seems to be a better idea :P 2016-01-04 18:56 GMT-04:00 Sara Golemon : > I swear, 2016 isn't going to be "An RFC per day" year, but... > > https://wiki.php.net/rfc/token-get-alw

Re: [PHP-DEV] [RFC] Normalize token_get_all() output (with flag)

2016-01-04 Thread Sara Golemon
On Mon, Jan 4, 2016 at 7:38 PM, Stanislav Malyshev wrote: >> Do you mean have users of the API do that? Or have the implementation >> of token_name() do that? Because the latter doesn't seem unreasonable >> at all. > > I meant for token_name() to do that internally, so that the user can use > jus

Re: [PHP-DEV] [RFC] Normalize token_get_all() output (with flag)

2016-01-04 Thread Stanislav Malyshev
Hi! >> We could, of course, do something like >> $token[0]<=255?$token[0]:token_name($token[0]) - but that looks hacky. >> > Do you mean have users of the API do that? Or have the implementation > of token_name() do that? Because the latter doesn't seem unreasonable > at all. I meant for token_n

Re: [PHP-DEV] [RFC] Normalize token_get_all() output (with flag)

2016-01-04 Thread Sara Golemon
On Mon, Jan 4, 2016 at 4:21 PM, Stanislav Malyshev wrote: > I think it's a great idea, token_get_all() is annoying > to deal with. We'd have to fix token_name though so that this would > still work: > Ah, excellent point! > We could, of course, do something like > $token[0]<=255?$token[0]:token_n

Re: [PHP-DEV] [RFC] Normalize token_get_all() output (with flag)

2016-01-04 Thread Stanislav Malyshev
Hi! > https://wiki.php.net/rfc/token-get-always-tokens > > This should be pretty non-controversial. I hope? No way! Just kidding :) I think it's a great idea, token_get_all() is annoying to deal with. We'd have to fix token_name though so that this would still work: foreach ($tokens as $token)