I tried to call pfff - parse_php ./bin/ebnf with this file https://github.com/Weltraumschaf/ebnf/blob/master/bin/ebnf. It seems that the parse can't habdle PHPs namespace statement:
pfff -parse_php bin/ebnf
(ONCE) LEXER:unrecognised symbol, in token rule:\
= File "bin/ebnf", line 21, column 10, charpos = 796
around = 'de', whole content = namespace de\weltraumschaf\ebnf;
bad: #!/usr/bin/env php
bad: * This program is free software: you can redistribute it and/or modify
bad: * it under the terms of the GNU General Public License as published by
bad: * the Free Software Foundation, either version 3 of the License, or
bad: * (at your option) any later version.
bad: * This program is distributed in the hope that it will be useful,
bad: * but WITHOUT ANY WARRANTY; without even the implied warranty of
bad: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
bad: * GNU General Public License for more details.
bad: * You should have received a copy of the GNU General Public License
bad: * along with this program. If not, see <http://www.gnu.org/licenses/>.
bad: * @author Vincent Tscherter <email@example.com>
bad: * @author Sven Strittmatter <firstname.lastname@example.org>
BAD:!!!!! namespace de\weltraumschaf\ebnf;
bad: use \Exception as Exception;
bad: require_once dirname(__DIR__) . "/src/Command.php";
bad: exit(Command::main(getopt("s:f:o:hd"), basename(__FILE__)));
NB total files = 1; perfect = 0; =========> 0%
nb good = 0, nb bad = 27 =========> 0.000000%
yes, there is no support for namespace yet ... we don't use them at facebook so I never bothered to implement it.
I'll try to port it this week.
any update here? failing for me as well.
I'd also appreciate support for namespaces
hello @aryx any plans to implement support for namespaces? I believe w/o namespaces support it is useless for anyone using PHP 5.3+
we don't use namespaces at facebook so this is unfortunately not on my priority list ... I might implement it once I have a little bit of free time, but lately I've been very busy ...
Could you maybe give some pointers to where the code would need to be added?
It's a bit sad that pfff doen't used more often due to this.
the parser for PHP is in lang_php/parsing/parser_php.mly and the lexer in lang_php/parsing/lexer_php.mll
+1 for namespace support. Otherwise this project will be useless very soon...
I have a few commits almost ready to support namespace. Should be available by the end of this week.
Really looking forward to this. Almost every new PHP project I've seen in the past year is using namespaces.
The Namespace supports seems to work for me, however, not with the following notation:
use Behat\Gherkin\Node\TableNode as TableNode,
Behat\Mink\Exception\ElementNotFoundException as ElementNotFoundException;
1 / 1parse error
= File "admin/tests/behat/behat_admin.php", line 31, column 45, charpos = 1179
around = ',', whole content = use Behat\Gherkin\Node\TableNode as TableNode,
The first issue is fixed. See 606ca18
The last error is fixed by b3ae7d0