tsufeki/php-lenient-parser
Composer 安装命令:
composer require tsufeki/php-lenient-parser
包简介
A PHP parser written in PHP, handles partial/illegal input
README 文档
README
This is a PHP 7 parser written in PHP. It handles some partial and illegal code, producing best-effort partial syntax tree. Its purpose is to simplify static code analysis and manipulation.
It's error reporting is not complete though, i.e. it may silently accept illegal PHP input.
As this is just a parser replacement for PHP Parser, go there for actual documentation.
Installation
The preferred installation method is composer:
php composer.phar require tsufeki/php-lenient-parser
Usage
Use the factory to get an instance of parser:
$parser = (new LenientParserFactory())->create();
Or provide your own lexer and options (no options are supported at the moment though):
$parser = (new LenientParserFactory())->create(LenientParserFactory::ONLY_PHP7, $lexer, $options);
Created parser is a drop-in replacement for php-parser.
Do not instantiate LenientParser directly, use the factory.
Info
At the moment parsing of PHP 5 is not supported, only PHP 7.
Internally, the parser is implemented as a Pratt parser (also called "Top down operator precedence parser").
License
Same as php-parser, BSD - see LICENCE.
Test suite and CLI script (below bin/, test/ and test_old/) are borrowed
from php-parser and modified.
统计信息
- 总下载量: 2.18k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 1
- 点击次数: 3
- 依赖项目数: 1
- 推荐数: 0
其他信息
- 授权协议: BSD-3-Clause
- 更新时间: 2016-06-19