X-Git-Url: http://aleph1.co.uk/gitweb/?a=blobdiff_plain;f=vendor%2Fnikic%2Fphp-parser%2Fdoc%2F0_Introduction.markdown;h=240f7fdea1958c8c92ab10be7ec1dc50430a6a92;hb=052617e40b525f8b817d84c29b1c04951f427069;hp=ca1ceb2ec25b59c192c216cc2c3fc238f28cd880;hpb=9917807b03b64faf00f6a1f29dcb6eafc454efa5;p=yaffs-website diff --git a/vendor/nikic/php-parser/doc/0_Introduction.markdown b/vendor/nikic/php-parser/doc/0_Introduction.markdown index ca1ceb2ec..240f7fdea 100644 --- a/vendor/nikic/php-parser/doc/0_Introduction.markdown +++ b/vendor/nikic/php-parser/doc/0_Introduction.markdown @@ -1,7 +1,7 @@ Introduction ============ -This project is a PHP 5.2 to PHP 7.1 parser **written in PHP itself**. +This project is a PHP 5.2 to PHP 7.2 parser **written in PHP itself**. What is this for? ----------------- @@ -14,7 +14,7 @@ There are other ways of processing source code. One that PHP supports natively i token stream generated by [`token_get_all`][2]. The token stream is much more low level than the AST and thus has different applications: It allows to also analyze the exact formatting of a file. On the other hand the token stream is much harder to deal with for more complex analysis. -For example an AST abstracts away the fact that in PHP variables can be written as `$foo`, but also +For example, an AST abstracts away the fact that, in PHP, variables can be written as `$foo`, but also as `$$bar`, `${'foobar'}` or even `${!${''}=barfoo()}`. You don't have to worry about recognizing all the different syntaxes from a stream of tokens. @@ -26,17 +26,17 @@ programmatic PHP code analysis are incidentally PHP developers, not C developers What can it parse? ------------------ -The parser supports parsing PHP 5.2-5.6 and PHP 7. +The parser supports parsing PHP 5.2-7.2. 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 tokens from newer versions is provided. -This allows to parse PHP 7.1 source code running on PHP 5.5, for example. This emulation is somewhat +This allows to parse PHP 7.2 source code running on PHP 5.5, for example. This emulation is somewhat hacky and not perfect, but it should work well on any sane code. What output does it produce? ---------------------------- -The parser produces an [Abstract Syntax Tree][1] (AST) also known as a node tree. How this looks like +The parser produces an [Abstract Syntax Tree][1] (AST) also known as a node tree. How this looks can best be seen in an example. The program `