php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #61070 How to distinguish tokenizer T_USE for namespace and 'use' in anonymous func ?
Submitted: 2012-02-13 13:49 UTC Modified: 2012-02-13 17:12 UTC
From: thomas dot lecarpentier+bugphp at gmail dot com Assigned:
Status: Not a bug Package: *General Issues
PHP Version: Irrelevant OS: Linux
Private report: No CVE-ID: None
 [2012-02-13 13:49 UTC] thomas dot lecarpentier+bugphp at gmail dot com
Description:
------------
if I have an anonymous function with 'use' keyword (describe in page : http://fr2.php.net/manual/en/functions.anonymous.php ) , but with the tokenizer (token_get_all() : http://fr2.php.net/manual/en/function.token-get-all.php ) find and T_USE token, but the rest of line is not a namespace.

How can I distinguish the 2 use cases ?




Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2012-02-13 17:12 UTC] nikic@php.net
This is not a PHP bug. That's pretty much what lexical tokens are good for, so they can be reused.

You have to determine what the token means from the context. Alternatively you can use a PHP parser which will do this for you.
 [2012-02-13 17:12 UTC] nikic@php.net
-Status: Open +Status: Not a bug
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Mon May 06 09:01:30 2024 UTC