mirror of
https://github.com/phabelio/PHP-Parser.git
synced 2024-11-27 04:24:43 +01:00
.. | ||
analyzer.php | ||
php.kmyacc | ||
preprocessor.php | ||
README.md | ||
rebuildParser.php | ||
zend_language_parser.phpy | ||
zend_language_parser.pre.phpy | ||
zend_language_parser.y |
What do all those files mean?
zend_language_parser.y
: Original PHP grammer this parser is based onzend_language_parser.pre.phpy
: PHP grammer written in a pseudo language, which is transformed into a properkmyacc
grammer usingpreprocessor.php
zend_language_parser.phpy
: PHP grammer ready forkmyacc
analyzer.php
: Analyzes the.pre.phpy
-grammer and outputs some info about itpreprocessor.php
: Transforms a.pre.phpy
grammar into a.phpy
grammarrebuildParser.php
: Builds the actual parser by callingkmyacc
php.kmyacc
: Akmyacc
parser prototype file for PHP
.pre.phpy pseudo language
The .pre.phpy
file is a normal grammer in kmyacc
(yacc
) style, with some transformations
applied to it:
- Nodes are created using the syntax
Name[subNode1: ..., subNode2: ...]
. This is transformed intonew PHPParser_Node_Name(array('subNode1' => ..., 'subNode2' => ...), #this->line)
(#
is used instead of$
because$
is a reservered character inkmyacc
grammars. It is later transformed back to$
) Name::abc
is transformed toPHPParser_Node_Name::abc
- Some function-like constructs are resolved (see
preprocessor.php
for a list)