Skip to content

Commit

Permalink
PHP-Parser supports PHP 5.5
Browse files Browse the repository at this point in the history
  • Loading branch information
nikic committed Apr 15, 2013
1 parent 08f0cde commit 8e686ce
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 7 deletions.
2 changes: 1 addition & 1 deletion README.md
@@ -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.
Expand Down
10 changes: 5 additions & 5 deletions doc/0_Introduction.markdown
@@ -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?
-----------------
Expand All @@ -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?
Expand Down
2 changes: 1 addition & 1 deletion doc/2_Usage_of_basic_components.markdown
Expand Up @@ -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
Expand Down

0 comments on commit 8e686ce

Please sign in to comment.