PEAR is archived and read-only

This mirror preserves historical PEAR package releases and metadata so existing references remain available.

Home » PHP » PHP_Parser

A PHP Grammar Parser

This package is unmaintained.

Download latest release 0.2.2 (archived versions might be outdated)

License: PHP License

Description

PHP_Parser is a source code analysis tool based around a real Parser
generated by PHP_ParserGenerator. The parser uses the same EBNF source that PHP
uses to parse itself, modified for Lemon parser format, and it therefore as robust
as PHP itself.

This version has full support for parsing out every re-usable element
in PHP as of PHP 6:
- classes
- abstract classes
- inheritance, implements
- interfaces
- methods
- any thrown or caught exception
- static variables declared
- global and superglobal ($_GET) variables used
and declared
- any class names used in any context
- any functions called
- any $this->var or class::$var
- any $this->method or class::method() or class::$method()
- variables
- constants
- functions (same information as methods minus $this->/self::/parent:: information)
- defines
- global variables (with help of PHP_Parser_DocblockParser)
- superglobal variables used in global code
- include statements

The output can be customized to return an array, return
objects of user-specified classes, and can also be
customized to publish each element as it is parsed, allowing
hooks into parsing to catch information.

Maintainers

Dependencies

Required

Optional

Releases

Bugs

IDStatusTypeVersionDateSummary
#4148ClosedBug2005-04-14debug statement in Parser/Core.php
#4305ClosedBug2005-05-08PHP5 tokens not handled
#5115ClosedBug2005-08-16Visibility modifiers in method declaration throws parse error
#5461ClosedBug2005-09-19Warning on Tokenizer.php line 453 with PHP 5.1RC1
#11174ClosedBug0.2.02007-05-29Parser.php installed to root of PEAR directory
#11316OpenReq0.2.02007-06-14'doc' will set null when an doc-comment placed before the declaretion
#13092VerifiedBug0.2.12008-02-09$lastcom undefined in Core.y line 1085
#13224ClosedBug0.2.12008-02-26Bad XML Tags in Tutorial Source
#13998OpenBug0.2.12008-05-27Parser tries to parse pass '__halt_compiler()' directive
#14881DuplicateBugCVS2008-10-26Notice: Undefined variable: lastcom
#17671ClosedBugSVN2010-08-08The PHP_Parser_CoreyyToken bad __toString method
#19980OpenBug2013-06-17missing deps