1
0
mirror of https://github.com/danog/PHP-Parser.git synced 2024-11-30 04:19:30 +01:00

PHP-Parser supports PHP 5.5

This commit is contained in:
nikic 2013-04-15 20:56:45 +02:00
parent 08f0cde6f9
commit 8e686ce7a7
3 changed files with 7 additions and 7 deletions

View File

@ -1,7 +1,7 @@
PHP Parser
==========
This is a PHP 5.4 (and older) parser written in PHP. It's purpose is to simplify static code analysis and
This is a PHP 5.5 (and older) parser written in PHP. It's purpose is to simplify static code analysis and
manipulation.
Documentation can be found in the [`doc/`][1] directory.

View File

@ -1,7 +1,7 @@
Introduction
============
This project is a PHP 5.4 (and older) parser **written in PHP itself**.
This project is a PHP 5.5 (and older) parser **written in PHP itself**.
What is this for?
-----------------
@ -26,12 +26,12 @@ programmatic PHP code analysis are incidentally PHP developers, not C developers
What can it parse?
------------------
The parser uses a PHP 5.4 compliant grammar, which is backwards compatible with at least PHP 5.3 and PHP
5.2 (and maybe older).
The parser uses a PHP 5.5 compliant grammar, which is backwards compatible with at least PHP 5.4, PHP 5.3
and PHP 5.2 (and maybe older).
As the parser is based on the tokens returned by `token_get_all` (which is only able to lex the PHP
version it runs on), additionally a wrapper for emulating new tokens from 5.3 and 5.4 is provided. This
allows to parse PHP 5.4 source code running on PHP 5.2, for example. This emulation is very hacky and not
version it runs on), additionally a wrapper for emulating new tokens from 5.3, 5.4 and 5.5 is provided. This
allows to parse PHP 5.5 source code running on PHP 5.2, for example. This emulation is very hacky and not
yet perfect, but it should work well on any sane code.
What output does it produce?

View File

@ -49,7 +49,7 @@ The `parse` method will return an array of statement nodes (`$stmts`).
### Emulative lexer
Instead of `PHPParser_Lexer` one can also use `PHPParser_Lexer_Emulative`. This class will emulate tokens
of newer PHP versions and as such allow parsing PHP 5.4 on PHP 5.2, for example. So if you want to parse
of newer PHP versions and as such allow parsing PHP 5.5 on PHP 5.2, for example. So if you want to parse
PHP code of newer versions than the one you are running, you should use the emulative lexer.
Node tree