mirror of
https://github.com/nikic/PHP-Parser.git
synced 2025-07-09 16:36:31 +02:00
Compare commits
31 Commits
v0.9.5
...
v1.0.0beta
Author | SHA1 | Date | |
---|---|---|---|
a6d46c17b1 | |||
fa96086a49 | |||
4c06b0919a | |||
2605b8319e | |||
91f6880734 | |||
b3332184cf | |||
1cb6e1407c | |||
a5e0bbcb62 | |||
3b7829b011 | |||
bea89a0bf2 | |||
cda6f575f0 | |||
b5bcfa1168 | |||
96f1151ab2 | |||
f5be0d30f7 | |||
c8c233f900 | |||
8c59f41d02 | |||
74efea91d1 | |||
70077039b4 | |||
558087399f | |||
1c8481bff6 | |||
523e024ba0 | |||
99e44eb8e1 | |||
4223e643dc | |||
26422257f5 | |||
d6eac28955 | |||
5cab2a7844 | |||
843aad4382 | |||
5e725df892 | |||
f82862ec9c | |||
10e1c1895c | |||
0ac054a74f |
@ -1,7 +1,6 @@
|
||||
language: php
|
||||
|
||||
php:
|
||||
- 5.2
|
||||
- 5.3
|
||||
- 5.4
|
||||
- 5.5
|
||||
|
205
CHANGELOG.md
205
CHANGELOG.md
@ -1,164 +1,65 @@
|
||||
Version 0.9.5-dev
|
||||
Version 1.0.0-dev
|
||||
-----------------
|
||||
|
||||
Nothing yet.
|
||||
|
||||
Version 1.0.0-beta1 (27.03.2014)
|
||||
--------------------------------
|
||||
|
||||
* [BC] PHP-Parser now requires PHP 5.3 or newer to run. It is however still possible to *parse* PHP 5.2 source code,
|
||||
while running on a newer version.
|
||||
|
||||
* [BC] The library has been moved to use namespaces with the `PhpParser` vendor prefix. However, the old names using
|
||||
underscores are still available as aliases, as such most code should continue running on the new version without
|
||||
further changes.
|
||||
|
||||
However, code performing dispatch operations on `Node::getType()` may be affected by some of the name changes. For
|
||||
example a `+` node will now return type `Expr_BinaryOp_Plus` instead of `Expr_Plus`. In particular this may affect
|
||||
custom pretty printers.
|
||||
|
||||
Due to conflicts with reserved keywords, some class names now end with an underscore, e.g. `PHPParser_Node_Stmt_Class`
|
||||
is now `PhpParser\Node\Stmt\Class_`. (But as usual, the old name is still available)
|
||||
|
||||
* [PHP 5.6] Added support for the power operator `**` (node `Expr\BinaryOp\Pow`) and the compound power assignment
|
||||
operator `**=` (node `Expr\AssignOp\Pow`).
|
||||
|
||||
* [PHP 5.6] Added support for variadic functions: `Param` nodes now have `variadic` as a boolean subnode.
|
||||
|
||||
* [PHP 5.6] Added support for argument unpacking: `Arg` nodes now have `unpack` as a boolean subnode.
|
||||
|
||||
* [PHP 5.6] Added support for aliasing of functions and constants. `Stmt\Use_` nodes now have an integral `type`
|
||||
subnode, which is one of `Stmt\Use_::TYPE_NORMAL` (`use`), `Stmt\Use_::TYPE_FUNCTION` (`use function`) or
|
||||
`Stmt\Use_::TYPE_CONSTANT` (`use const`).
|
||||
|
||||
The `NameResolver` now also supports resolution of such aliases.
|
||||
|
||||
* [PHP 5.6] Added support for constant scalar expressions. This means that certain expressions are now allowed as the
|
||||
initializer for constants, properties, parameters, static variables, etc.
|
||||
|
||||
* [BC] Improved pretty printing of empty statements lists, which are now printed as `{\n}` instead of `{\n \n}`.
|
||||
This changes the behavior of the protected `PrettyPrinterAbstract::pStmts()` method, so custom pretty printing code
|
||||
making use it of may need to be adjusted.
|
||||
|
||||
* Changed the order of some subnodes to be consistent with their order in the sour code. For example `Stmt\If->cond`
|
||||
will now appear before `Stmt\If->stmts` etc.
|
||||
|
||||
* Added `Scalar\MagicConstant->getName()`, which returns the name of the magic constant (e.g. `__CLASS__`).
|
||||
|
||||
**The following changes are also included in 0.9.5-dev**:
|
||||
|
||||
* [BC] Deprecated `PHPParser_Template` and `PHPParser_TemplateLoader`. This functionality does not belong in the main project
|
||||
and - as far as I know - nobody is using it.
|
||||
|
||||
* Add `NodeTraverser::removeVisitor()` method, which removes a visitor from the node traverser. This also modifies the
|
||||
corresponding `NodeTraverserInterface`.
|
||||
|
||||
* Deprecated `PHPParser_Template` and `PHPParser_TemplateLoader`. This functionality does not belong in the main project
|
||||
and - as far as I know - nobody is using it.
|
||||
|
||||
* Fix alias resolution in `NameResolver`: Class names are now correctly handled as case-insensitive.
|
||||
|
||||
* The undefined variable error, which is used to the lexer to reset the error state, will no longer interfere with
|
||||
custom error handlers.
|
||||
|
||||
Version 0.9.4 (25.08.2013)
|
||||
--------------------------
|
||||
* [PHP 5.5] Add support for `ClassName::class`. This is parsed as an `Expr_ClassConstFetch` with `'class'` being the
|
||||
constant name.
|
||||
---
|
||||
|
||||
* Syntax errors now include information on expected tokens and mimic the format of PHP's own (pre 5.4) error messages.
|
||||
Example:
|
||||
**This changelog only includes changes from the 1.0 series. For older changes see the [0.9 series changelog][1].**
|
||||
|
||||
Old: Unexpected token T_STATIC on line 1
|
||||
New: Syntax error, unexpected T_STATIC, expecting T_STRING or T_NS_SEPARATOR or '{'
|
||||
|
||||
* `PHPParser_PrettyPrinter_Zend` was renamed to `PHPParser_PrettyPrinter_Default` as the default pretty printer only
|
||||
very loosely applies the Zend Coding Standard. The class `PHPParser_PrettyPrinter_Zend` extends
|
||||
`PHPParser_PrettyPrinter_Default` to maintain backwards compatibility.
|
||||
|
||||
* The pretty printer now prints namespaces in semicolon-style if possible (i.e. if the file does not contain a global
|
||||
namespace declaration).
|
||||
|
||||
* Added `prettyPrintFile(array $stmts)` method which will pretty print a file of statements including the opening
|
||||
`<?php` tag if it is required. Use of this method will also eliminate the unnecessary `<?php ?>` at the start and end
|
||||
of files using inline HTML.
|
||||
|
||||
* There now is a builder for interfaces (`PHPParser_Builder_Interface`).
|
||||
|
||||
* An interface for the node traversation has been added: `PHPParser_NodeTraverserInterface`
|
||||
|
||||
* Fix pretty printing of `include` expressions (precedence information was missing).
|
||||
|
||||
* Fix "undefined index" notices when generating the expected tokens for a syntax error.
|
||||
|
||||
* Improve performance of `PrettyPrinter` construction by no longer using the `uniqid()` function.
|
||||
|
||||
Version 0.9.3 (22.11.2012)
|
||||
--------------------------
|
||||
|
||||
* [BC] As `list()` in `foreach` is now supported the structure of list assignments changed:
|
||||
|
||||
1. There is no longer a dedicated `AssignList` node; instead a normal `Assign` node is used with a `List` as `var`.
|
||||
2. Nested lists are now `List` nodes too, instead of just arrays.
|
||||
|
||||
* [BC] As arbitrary expressions are allowed in `empty()` now its subnode was renamed from `var` to `expr`.
|
||||
|
||||
* [BC] The protected `pSafe()` method in `PrettyPrinterAbstract` was renamed to `pNoIndent()`.
|
||||
|
||||
* [PHP 5.5] Add support for arbitrary expressions in `empty()`.
|
||||
|
||||
* [PHP 5.5] Add support for constant array / string dereferencing.
|
||||
Examples: `"foo"[2]`, `[1, 2, 3][2]`
|
||||
|
||||
* [PHP 5.5] Add support for `yield` expressions. This adds a new `Yield` expression type, with subnodes `key` and
|
||||
`value`.
|
||||
|
||||
* [PHP 5.5] Add support for `finally`. This adds a new `finallyStmts` subnode to the `TryCatch` node. If there is no
|
||||
finally clause it will be `null`.
|
||||
|
||||
* [PHP 5.5] Add support for `list()` destructuring of `foreach` values.
|
||||
Example: `foreach ($coords as list($x, $y)) { ... }`
|
||||
|
||||
* Improve pretty printing of expressions by printing less unnecessary parentheses. In particular concatenations are now
|
||||
printed as `$a . $b . $c . $d . $e` rather than `$a . ($b . ($c . ($d . $e)))`. This is implemented by taking operator
|
||||
associativity into account. New protected methods added to the pretty printer are `pPrec()`, `pInfixOp()`,
|
||||
`pPrefixOp()` and `pPostfixOp()`. This also fixes an issue with extraneous parentheses in closure bodies.
|
||||
|
||||
* Fix formatting of fall-through `case` statements in the Zend pretty printer.
|
||||
|
||||
* Fix parsing of `$foo =& new Bar`. It is now properly parsed as `AssignRef` (instead of `Assign`).
|
||||
|
||||
* Fix assignment of `$endAttributes`. Sometimes the attributes of the token right after the node were assigned, rather
|
||||
than the attributes of the last token in the node.
|
||||
|
||||
* `rebuildParser.php` is now designed to be run from the command line rather than from the browser.
|
||||
|
||||
Version 0.9.2 (07.07.2012)
|
||||
--------------------------
|
||||
|
||||
* Add `Class->getMethods()` function, which returns all methods contained in the `stmts` array of the class node. This
|
||||
does not take inherited methods into account.
|
||||
|
||||
* Add `isPublic()`, `isProtected()`, `isPrivate()`. `isAbstract()`, `isFinal()` and `isStatic()` accessors to the
|
||||
`ClassMethod`, `Property` and `Class` nodes. (`Property` and `Class` obviously only have the accessors relevant to
|
||||
them.)
|
||||
|
||||
* Fix parsing of new expressions in parentheses, e.g. `return(new Foo);`.
|
||||
|
||||
* [BC] Due to the below changes nodes now optionally accept an `$attributes` array as the
|
||||
last parameter, instead of the previously used `$line` and `$docComment` parameters.
|
||||
|
||||
* Add mechanism for adding attributes to nodes in the lexer.
|
||||
|
||||
The following attributes are now added by default:
|
||||
|
||||
* `startLine`: The line the node started in.
|
||||
* `endLine`: The line the node ended in.
|
||||
* `comments`: An array of comments. The comments are instances of `PHPParser_Comment`
|
||||
(or `PHPParser_Comment_Doc` for doc comments).
|
||||
|
||||
The methods `getLine()` and `setLine()` still exist and function as before, but internally
|
||||
operator on the `startLine` attribute.
|
||||
|
||||
`getDocComment()` also continues to exist. It returns the last comment in the `comments`
|
||||
attribute if it is a doc comment, otherwise `null`. As `getDocComment()` now returns a
|
||||
comment object (which can be modified using `->setText()`) the `setDocComment()` method was
|
||||
removed. Comment objects implement a `__toString()` method, so `getDocComment()` should
|
||||
continue to work properly with old code.
|
||||
|
||||
* [BC] Use inject-once approach for lexer:
|
||||
|
||||
Now the lexer is injected only once when creating the parser. Instead of
|
||||
|
||||
$parser = new PHPParser_Parser;
|
||||
$parser->parse(new PHPParser_Lexer($code));
|
||||
$parser->parse(new PHPParser_Lexer($code2));
|
||||
|
||||
you write:
|
||||
|
||||
$parser = new PHPParser_Parser(new PHPParser_Lexer);
|
||||
$parser->parse($code);
|
||||
$parser->parse($code2);
|
||||
|
||||
* Fix `NameResolver` visitor to also resolve class names in `catch` blocks.
|
||||
|
||||
Version 0.9.1 (24.04.2012)
|
||||
--------------------------
|
||||
|
||||
* Add ability to add attributes to nodes:
|
||||
|
||||
It is now possible to add attributes to a node using `$node->setAttribute('name', 'value')` and to retrieve them using
|
||||
`$node->getAttribute('name' [, 'default'])`. Additionally the existance of an attribute can be checked with
|
||||
`$node->hasAttribute('name')` and all attributes can be returned using `$node->getAttributes()`.
|
||||
|
||||
* Add code generation features: Builders and templates.
|
||||
|
||||
For more infos, see the [code generation documentation][1].
|
||||
|
||||
* [BC] Don't traverse nodes merged by another visitor:
|
||||
|
||||
If a NodeVisitor returns an array of nodes to merge, these will no longer be traversed by all other visitors. This
|
||||
behavior only caused problems.
|
||||
|
||||
* Fix line numbers for some list structures.
|
||||
* Fix XML unserialization of empty nodes.
|
||||
* Fix parsing of integers that overflow into floats.
|
||||
* Fix emulation of NOWDOC and binary floats.
|
||||
|
||||
Version 0.9.0 (05.01.2012)
|
||||
--------------------------
|
||||
|
||||
First version.
|
||||
|
||||
[1]: https://github.com/nikic/PHP-Parser/blob/master/doc/3_Code_generation.markdown
|
||||
[1]: https://github.com/nikic/PHP-Parser/blob/0.9/CHANGELOG.md
|
11
README.md
11
README.md
@ -1,10 +1,12 @@
|
||||
PHP Parser
|
||||
==========
|
||||
|
||||
This is a PHP 5.5 (and older) parser written in PHP. It's purpose is to simplify static code analysis and
|
||||
This is a PHP 5.6 (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.
|
||||
[**Documentation for version 0.9.x**][doc_0_9] (stable; for running on PHP 5.2).
|
||||
|
||||
[**Documentation for version 1.0.x**][doc_master] (beta; for running on PHP >= 5.3).
|
||||
|
||||
***Note: This project is experimental, so the API is subject to change.***
|
||||
|
||||
@ -73,6 +75,7 @@ programming errors or security issues).
|
||||
Additionally, you can convert a syntax tree back to PHP code. This allows you to do code preprocessing
|
||||
(like automatedly porting code to older PHP versions).
|
||||
|
||||
So, that's it, in a nutshell. You can find everything else in the [docs][1].
|
||||
So, that's it, in a nutshell. You can find everything else in the [docs][doc_master].
|
||||
|
||||
[1]: https://github.com/nikic/PHP-Parser/tree/master/doc
|
||||
[doc_0_9]: https://github.com/nikic/PHP-Parser/tree/0.9/doc
|
||||
[doc_master]: https://github.com/nikic/PHP-Parser/tree/master/doc
|
@ -10,15 +10,15 @@
|
||||
}
|
||||
],
|
||||
"require": {
|
||||
"php": ">=5.2",
|
||||
"php": ">=5.3",
|
||||
"ext-tokenizer": "*"
|
||||
},
|
||||
"autoload": {
|
||||
"psr-0": { "PHPParser": "lib/" }
|
||||
"files": ["lib/bootstrap.php"]
|
||||
},
|
||||
"extra": {
|
||||
"branch-alias": {
|
||||
"dev-master": "0.9-dev"
|
||||
"dev-master": "1.0-dev"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -15,7 +15,7 @@ Create a `composer.json` file in your project root and use it to define your dep
|
||||
|
||||
{
|
||||
"require": {
|
||||
"nikic/php-parser": "0.9.4"
|
||||
"nikic/php-parser": "1.0.0-beta1"
|
||||
}
|
||||
}
|
||||
|
||||
@ -27,14 +27,6 @@ And finally ask Composer to install the dependencies:
|
||||
|
||||
php composer.phar install
|
||||
|
||||
Installing as a PEAR package
|
||||
----------------------------
|
||||
|
||||
Run the following two commands:
|
||||
|
||||
pear channel-discover nikic.github.com/pear
|
||||
pear install nikic/PHPParser-0.9.4
|
||||
|
||||
Installing as a Git Submodule
|
||||
-----------------------------
|
||||
|
||||
|
@ -26,20 +26,20 @@ This ensures that there will be no errors when traversing highly nested node tre
|
||||
Parsing
|
||||
-------
|
||||
|
||||
In order to parse some source code you first have to create a `PHPParser_Parser` object (which
|
||||
needs to be passed a `PHPParser_Lexer` instance) and then pass the code (including `<?php` opening
|
||||
tags) to the `parse` method. If a syntax error is encountered `PHPParser_Error` is thrown, so this
|
||||
In order to parse some source code you first have to create a `PhpParser\Parser` object (which
|
||||
needs to be passed a `PhpParser\Lexer` instance) and then pass the code (including `<?php` opening
|
||||
tags) to the `parse` method. If a syntax error is encountered `PhpParser\Error` is thrown, so this
|
||||
exception should be `catch`ed.
|
||||
|
||||
```php
|
||||
<?php
|
||||
$code = '<?php // some code';
|
||||
|
||||
$parser = new PHPParser_Parser(new PHPParser_Lexer);
|
||||
$parser = new PhpParser\Parser(new PhpParser\Lexer);
|
||||
|
||||
try {
|
||||
$stmts = $parser->parse($code);
|
||||
} catch (PHPParser_Error $e) {
|
||||
} catch (PhpParser\Error $e) {
|
||||
echo 'Parse Error: ', $e->getMessage();
|
||||
}
|
||||
```
|
||||
@ -48,7 +48,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
|
||||
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.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.
|
||||
|
||||
@ -81,37 +81,41 @@ array(
|
||||
```
|
||||
|
||||
Thus `$stmts` will contain an array with only one node, with this node being an instance of
|
||||
`PHPParser_Node_Stmt_Echo`.
|
||||
`PhpParser\Node\Stmt\Echo_`.
|
||||
|
||||
As PHP is a large language there are approximately 140 different nodes. In order to make work
|
||||
with them easier they are grouped into three categories:
|
||||
|
||||
* `PHPParser_Node_Stmt`s are statement nodes, i.e. language constructs that do not return
|
||||
* `PhpParser\Node\Stmt`s are statement nodes, i.e. language constructs that do not return
|
||||
a value and can not occur in an expression. For example a class definition is a statement.
|
||||
It doesn't return a value and you can't write something like `func(class A {});`.
|
||||
* `PHPParser_Node_Expr`s are expression nodes, i.e. language constructs that return a value
|
||||
* `PhpParser\Node\Expr`s are expression nodes, i.e. language constructs that return a value
|
||||
and thus can occur in other expressions. Examples of expressions are `$var`
|
||||
(`PHPParser_Node_Expr_Variable`) and `func()` (`PHPParser_Node_Expr_FuncCall`).
|
||||
* `PHPParser_Node_Scalar`s are nodes representing scalar values, like `'string'`
|
||||
(`PHPParser_Node_Scalar_String`), `0` (`PHPParser_Node_Scalar_LNumber`) or magic constants
|
||||
like `__FILE__` (`PHPParser_Node_Scalar_FileConst`). All `PHPParser_Node_Scalar`s extend
|
||||
`PHPParser_Node_Expr`, as scalars are expressions, too.
|
||||
* There are some nodes not in either of these groups, for example names (`PHPParser_Node_Name`)
|
||||
and call arguments (`PHPParser_Node_Arg`).
|
||||
(`PhpParser\Node\Expr\Variable`) and `func()` (`PhpParser\Node\Expr\FuncCall`).
|
||||
* `PhpParser\Node\Scalar`s are nodes representing scalar values, like `'string'`
|
||||
(`PhpParser\Node\Scalar\String`), `0` (`PhpParser\Node\Scalar\LNumber`) or magic constants
|
||||
like `__FILE__` (`PhpParser\Node\Scalar\MagicConst\File`). All `PhpParser\Node\Scalar`s extend
|
||||
`PhpParser\Node\Expr`, as scalars are expressions, too.
|
||||
* There are some nodes not in either of these groups, for example names (`PhpParser\Node\Name`)
|
||||
and call arguments (`PhpParser\Node\Arg`).
|
||||
|
||||
Some node class names have a trailing `_`. This is used whenever the class name would otherwise clash
|
||||
with a PHP keyword.
|
||||
|
||||
Every node has a (possibly zero) number of subnodes. You can access subnodes by writing
|
||||
`$node->subNodeName`. The `Stmt_Echo` node has only one subnode `exprs`. So in order to access it
|
||||
`$node->subNodeName`. The `Stmt\Echo_` node has only one subnode `exprs`. So in order to access it
|
||||
in the above example you would write `$stmts[0]->exprs`. If you wanted to access name of the function
|
||||
call, you would write `$stmts[0]->exprs[1]->name`.
|
||||
|
||||
All nodes also define a `getType()` method that returns the node type (the type is the class name
|
||||
without the `PHPParser_Node_` prefix).
|
||||
All nodes also define a `getType()` method that returns the node type. The type is the class name
|
||||
without the `PhpParser\Node\` prefix and `\` replaced with `_`. It also does not contain a trailing
|
||||
`_` for reserved-keyword class names.
|
||||
|
||||
It is possible to associate custom metadata with a node using the `setAttribute()` method. This data
|
||||
can then be retrieved using `hasAttribute()`, `getAttribute()` and `getAttributes()`.
|
||||
|
||||
By default the lexer adds the `startLine`, `endLine` and `comments` attributes. `comments` is an array
|
||||
of `PHPParser_Comment[_Doc]` instances.
|
||||
of `PhpParser\Comment[\Doc]` instances.
|
||||
|
||||
The start line can also be accessed using `getLine()`/`setLine()` (instead of `getAttribute('startLine')`).
|
||||
The last doc comment from the `comments` attribute can be obtained using `getDocComment()`.
|
||||
@ -121,14 +125,14 @@ Pretty printer
|
||||
|
||||
The pretty printer component compiles the AST back to PHP code. As the parser does not retain formatting
|
||||
information the formatting is done using a specified scheme. Currently there is only one scheme available,
|
||||
namely `PHPParser_PrettyPrinter_Default`.
|
||||
namely `PhpParser\PrettyPrinter\Standard`.
|
||||
|
||||
```php
|
||||
<?php
|
||||
$code = "<?php echo 'Hi ', hi\\getTarget();";
|
||||
|
||||
$parser = new PHPParser_Parser(new PHPParser_Lexer);
|
||||
$prettyPrinter = new PHPParser_PrettyPrinter_Default;
|
||||
$parser = new PhpParser\Parser(new PhpParser\Lexer);
|
||||
$prettyPrinter = new PhpParser\PrettyPrinter\Standard;
|
||||
|
||||
try {
|
||||
// parse
|
||||
@ -145,7 +149,7 @@ try {
|
||||
$code = '<?php ' . $prettyPrinter->prettyPrint($stmts);
|
||||
|
||||
echo $code;
|
||||
} catch (PHPParser_Error $e) {
|
||||
} catch (PhpParser\Error $e) {
|
||||
echo 'Parse Error: ', $e->getMessage();
|
||||
}
|
||||
```
|
||||
@ -154,11 +158,11 @@ The above code will output:
|
||||
|
||||
<?php echo 'Hallo ', hi\getTarget();
|
||||
|
||||
As you can see the source code was first parsed using `PHPParser_Parser->parse`, then changed and then
|
||||
again converted to code using `PHPParser_PrettyPrinter_Default->prettyPrint`.
|
||||
As you can see the source code was first parsed using `PhpParser\Parser->parse()`, then changed and then
|
||||
again converted to code using `PhpParser\PrettyPrinter\Standard->prettyPrint()`.
|
||||
|
||||
The `prettyPrint` method pretty prints a statements array. It is also possible to pretty print only a
|
||||
single expression using `prettyPrintExpr`.
|
||||
The `prettyPrint()` method pretty prints a statements array. It is also possible to pretty print only a
|
||||
single expression using `prettyPrintExpr()`.
|
||||
|
||||
Node traversation
|
||||
-----------------
|
||||
@ -169,15 +173,15 @@ Usually you want to change / analyze code in a generic way, where you don't know
|
||||
going to look like.
|
||||
|
||||
For this purpose the parser provides a component for traversing and visiting the node tree. The basic
|
||||
structure of a program using this `PHPParser_NodeTraverser` looks like this:
|
||||
structure of a program using this `PhpParser\NodeTraverser` looks like this:
|
||||
|
||||
```php
|
||||
<?php
|
||||
$code = "<?php // some code";
|
||||
|
||||
$parser = new PHPParser_Parser(new PHPParser_Lexer);
|
||||
$traverser = new PHPParser_NodeTraverser;
|
||||
$prettyPrinter = new PHPParser_PrettyPrinter_Default;
|
||||
$parser = new PhpParser\Parser(new PhpParser\Lexer);
|
||||
$traverser = new PhpParser\NodeTraverser;
|
||||
$prettyPrinter = new PhpParser\PrettyPrinter\Standard;
|
||||
|
||||
// add your visitor
|
||||
$traverser->addVisitor(new MyNodeVisitor);
|
||||
@ -193,7 +197,7 @@ try {
|
||||
$code = '<?php ' . $prettyPrinter->prettyPrint($stmts);
|
||||
|
||||
echo $code;
|
||||
} catch (PHPParser_Error $e) {
|
||||
} catch (PhpParser\Error $e) {
|
||||
echo 'Parse Error: ', $e->getMessage();
|
||||
}
|
||||
```
|
||||
@ -202,10 +206,10 @@ A same node visitor for this code might look like this:
|
||||
|
||||
```php
|
||||
<?php
|
||||
class MyNodeVisitor extends PHPParser_NodeVisitorAbstract
|
||||
class MyNodeVisitor extends PhpParser\NodeVisitorAbstract
|
||||
{
|
||||
public function leaveNode(PHPParser_Node $node) {
|
||||
if ($node instanceof PHPParser_Node_Scalar_String) {
|
||||
public function leaveNode(PhpParser\Node $node) {
|
||||
if ($node instanceof PhpParser\Node\Scalar\String) {
|
||||
$node->value = 'foo';
|
||||
}
|
||||
}
|
||||
@ -214,12 +218,12 @@ class MyNodeVisitor extends PHPParser_NodeVisitorAbstract
|
||||
|
||||
The above node visitor would change all string literals in the program to `'foo'`.
|
||||
|
||||
All visitors must implement the `PHPParser_NodeVisitor` interface, which defined the following four
|
||||
All visitors must implement the `PhpParser\NodeVisitor` interface, which defined the following four
|
||||
methods:
|
||||
|
||||
public function beforeTraverse(array $nodes);
|
||||
public function enterNode(PHPParser_Node $node);
|
||||
public function leaveNode(PHPParser_Node $node);
|
||||
public function enterNode(PhpParser\Node $node);
|
||||
public function leaveNode(PhpParser\Node $node);
|
||||
public function afterTraverse(array $nodes);
|
||||
|
||||
The `beforeTraverse` method is called once before the traversal begins and is passed the nodes the
|
||||
@ -245,7 +249,7 @@ class, which will define empty default implementations for all the above methods
|
||||
The NameResolver node visitor
|
||||
-----------------------------
|
||||
|
||||
One visitor is already bundled with the package: `PHPParser_NodeVisitor_NameResolver`. This visitor
|
||||
One visitor is already bundled with the package: `PhpParser\NodeVisitor\NameResolver`. This visitor
|
||||
helps you work with namespaced code by trying to resolve most names to fully qualified ones.
|
||||
|
||||
For example, consider the following code:
|
||||
@ -280,12 +284,12 @@ const IN_DIR = '/some/path';
|
||||
const OUT_DIR = '/some/other/path';
|
||||
|
||||
// use the emulative lexer here, as we are running PHP 5.2 but want to parse PHP 5.3
|
||||
$parser = new PHPParser_Parser(new PHPParser_Lexer_Emulative);
|
||||
$traverser = new PHPParser_NodeTraverser;
|
||||
$prettyPrinter = new PHPParser_PrettyPrinter_Default;
|
||||
$parser = new PhpParser\Parser(new PhpParser\Lexer\Emulative);
|
||||
$traverser = new PhpParser\NodeTraverser;
|
||||
$prettyPrinter = new PhpParser\PrettyPrinter\Standard;
|
||||
|
||||
$traverser->addVisitor(new PHPParser_NodeVisitor_NameResolver); // we will need resolved names
|
||||
$traverser->addVisitor(new NodeVisitor_NamespaceConverter); // our own node visitor
|
||||
$traverser->addVisitor(new PhpParser\NodeVisitor\NameResolver); // we will need resolved names
|
||||
$traverser->addVisitor(new NodeVisitor\NamespaceConverter); // our own node visitor
|
||||
|
||||
// iterate over all .php files in the directory
|
||||
$files = new RecursiveIteratorIterator(new RecursiveDirectoryIterator(IN_DIR));
|
||||
@ -310,7 +314,7 @@ foreach ($files as $file) {
|
||||
substr_replace($file->getPathname(), OUT_DIR, 0, strlen(IN_DIR)),
|
||||
$code
|
||||
);
|
||||
} catch (PHPParser_Error $e) {
|
||||
} catch (PhpParser\Error $e) {
|
||||
echo 'Parse Error: ', $e->getMessage();
|
||||
}
|
||||
}
|
||||
@ -321,11 +325,12 @@ is convert `A\\B` style names to `A_B` style ones.
|
||||
|
||||
```php
|
||||
<?php
|
||||
class NodeVisitor_NamespaceConverter extends PHPParser_NodeVisitorAbstract
|
||||
use PhpParser\Node;
|
||||
class NodeVisitor_NamespaceConverter extends PhpParser\NodeVisitorAbstract
|
||||
{
|
||||
public function leaveNode(PHPParser_Node $node) {
|
||||
if ($node instanceof PHPParser_Node_Name) {
|
||||
return new PHPParser_Node_Name($node->toString('_'));
|
||||
public function leaveNode(Node $node) {
|
||||
if ($node instanceof Node\Name) {
|
||||
return new Node\Name($node->toString('_'));
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -343,16 +348,18 @@ name:
|
||||
|
||||
```php
|
||||
<?php
|
||||
class NodeVisitor_NamespaceConverter extends PHPParser_NodeVisitorAbstract
|
||||
use PhpParser\Node;
|
||||
use PhpParser\Node\Stmt;
|
||||
class NodeVisitor_NamespaceConverter extends PhpParser\NodeVisitorAbstract
|
||||
{
|
||||
public function leaveNode(PHPParser_Node $node) {
|
||||
if ($node instanceof PHPParser_Node_Name) {
|
||||
return new PHPParser_Node_Name($node->toString('_'));
|
||||
} elseif ($node instanceof PHPParser_Node_Stmt_Class
|
||||
|| $node instanceof PHPParser_Node_Stmt_Interface
|
||||
|| $node instanceof PHPParser_Node_Stmt_Function) {
|
||||
public function leaveNode(Node $node) {
|
||||
if ($node instanceof Node\Name) {
|
||||
return new Node\Name($node->toString('_'));
|
||||
} elseif ($node instanceof Stmt\Class_
|
||||
|| $node instanceof Stmt\Interface_
|
||||
|| $node instanceof Stmt\Function_) {
|
||||
$node->name = $node->namespacedName->toString('_');
|
||||
} elseif ($node instanceof PHPParser_Node_Stmt_Const) {
|
||||
} elseif ($node instanceof Stmt\Const_) {
|
||||
foreach ($node->consts as $const) {
|
||||
$const->name = $const->namespacedName->toString('_');
|
||||
}
|
||||
@ -367,23 +374,25 @@ The last thing we need to do is remove the `namespace` and `use` statements:
|
||||
|
||||
```php
|
||||
<?php
|
||||
class NodeVisitor_NamespaceConverter extends PHPParser_NodeVisitorAbstract
|
||||
use PhpParser\Node;
|
||||
use PhpParser\Node\Stmt;
|
||||
class NodeVisitor_NamespaceConverter extends PhpParser\NodeVisitorAbstract
|
||||
{
|
||||
public function leaveNode(PHPParser_Node $node) {
|
||||
if ($node instanceof PHPParser_Node_Name) {
|
||||
return new PHPParser_Node_Name($node->toString('_'));
|
||||
} elseif ($node instanceof PHPParser_Node_Stmt_Class
|
||||
|| $node instanceof PHPParser_Node_Stmt_Interface
|
||||
|| $node instanceof PHPParser_Node_Stmt_Function) {
|
||||
public function leaveNode(Node $node) {
|
||||
if ($node instanceof Node\Name) {
|
||||
return new Node\Name($node->toString('_'));
|
||||
} elseif ($node instanceof Stmt\Class_
|
||||
|| $node instanceof Stmt\Interface_
|
||||
|| $node instanceof Stmt\Function_) {
|
||||
$node->name = $node->namespacedName->toString('_');
|
||||
} elseif ($node instanceof PHPParser_Node_Stmt_Const) {
|
||||
} elseif ($node instanceof Stmt\Const_) {
|
||||
foreach ($node->consts as $const) {
|
||||
$const->name = $const->namespacedName->toString('_');
|
||||
}
|
||||
} elseif ($node instanceof PHPParser_Node_Stmt_Namespace) {
|
||||
} elseif ($node instanceof Stmt\Namespace_) {
|
||||
// returning an array merges is into the parent array
|
||||
return $node->stmts;
|
||||
} elseif ($node instanceof PHPParser_Node_Stmt_Use) {
|
||||
} elseif ($node instanceof Stmt\Use_) {
|
||||
// returning false removed the node altogether
|
||||
return false;
|
||||
}
|
||||
|
@ -14,7 +14,7 @@ Human readable dumping
|
||||
----------------------
|
||||
|
||||
Furthermore it is possible to dump nodes into a human readable form using the `dump` method of
|
||||
`PHPParser_NodeDumper`. This can be used for debugging.
|
||||
`PhpParser\NodeDumper`. This can be used for debugging.
|
||||
|
||||
```php
|
||||
<?php
|
||||
@ -27,14 +27,14 @@ $code = <<<'CODE'
|
||||
printLine('Hallo World!!!');
|
||||
CODE;
|
||||
|
||||
$parser = new PHPParser_Parser(new PHPParser_Lexer);
|
||||
$nodeDumper = new PHPParser_NodeDumper;
|
||||
$parser = new PhpParser\Parser(new PhpParser\Lexer);
|
||||
$nodeDumper = new PhpParser\NodeDumper;
|
||||
|
||||
try {
|
||||
$stmts = $parser->parse($code);
|
||||
|
||||
echo '<pre>' . htmlspecialchars($nodeDumper->dump($stmts)) . '</pre>';
|
||||
} catch (PHPParser_Error $e) {
|
||||
} catch (PhpParser\Error $e) {
|
||||
echo 'Parse Error: ', $e->getMessage();
|
||||
}
|
||||
```
|
||||
@ -89,8 +89,8 @@ array(
|
||||
Serialization to XML
|
||||
--------------------
|
||||
|
||||
It is also possible to serialize the node tree to XML using `PHPParser_Serializer_XML->serialize()`
|
||||
and to unserialize it using `PHPParser_Unserializer_XML->unserialize()`. This is useful for
|
||||
It is also possible to serialize the node tree to XML using `PhpParser\Serializer\XML->serialize()`
|
||||
and to unserialize it using `PhpParser\Unserializer\XML->unserialize()`. This is useful for
|
||||
interfacing with other languages and applications or for doing transformation using XSLT.
|
||||
|
||||
```php
|
||||
@ -104,14 +104,14 @@ $code = <<<'CODE'
|
||||
printLine('Hallo World!!!');
|
||||
CODE;
|
||||
|
||||
$parser = new PHPParser_Parser(new PHPParser_Lexer);
|
||||
$serializer = new PHPParser_Serializer_XML;
|
||||
$parser = new PhpParser\Parser(new PhpParser\Lexer);
|
||||
$serializer = new PhpParser\Serializer\XML;
|
||||
|
||||
try {
|
||||
$stmts = $parser->parse($code);
|
||||
|
||||
echo '<pre>' . htmlspecialchars($serializer->serialize($stmts)) . '</pre>';
|
||||
} catch (PHPParser_Error $e) {
|
||||
} catch (PhpParser\Error $e) {
|
||||
echo 'Parse Error: ', $e->getMessage();
|
||||
}
|
||||
```
|
||||
|
@ -15,7 +15,7 @@ Here is an example:
|
||||
|
||||
```php
|
||||
<?php
|
||||
$factory = new PHPParser_BuilderFactory;
|
||||
$factory = new PhpParser\BuilderFactory;
|
||||
$node = $factory->class('SomeClass')
|
||||
->extend('SomeOtherClass')
|
||||
->implement('A\Few', 'Interfaces')
|
||||
@ -30,7 +30,7 @@ $node = $factory->class('SomeClass')
|
||||
->makeProtected() // ->makePublic() [default], ->makePrivate()
|
||||
->addParam($factory->param('someParam')->setDefault('test'))
|
||||
// it is possible to add manually created nodes
|
||||
->addStmt(new PHPParser_Node_Expr_Print(new PHPParser_Node_Expr_Variable('someParam')))
|
||||
->addStmt(new PhpParser\Node\Expr\Print_(new PhpParser\Node\Expr\Variable('someParam')))
|
||||
)
|
||||
|
||||
// properties will be correctly reordered above the methods
|
||||
@ -106,7 +106,7 @@ Using this template we can easily create a class with multiple properties and th
|
||||
<?php
|
||||
|
||||
// $templateString contains the above template
|
||||
$template = new PHPParser_Template($parser, $templateString);
|
||||
$template = new PhpParser\Template($parser, $templateString);
|
||||
|
||||
// We only have to specify the __name__ placeholder, as the
|
||||
// capitalized __Name__ placeholder is automatically created
|
||||
@ -248,7 +248,7 @@ When using multiple templates it is easier to manage them on the filesystem. The
|
||||
<?php
|
||||
|
||||
// We'll store our templates in ./templates and give them a .php suffix
|
||||
$loader = new PHPParser_TemplateLoader($parser, './templates', '.php');
|
||||
$loader = new PhpParser\TemplateLoader($parser, './templates', '.php');
|
||||
|
||||
// loads ./templates/GetterSetter.php
|
||||
$getterSetterTemplate = $loader->load('GetterSetter');
|
||||
@ -257,7 +257,7 @@ $getterSetterTemplate = $loader->load('GetterSetter');
|
||||
$collectionTemplate = $loader->load('Collection');
|
||||
|
||||
// The use of a suffix is optional. The following code for example is equivalent:
|
||||
$loader = new PHPParser_TemplateLoader($parser, './templates');
|
||||
$loader = new PhpParser\TemplateLoader($parser, './templates');
|
||||
|
||||
// loads ./templates/GetterSetter.php
|
||||
$getterSetterTemplate = $loader->load('GetterSetter.php');
|
||||
|
@ -1,8 +1,8 @@
|
||||
Lexer component documentation
|
||||
=============================
|
||||
|
||||
The lexer is responsible for providing tokens to the parser. The project comes with two lexers: `PHPParser_Lexer` and
|
||||
`PHPParser_Lexer_Emulative`. The latter is an extension of the former, which adds the ability to emulate tokens of
|
||||
The lexer is responsible for providing tokens to the parser. The project comes with two lexers: `PhpParser\Lexer` and
|
||||
`PhpParser\Lexer\Emulative`. The latter is an extension of the former, which adds the ability to emulate tokens of
|
||||
newer PHP versions and thus allows parsing of new code on older versions.
|
||||
|
||||
A lexer has to define the following public interface:
|
||||
@ -22,7 +22,7 @@ Even though `startLexing` is meant to accept a source code string, you could for
|
||||
```php
|
||||
<?php
|
||||
|
||||
class FileLexer extends PHPParser_Lexer {
|
||||
class FileLexer extends PhpParser\Lexer {
|
||||
public function startLexing($fileName) {
|
||||
if (!file_exists($fileName)) {
|
||||
throw new InvalidArgumentException(sprintf('File "%s" does not exist', $fileName));
|
||||
@ -32,7 +32,7 @@ class FileLexer extends PHPParser_Lexer {
|
||||
}
|
||||
}
|
||||
|
||||
$parser = new PHPParser_Parser(new FileLexer);
|
||||
$parser = new PhpParser\Parser(new FileLexer);
|
||||
|
||||
var_dump($parser->parse('someFile.php'));
|
||||
var_dump($parser->parse('someOtherFile.php'));
|
||||
@ -63,7 +63,7 @@ overriding the method:
|
||||
```php
|
||||
<?php
|
||||
|
||||
class LessAttributesLexer extends PHPParser_Lexer {
|
||||
class LessAttributesLexer extends PhpParser\Lexer {
|
||||
public function getNextToken(&$value = null, &$startAttributes = null, &$endAttributes = null) {
|
||||
$tokenId = parent::getNextToken($value, $startAttributes, $endAttributes);
|
||||
|
||||
@ -82,7 +82,7 @@ a `fileName` attribute to all nodes:
|
||||
```php
|
||||
<?php
|
||||
|
||||
class FileLexer extends PHPParser_Lexer {
|
||||
class FileLexer extends PhpParser\Lexer {
|
||||
protected $fileName;
|
||||
|
||||
public function startLexing($fileName) {
|
||||
@ -100,7 +100,7 @@ class FileLexer extends PHPParser_Lexer {
|
||||
// we could use either $startAttributes or $endAttributes here, because the fileName is always the same
|
||||
// (regardless of whether it is the start or end token). We choose $endAttributes, because it is slightly
|
||||
// more efficient (as the parser has to keep a stack for the $startAttributes).
|
||||
$endAttributes['fileName'] = $fileName;
|
||||
$endAttributes['fileName'] = $this->fileName;
|
||||
|
||||
return $tokenId;
|
||||
}
|
||||
|
@ -13,8 +13,8 @@ The `.phpy` file is a normal grammer in `kmyacc` (`yacc`) style, with some trans
|
||||
applied to it:
|
||||
|
||||
* Nodes are created using the syntax `Name[..., ...]`. This is transformed into
|
||||
`new PHPParser_Node_Name(..., ..., $attributes)`
|
||||
* `Name::abc` is transformed to `PHPParser_Node_Name::abc`
|
||||
`new Node\Name(..., ..., $attributes)`
|
||||
* `Name::abc` is transformed to `Node\Name::abc`
|
||||
* Some function-like constructs are resolved (see `rebuildParser.php` for a list)
|
||||
* Associative arrays are written as `[key: value, ...]`, which is transformed to
|
||||
`array('key' => value, ...)`
|
||||
|
@ -6,6 +6,8 @@ $meta #
|
||||
#semval(%n,%t) $this->yyastk[$this->stackPos-(%l-%n)]
|
||||
#include;
|
||||
|
||||
namespace PhpParser;
|
||||
|
||||
/* This is an automatically GENERATED file, which should not be manually edited.
|
||||
* Instead edit one of the following:
|
||||
* * the grammar file grammar/zend_language_parser.phpy
|
||||
@ -100,9 +102,9 @@ class #(-p)
|
||||
/**
|
||||
* Creates a parser instance.
|
||||
*
|
||||
* @param PHPParser_Lexer $lexer A lexer
|
||||
* @param Lexer $lexer A lexer
|
||||
*/
|
||||
public function __construct(PHPParser_Lexer $lexer) {
|
||||
public function __construct(Lexer $lexer) {
|
||||
$this->lexer = $lexer;
|
||||
}
|
||||
#endif
|
||||
@ -157,7 +159,7 @@ class #(-p)
|
||||
*
|
||||
* @param string $code The source code to parse
|
||||
*
|
||||
* @return PHPParser_Node[] Array of statements
|
||||
* @return Node[] Array of statements
|
||||
*/
|
||||
public function parse($code) {
|
||||
$this->lexer->startLexing($code);
|
||||
@ -206,7 +208,7 @@ class #(-p)
|
||||
: self::TOKEN_INVALID;
|
||||
|
||||
if ($tokenId === self::TOKEN_INVALID) {
|
||||
throw new RangeException(sprintf(
|
||||
throw new \RangeException(sprintf(
|
||||
'The lexer returned an invalid token (id=%d, value=%s)',
|
||||
$origTokenId, $tokenValue
|
||||
));
|
||||
@ -278,7 +280,7 @@ class #(-p)
|
||||
$attributeStack[$this->stackPos - self::$yylen[$yyn]]
|
||||
+ $endAttributes
|
||||
);
|
||||
} catch (PHPParser_Error $e) {
|
||||
} catch (Error $e) {
|
||||
if (-1 === $e->getRawLine()) {
|
||||
$e->setRawLine($startAttributes['startLine']);
|
||||
}
|
||||
@ -331,7 +333,7 @@ class #(-p)
|
||||
$expectedString = ', expecting ' . implode(' or ', $expected);
|
||||
}
|
||||
|
||||
throw new PHPParser_Error(
|
||||
throw new Error(
|
||||
'Syntax error, unexpected ' . self::$terminals[$tokenId] . $expectedString,
|
||||
$startAttributes['startLine']
|
||||
);
|
||||
|
@ -4,8 +4,8 @@ $grammarFile = __DIR__ . '/zend_language_parser.phpy';
|
||||
$skeletonFile = __DIR__ . '/kmyacc.php.parser';
|
||||
$tmpGrammarFile = __DIR__ . '/tmp_parser.phpy';
|
||||
$tmpResultFile = __DIR__ . '/tmp_parser.php';
|
||||
$parserResultFile = __DIR__ . '/../lib/PHPParser/Parser.php';
|
||||
$debugParserResultFile = __DIR__ . '/../lib/PHPParser/Parser/Debug.php';
|
||||
$parserResultFile = __DIR__ . '/../lib/PhpParser/Parser.php';
|
||||
$debugParserResultFile = __DIR__ . '/../lib/PhpParser/Parser/Debug.php';
|
||||
|
||||
// check for kmyacc.exe binary in this directory, otherwise fall back to global name
|
||||
$kmyacc = __DIR__ . '/kmyacc.exe';
|
||||
@ -48,14 +48,14 @@ $grammarCode = resolveArrays($grammarCode);
|
||||
file_put_contents($tmpGrammarFile, $grammarCode);
|
||||
|
||||
echo "Building parser.\n";
|
||||
$output = trim(shell_exec("$kmyacc -l -m $skeletonFile -p PHPParser_Parser $tmpGrammarFile 2>&1"));
|
||||
$output = trim(shell_exec("$kmyacc -l -m $skeletonFile -p Parser $tmpGrammarFile 2>&1"));
|
||||
echo "Output: \"$output\"\n";
|
||||
|
||||
moveFileWithDirCheck($tmpResultFile, $parserResultFile);
|
||||
|
||||
if ($optionDebug) {
|
||||
echo "Building debug parser.\n";
|
||||
$output = trim(shell_exec("$kmyacc -t -v -l -m $skeletonFile -p PHPParser_Parser $tmpGrammarFile 2>&1"));
|
||||
$output = trim(shell_exec("$kmyacc -t -v -l -m $skeletonFile -p Parser $tmpGrammarFile 2>&1"));
|
||||
echo "Output: \"$output\"\n";
|
||||
|
||||
moveFileWithDirCheck($tmpResultFile, $debugParserResultFile);
|
||||
@ -70,12 +70,12 @@ if (!$optionKeepTmpGrammar) {
|
||||
///////////////////////////////
|
||||
|
||||
function resolveConstants($code) {
|
||||
return preg_replace('~[A-Z][a-zA-Z_]++::~', 'PHPParser_Node_$0', $code);
|
||||
return preg_replace('~[A-Z][a-zA-Z_\\\\]++::~', 'Node\\\\$0', $code);
|
||||
}
|
||||
|
||||
function resolveNodes($code) {
|
||||
return preg_replace_callback(
|
||||
'~(?<name>[A-Z][a-zA-Z_]++)\s*' . PARAMS . '~',
|
||||
'~(?<name>[A-Z][a-zA-Z_\\\\]++)\s*' . PARAMS . '~',
|
||||
function($matches) {
|
||||
// recurse
|
||||
$matches['params'] = resolveNodes($matches['params']);
|
||||
@ -90,7 +90,7 @@ function resolveNodes($code) {
|
||||
$paramCode .= $param . ', ';
|
||||
}
|
||||
|
||||
return 'new PHPParser_Node_' . $matches['name'] . '(' . $paramCode . '$attributes)';
|
||||
return 'new Node\\' . $matches['name'] . '(' . $paramCode . '$attributes)';
|
||||
},
|
||||
$code
|
||||
);
|
||||
@ -112,7 +112,7 @@ function resolveMacros($code) {
|
||||
if ('error' == $name) {
|
||||
assertArgs(1, $args, $name);
|
||||
|
||||
return 'throw new PHPParser_Error(' . $args[0] . ')';
|
||||
return 'throw new Error(' . $args[0] . ')';
|
||||
}
|
||||
|
||||
if ('init' == $name) {
|
||||
@ -146,13 +146,13 @@ function resolveMacros($code) {
|
||||
if ('parseEncapsed' == $name) {
|
||||
assertArgs(2, $args, $name);
|
||||
|
||||
return 'foreach (' . $args[0] . ' as &$s) { if (is_string($s)) { $s = PHPParser_Node_Scalar_String::parseEscapeSequences($s, ' . $args[1] . '); } }';
|
||||
return 'foreach (' . $args[0] . ' as &$s) { if (is_string($s)) { $s = Node\Scalar\String::parseEscapeSequences($s, ' . $args[1] . '); } }';
|
||||
}
|
||||
|
||||
if ('parseEncapsedDoc' == $name) {
|
||||
assertArgs(1, $args, $name);
|
||||
|
||||
return 'foreach (' . $args[0] . ' as &$s) { if (is_string($s)) { $s = PHPParser_Node_Scalar_String::parseEscapeSequences($s, null); } } $s = preg_replace(\'~(\r\n|\n|\r)$~\', \'\', $s); if (\'\' === $s) array_pop(' . $args[0] . ');';
|
||||
return 'foreach (' . $args[0] . ' as &$s) { if (is_string($s)) { $s = Node\Scalar\String::parseEscapeSequences($s, null); } } $s = preg_replace(\'~(\r\n|\n|\r)$~\', \'\', $s); if (\'\' === $s) array_pop(' . $args[0] . ');';
|
||||
}
|
||||
|
||||
throw new Exception(sprintf('Unknown macro "%s"', $name));
|
||||
|
@ -8,7 +8,7 @@
|
||||
%left T_LOGICAL_AND
|
||||
%right T_PRINT
|
||||
%right T_YIELD
|
||||
%left '=' T_PLUS_EQUAL T_MINUS_EQUAL T_MUL_EQUAL T_DIV_EQUAL T_CONCAT_EQUAL T_MOD_EQUAL T_AND_EQUAL T_OR_EQUAL T_XOR_EQUAL T_SL_EQUAL T_SR_EQUAL
|
||||
%left '=' T_PLUS_EQUAL T_MINUS_EQUAL T_MUL_EQUAL T_DIV_EQUAL T_CONCAT_EQUAL T_MOD_EQUAL T_AND_EQUAL T_OR_EQUAL T_XOR_EQUAL T_SL_EQUAL T_SR_EQUAL T_POW_EQUAL
|
||||
%left '?' ':'
|
||||
%left T_BOOLEAN_OR
|
||||
%left T_BOOLEAN_AND
|
||||
@ -23,6 +23,7 @@
|
||||
%right '!'
|
||||
%nonassoc T_INSTANCEOF
|
||||
%right '~' T_INC T_DEC T_INT_CAST T_DOUBLE_CAST T_STRING_CAST T_ARRAY_CAST T_OBJECT_CAST T_BOOL_CAST T_UNSET_CAST '@'
|
||||
%right T_POW
|
||||
%right '['
|
||||
%nonassoc T_NEW T_CLONE
|
||||
%token T_EXIT
|
||||
@ -106,11 +107,12 @@
|
||||
%token T_NS_C
|
||||
%token T_DIR
|
||||
%token T_NS_SEPARATOR
|
||||
%token T_ELLIPSIS
|
||||
|
||||
%%
|
||||
|
||||
start:
|
||||
top_statement_list { $$ = Stmt_Namespace::postprocess($1); }
|
||||
top_statement_list { $$ = Stmt\Namespace_::postprocess($1); }
|
||||
;
|
||||
|
||||
top_statement_list:
|
||||
@ -118,9 +120,13 @@ top_statement_list:
|
||||
| /* empty */ { init(); }
|
||||
;
|
||||
|
||||
namespace_name:
|
||||
namespace_name_parts:
|
||||
T_STRING { init($1); }
|
||||
| namespace_name T_NS_SEPARATOR T_STRING { push($1, $3); }
|
||||
| namespace_name_parts T_NS_SEPARATOR T_STRING { push($1, $3); }
|
||||
;
|
||||
|
||||
namespace_name:
|
||||
namespace_name_parts { $$ = Name[$1]; }
|
||||
;
|
||||
|
||||
top_statement:
|
||||
@ -128,12 +134,14 @@ top_statement:
|
||||
| function_declaration_statement { $$ = $1; }
|
||||
| class_declaration_statement { $$ = $1; }
|
||||
| T_HALT_COMPILER
|
||||
{ $$ = Stmt_HaltCompiler[$this->lexer->handleHaltCompiler()]; }
|
||||
| T_NAMESPACE namespace_name ';' { $$ = Stmt_Namespace[Name[$2], null]; }
|
||||
| T_NAMESPACE namespace_name '{' top_statement_list '}' { $$ = Stmt_Namespace[Name[$2], $4]; }
|
||||
| T_NAMESPACE '{' top_statement_list '}' { $$ = Stmt_Namespace[null, $3]; }
|
||||
| T_USE use_declarations ';' { $$ = Stmt_Use[$2]; }
|
||||
| T_CONST constant_declaration_list ';' { $$ = Stmt_Const[$2]; }
|
||||
{ $$ = Stmt\HaltCompiler[$this->lexer->handleHaltCompiler()]; }
|
||||
| T_NAMESPACE namespace_name ';' { $$ = Stmt\Namespace_[$2, null]; }
|
||||
| T_NAMESPACE namespace_name '{' top_statement_list '}' { $$ = Stmt\Namespace_[$2, $4]; }
|
||||
| T_NAMESPACE '{' top_statement_list '}' { $$ = Stmt\Namespace_[null, $3]; }
|
||||
| T_USE use_declarations ';' { $$ = Stmt\Use_[$2, Stmt\Use_::TYPE_NORMAL]; }
|
||||
| T_USE T_FUNCTION use_declarations ';' { $$ = Stmt\Use_[$3, Stmt\Use_::TYPE_FUNCTION]; }
|
||||
| T_USE T_CONST use_declarations ';' { $$ = Stmt\Use_[$3, Stmt\Use_::TYPE_CONSTANT]; }
|
||||
| T_CONST constant_declaration_list ';' { $$ = Stmt\Const_[$2]; }
|
||||
;
|
||||
|
||||
use_declarations:
|
||||
@ -142,10 +150,10 @@ use_declarations:
|
||||
;
|
||||
|
||||
use_declaration:
|
||||
namespace_name { $$ = Stmt_UseUse[Name[$1], null]; }
|
||||
| namespace_name T_AS T_STRING { $$ = Stmt_UseUse[Name[$1], $3]; }
|
||||
| T_NS_SEPARATOR namespace_name { $$ = Stmt_UseUse[Name[$2], null]; }
|
||||
| T_NS_SEPARATOR namespace_name T_AS T_STRING { $$ = Stmt_UseUse[Name[$2], $4]; }
|
||||
namespace_name { $$ = Stmt\UseUse[$1, null]; }
|
||||
| namespace_name T_AS T_STRING { $$ = Stmt\UseUse[$1, $3]; }
|
||||
| T_NS_SEPARATOR namespace_name { $$ = Stmt\UseUse[$2, null]; }
|
||||
| T_NS_SEPARATOR namespace_name T_AS T_STRING { $$ = Stmt\UseUse[$2, $4]; }
|
||||
;
|
||||
|
||||
constant_declaration_list:
|
||||
@ -154,7 +162,7 @@ constant_declaration_list:
|
||||
;
|
||||
|
||||
constant_declaration:
|
||||
T_STRING '=' static_scalar { $$ = Const[$1, $3]; }
|
||||
T_STRING '=' static_scalar { $$ = Const_[$1, $3]; }
|
||||
;
|
||||
|
||||
inner_statement_list:
|
||||
@ -172,38 +180,38 @@ inner_statement:
|
||||
statement:
|
||||
'{' inner_statement_list '}' { $$ = $2; }
|
||||
| T_IF parentheses_expr statement elseif_list else_single
|
||||
{ $$ = Stmt_If[$2, [stmts: toArray($3), elseifs: $4, else: $5]]; }
|
||||
{ $$ = Stmt\If_[$2, [stmts: toArray($3), elseifs: $4, else: $5]]; }
|
||||
| T_IF parentheses_expr ':' inner_statement_list new_elseif_list new_else_single T_ENDIF ';'
|
||||
{ $$ = Stmt_If[$2, [stmts: $4, elseifs: $5, else: $6]]; }
|
||||
| T_WHILE parentheses_expr while_statement { $$ = Stmt_While[$2, $3]; }
|
||||
| T_DO statement T_WHILE parentheses_expr ';' { $$ = Stmt_Do [$4, toArray($2)]; }
|
||||
{ $$ = Stmt\If_[$2, [stmts: $4, elseifs: $5, else: $6]]; }
|
||||
| T_WHILE parentheses_expr while_statement { $$ = Stmt\While_[$2, $3]; }
|
||||
| T_DO statement T_WHILE parentheses_expr ';' { $$ = Stmt\Do_ [$4, toArray($2)]; }
|
||||
| T_FOR '(' for_expr ';' for_expr ';' for_expr ')' for_statement
|
||||
{ $$ = Stmt_For[[init: $3, cond: $5, loop: $7, stmts: $9]]; }
|
||||
| T_SWITCH parentheses_expr switch_case_list { $$ = Stmt_Switch[$2, $3]; }
|
||||
| T_BREAK ';' { $$ = Stmt_Break[null]; }
|
||||
| T_BREAK expr ';' { $$ = Stmt_Break[$2]; }
|
||||
| T_CONTINUE ';' { $$ = Stmt_Continue[null]; }
|
||||
| T_CONTINUE expr ';' { $$ = Stmt_Continue[$2]; }
|
||||
| T_RETURN ';' { $$ = Stmt_Return[null]; }
|
||||
| T_RETURN expr ';' { $$ = Stmt_Return[$2]; }
|
||||
{ $$ = Stmt\For_[[init: $3, cond: $5, loop: $7, stmts: $9]]; }
|
||||
| T_SWITCH parentheses_expr switch_case_list { $$ = Stmt\Switch_[$2, $3]; }
|
||||
| T_BREAK ';' { $$ = Stmt\Break_[null]; }
|
||||
| T_BREAK expr ';' { $$ = Stmt\Break_[$2]; }
|
||||
| T_CONTINUE ';' { $$ = Stmt\Continue_[null]; }
|
||||
| T_CONTINUE expr ';' { $$ = Stmt\Continue_[$2]; }
|
||||
| T_RETURN ';' { $$ = Stmt\Return_[null]; }
|
||||
| T_RETURN expr ';' { $$ = Stmt\Return_[$2]; }
|
||||
| yield_expr ';' { $$ = $1; }
|
||||
| T_GLOBAL global_var_list ';' { $$ = Stmt_Global[$2]; }
|
||||
| T_STATIC static_var_list ';' { $$ = Stmt_Static[$2]; }
|
||||
| T_ECHO expr_list ';' { $$ = Stmt_Echo[$2]; }
|
||||
| T_INLINE_HTML { $$ = Stmt_InlineHTML[$1]; }
|
||||
| T_GLOBAL global_var_list ';' { $$ = Stmt\Global_[$2]; }
|
||||
| T_STATIC static_var_list ';' { $$ = Stmt\Static_[$2]; }
|
||||
| T_ECHO expr_list ';' { $$ = Stmt\Echo_[$2]; }
|
||||
| T_INLINE_HTML { $$ = Stmt\InlineHTML[$1]; }
|
||||
| expr ';' { $$ = $1; }
|
||||
| T_UNSET '(' variables_list ')' ';' { $$ = Stmt_Unset[$3]; }
|
||||
| T_UNSET '(' variables_list ')' ';' { $$ = Stmt\Unset_[$3]; }
|
||||
| T_FOREACH '(' expr T_AS foreach_variable ')' foreach_statement
|
||||
{ $$ = Stmt_Foreach[$3, $5[0], [keyVar: null, byRef: $5[1], stmts: $7]]; }
|
||||
{ $$ = Stmt\Foreach_[$3, $5[0], [keyVar: null, byRef: $5[1], stmts: $7]]; }
|
||||
| T_FOREACH '(' expr T_AS variable T_DOUBLE_ARROW foreach_variable ')' foreach_statement
|
||||
{ $$ = Stmt_Foreach[$3, $7[0], [keyVar: $5, byRef: $7[1], stmts: $9]]; }
|
||||
| T_DECLARE '(' declare_list ')' declare_statement { $$ = Stmt_Declare[$3, $5]; }
|
||||
{ $$ = Stmt\Foreach_[$3, $7[0], [keyVar: $5, byRef: $7[1], stmts: $9]]; }
|
||||
| T_DECLARE '(' declare_list ')' declare_statement { $$ = Stmt\Declare_[$3, $5]; }
|
||||
| ';' { $$ = array(); /* means: no statement */ }
|
||||
| T_TRY '{' inner_statement_list '}' catches optional_finally
|
||||
{ $$ = Stmt_TryCatch[$3, $5, $6]; }
|
||||
| T_THROW expr ';' { $$ = Stmt_Throw[$2]; }
|
||||
| T_GOTO T_STRING ';' { $$ = Stmt_Goto[$2]; }
|
||||
| T_STRING ':' { $$ = Stmt_Label[$1]; }
|
||||
{ $$ = Stmt\TryCatch[$3, $5, $6]; }
|
||||
| T_THROW expr ';' { $$ = Stmt\Throw_[$2]; }
|
||||
| T_GOTO T_STRING ';' { $$ = Stmt\Goto_[$2]; }
|
||||
| T_STRING ':' { $$ = Stmt\Label[$1]; }
|
||||
;
|
||||
|
||||
catches:
|
||||
@ -213,7 +221,7 @@ catches:
|
||||
|
||||
catch:
|
||||
T_CATCH '(' name T_VARIABLE ')' '{' inner_statement_list '}'
|
||||
{ $$ = Stmt_Catch[$3, parseVar($4), $7]; }
|
||||
{ $$ = Stmt\Catch_[$3, parseVar($4), $7]; }
|
||||
;
|
||||
|
||||
optional_finally:
|
||||
@ -231,24 +239,29 @@ optional_ref:
|
||||
| '&' { $$ = true; }
|
||||
;
|
||||
|
||||
optional_ellipsis:
|
||||
/* empty */ { $$ = false; }
|
||||
| T_ELLIPSIS { $$ = true; }
|
||||
;
|
||||
|
||||
function_declaration_statement:
|
||||
T_FUNCTION optional_ref T_STRING '(' parameter_list ')' '{' inner_statement_list '}'
|
||||
{ $$ = Stmt_Function[$3, [byRef: $2, params: $5, stmts: $8]]; }
|
||||
{ $$ = Stmt\Function_[$3, [byRef: $2, params: $5, stmts: $8]]; }
|
||||
;
|
||||
|
||||
class_declaration_statement:
|
||||
class_entry_type T_STRING extends_from implements_list '{' class_statement_list '}'
|
||||
{ $$ = Stmt_Class[$2, [type: $1, extends: $3, implements: $4, stmts: $6]]; }
|
||||
{ $$ = Stmt\Class_[$2, [type: $1, extends: $3, implements: $4, stmts: $6]]; }
|
||||
| T_INTERFACE T_STRING interface_extends_list '{' class_statement_list '}'
|
||||
{ $$ = Stmt_Interface[$2, [extends: $3, stmts: $5]]; }
|
||||
{ $$ = Stmt\Interface_[$2, [extends: $3, stmts: $5]]; }
|
||||
| T_TRAIT T_STRING '{' class_statement_list '}'
|
||||
{ $$ = Stmt_Trait[$2, $4]; }
|
||||
{ $$ = Stmt\Trait_[$2, $4]; }
|
||||
;
|
||||
|
||||
class_entry_type:
|
||||
T_CLASS { $$ = 0; }
|
||||
| T_ABSTRACT T_CLASS { $$ = Stmt_Class::MODIFIER_ABSTRACT; }
|
||||
| T_FINAL T_CLASS { $$ = Stmt_Class::MODIFIER_FINAL; }
|
||||
| T_ABSTRACT T_CLASS { $$ = Stmt\Class_::MODIFIER_ABSTRACT; }
|
||||
| T_FINAL T_CLASS { $$ = Stmt\Class_::MODIFIER_FINAL; }
|
||||
;
|
||||
|
||||
extends_from:
|
||||
@ -292,7 +305,7 @@ declare_list:
|
||||
;
|
||||
|
||||
declare_list_element:
|
||||
T_STRING '=' static_scalar { $$ = Stmt_DeclareDeclare[$1, $3]; }
|
||||
T_STRING '=' static_scalar { $$ = Stmt\DeclareDeclare[$1, $3]; }
|
||||
;
|
||||
|
||||
switch_case_list:
|
||||
@ -308,8 +321,8 @@ case_list:
|
||||
;
|
||||
|
||||
case:
|
||||
T_CASE expr case_separator inner_statement_list { $$ = Stmt_Case[$2, $4]; }
|
||||
| T_DEFAULT case_separator inner_statement_list { $$ = Stmt_Case[null, $3]; }
|
||||
T_CASE expr case_separator inner_statement_list { $$ = Stmt\Case_[$2, $4]; }
|
||||
| T_DEFAULT case_separator inner_statement_list { $$ = Stmt\Case_[null, $3]; }
|
||||
;
|
||||
|
||||
case_separator:
|
||||
@ -328,7 +341,7 @@ elseif_list:
|
||||
;
|
||||
|
||||
elseif:
|
||||
T_ELSEIF parentheses_expr statement { $$ = Stmt_ElseIf[$2, toArray($3)]; }
|
||||
T_ELSEIF parentheses_expr statement { $$ = Stmt\ElseIf_[$2, toArray($3)]; }
|
||||
;
|
||||
|
||||
new_elseif_list:
|
||||
@ -337,17 +350,17 @@ new_elseif_list:
|
||||
;
|
||||
|
||||
new_elseif:
|
||||
T_ELSEIF parentheses_expr ':' inner_statement_list { $$ = Stmt_ElseIf[$2, $4]; }
|
||||
T_ELSEIF parentheses_expr ':' inner_statement_list { $$ = Stmt\ElseIf_[$2, $4]; }
|
||||
;
|
||||
|
||||
else_single:
|
||||
/* empty */ { $$ = null; }
|
||||
| T_ELSE statement { $$ = Stmt_Else[toArray($2)]; }
|
||||
| T_ELSE statement { $$ = Stmt\Else_[toArray($2)]; }
|
||||
;
|
||||
|
||||
new_else_single:
|
||||
/* empty */ { $$ = null; }
|
||||
| T_ELSE ':' inner_statement_list { $$ = Stmt_Else[$3]; }
|
||||
| T_ELSE ':' inner_statement_list { $$ = Stmt\Else_[$3]; }
|
||||
;
|
||||
|
||||
foreach_variable:
|
||||
@ -367,10 +380,10 @@ non_empty_parameter_list:
|
||||
;
|
||||
|
||||
parameter:
|
||||
optional_class_type optional_ref T_VARIABLE
|
||||
{ $$ = Param[parseVar($3), null, $1, $2]; }
|
||||
| optional_class_type optional_ref T_VARIABLE '=' static_scalar
|
||||
{ $$ = Param[parseVar($3), $5, $1, $2]; }
|
||||
optional_class_type optional_ref optional_ellipsis T_VARIABLE
|
||||
{ $$ = Param[parseVar($4), null, $1, $2, $3]; }
|
||||
| optional_class_type optional_ref optional_ellipsis T_VARIABLE '=' static_scalar
|
||||
{ $$ = Param[parseVar($4), $6, $1, $2, $3]; }
|
||||
;
|
||||
|
||||
optional_class_type:
|
||||
@ -383,7 +396,7 @@ optional_class_type:
|
||||
argument_list:
|
||||
'(' ')' { $$ = array(); }
|
||||
| '(' non_empty_argument_list ')' { $$ = $2; }
|
||||
| '(' yield_expr ')' { $$ = array(Arg[$2, false]); }
|
||||
| '(' yield_expr ')' { $$ = array(Arg[$2, false, false]); }
|
||||
;
|
||||
|
||||
non_empty_argument_list:
|
||||
@ -392,8 +405,9 @@ non_empty_argument_list:
|
||||
;
|
||||
|
||||
argument:
|
||||
expr { $$ = Arg[$1, false]; }
|
||||
| '&' variable { $$ = Arg[$2, true]; }
|
||||
expr { $$ = Arg[$1, false, false]; }
|
||||
| '&' variable { $$ = Arg[$2, true, false]; }
|
||||
| T_ELLIPSIS expr { $$ = Arg[$2, false, true]; }
|
||||
;
|
||||
|
||||
global_var_list:
|
||||
@ -402,9 +416,9 @@ global_var_list:
|
||||
;
|
||||
|
||||
global_var:
|
||||
T_VARIABLE { $$ = Expr_Variable[parseVar($1)]; }
|
||||
| '$' variable { $$ = Expr_Variable[$2]; }
|
||||
| '$' '{' expr '}' { $$ = Expr_Variable[$3]; }
|
||||
T_VARIABLE { $$ = Expr\Variable[parseVar($1)]; }
|
||||
| '$' variable { $$ = Expr\Variable[$2]; }
|
||||
| '$' '{' expr '}' { $$ = Expr\Variable[$3]; }
|
||||
;
|
||||
|
||||
static_var_list:
|
||||
@ -413,8 +427,8 @@ static_var_list:
|
||||
;
|
||||
|
||||
static_var:
|
||||
T_VARIABLE { $$ = Stmt_StaticVar[parseVar($1), null]; }
|
||||
| T_VARIABLE '=' static_scalar { $$ = Stmt_StaticVar[parseVar($1), $3]; }
|
||||
T_VARIABLE { $$ = Stmt\StaticVar[parseVar($1), null]; }
|
||||
| T_VARIABLE '=' static_scalar { $$ = Stmt\StaticVar[parseVar($1), $3]; }
|
||||
;
|
||||
|
||||
class_statement_list:
|
||||
@ -423,11 +437,11 @@ class_statement_list:
|
||||
;
|
||||
|
||||
class_statement:
|
||||
variable_modifiers property_declaration_list ';' { $$ = Stmt_Property[$1, $2]; }
|
||||
| T_CONST constant_declaration_list ';' { $$ = Stmt_ClassConst[$2]; }
|
||||
variable_modifiers property_declaration_list ';' { $$ = Stmt\Property[$1, $2]; }
|
||||
| T_CONST constant_declaration_list ';' { $$ = Stmt\ClassConst[$2]; }
|
||||
| method_modifiers T_FUNCTION optional_ref T_STRING '(' parameter_list ')' method_body
|
||||
{ $$ = Stmt_ClassMethod[$4, [type: $1, byRef: $3, params: $6, stmts: $8]]; }
|
||||
| T_USE name_list trait_adaptations { $$ = Stmt_TraitUse[$2, $3]; }
|
||||
{ $$ = Stmt\ClassMethod[$4, [type: $1, byRef: $3, params: $6, stmts: $8]]; }
|
||||
| T_USE name_list trait_adaptations { $$ = Stmt\TraitUse[$2, $3]; }
|
||||
;
|
||||
|
||||
trait_adaptations:
|
||||
@ -442,13 +456,13 @@ trait_adaptation_list:
|
||||
|
||||
trait_adaptation:
|
||||
trait_method_reference_fully_qualified T_INSTEADOF name_list ';'
|
||||
{ $$ = Stmt_TraitUseAdaptation_Precedence[$1[0], $1[1], $3]; }
|
||||
{ $$ = Stmt\TraitUseAdaptation\Precedence[$1[0], $1[1], $3]; }
|
||||
| trait_method_reference T_AS member_modifier T_STRING ';'
|
||||
{ $$ = Stmt_TraitUseAdaptation_Alias[$1[0], $1[1], $3, $4]; }
|
||||
{ $$ = Stmt\TraitUseAdaptation\Alias[$1[0], $1[1], $3, $4]; }
|
||||
| trait_method_reference T_AS member_modifier ';'
|
||||
{ $$ = Stmt_TraitUseAdaptation_Alias[$1[0], $1[1], $3, null]; }
|
||||
{ $$ = Stmt\TraitUseAdaptation\Alias[$1[0], $1[1], $3, null]; }
|
||||
| trait_method_reference T_AS T_STRING ';'
|
||||
{ $$ = Stmt_TraitUseAdaptation_Alias[$1[0], $1[1], null, $3]; }
|
||||
{ $$ = Stmt\TraitUseAdaptation\Alias[$1[0], $1[1], null, $3]; }
|
||||
;
|
||||
|
||||
trait_method_reference_fully_qualified:
|
||||
@ -466,26 +480,26 @@ method_body:
|
||||
|
||||
variable_modifiers:
|
||||
non_empty_member_modifiers { $$ = $1; }
|
||||
| T_VAR { $$ = Stmt_Class::MODIFIER_PUBLIC; }
|
||||
| T_VAR { $$ = Stmt\Class_::MODIFIER_PUBLIC; }
|
||||
;
|
||||
|
||||
method_modifiers:
|
||||
/* empty */ { $$ = Stmt_Class::MODIFIER_PUBLIC; }
|
||||
/* empty */ { $$ = Stmt\Class_::MODIFIER_PUBLIC; }
|
||||
| non_empty_member_modifiers { $$ = $1; }
|
||||
;
|
||||
|
||||
non_empty_member_modifiers:
|
||||
member_modifier { $$ = $1; }
|
||||
| non_empty_member_modifiers member_modifier { Stmt_Class::verifyModifier($1, $2); $$ = $1 | $2; }
|
||||
| non_empty_member_modifiers member_modifier { Stmt\Class_::verifyModifier($1, $2); $$ = $1 | $2; }
|
||||
;
|
||||
|
||||
member_modifier:
|
||||
T_PUBLIC { $$ = Stmt_Class::MODIFIER_PUBLIC; }
|
||||
| T_PROTECTED { $$ = Stmt_Class::MODIFIER_PROTECTED; }
|
||||
| T_PRIVATE { $$ = Stmt_Class::MODIFIER_PRIVATE; }
|
||||
| T_STATIC { $$ = Stmt_Class::MODIFIER_STATIC; }
|
||||
| T_ABSTRACT { $$ = Stmt_Class::MODIFIER_ABSTRACT; }
|
||||
| T_FINAL { $$ = Stmt_Class::MODIFIER_FINAL; }
|
||||
T_PUBLIC { $$ = Stmt\Class_::MODIFIER_PUBLIC; }
|
||||
| T_PROTECTED { $$ = Stmt\Class_::MODIFIER_PROTECTED; }
|
||||
| T_PRIVATE { $$ = Stmt\Class_::MODIFIER_PRIVATE; }
|
||||
| T_STATIC { $$ = Stmt\Class_::MODIFIER_STATIC; }
|
||||
| T_ABSTRACT { $$ = Stmt\Class_::MODIFIER_ABSTRACT; }
|
||||
| T_FINAL { $$ = Stmt\Class_::MODIFIER_FINAL; }
|
||||
;
|
||||
|
||||
property_declaration_list:
|
||||
@ -494,8 +508,8 @@ property_declaration_list:
|
||||
;
|
||||
|
||||
property_declaration:
|
||||
T_VARIABLE { $$ = Stmt_PropertyProperty[parseVar($1), null]; }
|
||||
| T_VARIABLE '=' static_scalar { $$ = Stmt_PropertyProperty[parseVar($1), $3]; }
|
||||
T_VARIABLE { $$ = Stmt\PropertyProperty[parseVar($1), null]; }
|
||||
| T_VARIABLE '=' static_scalar { $$ = Stmt\PropertyProperty[parseVar($1), $3]; }
|
||||
;
|
||||
|
||||
expr_list:
|
||||
@ -510,87 +524,89 @@ for_expr:
|
||||
|
||||
expr:
|
||||
variable { $$ = $1; }
|
||||
| list_expr '=' expr { $$ = Expr_Assign[$1, $3]; }
|
||||
| variable '=' expr { $$ = Expr_Assign[$1, $3]; }
|
||||
| variable '=' '&' variable { $$ = Expr_AssignRef[$1, $4]; }
|
||||
| variable '=' '&' new_expr { $$ = Expr_AssignRef[$1, $4]; }
|
||||
| list_expr '=' expr { $$ = Expr\Assign[$1, $3]; }
|
||||
| variable '=' expr { $$ = Expr\Assign[$1, $3]; }
|
||||
| variable '=' '&' variable { $$ = Expr\AssignRef[$1, $4]; }
|
||||
| variable '=' '&' new_expr { $$ = Expr\AssignRef[$1, $4]; }
|
||||
| new_expr { $$ = $1; }
|
||||
| T_CLONE expr { $$ = Expr_Clone[$2]; }
|
||||
| variable T_PLUS_EQUAL expr { $$ = Expr_AssignPlus [$1, $3]; }
|
||||
| variable T_MINUS_EQUAL expr { $$ = Expr_AssignMinus [$1, $3]; }
|
||||
| variable T_MUL_EQUAL expr { $$ = Expr_AssignMul [$1, $3]; }
|
||||
| variable T_DIV_EQUAL expr { $$ = Expr_AssignDiv [$1, $3]; }
|
||||
| variable T_CONCAT_EQUAL expr { $$ = Expr_AssignConcat [$1, $3]; }
|
||||
| variable T_MOD_EQUAL expr { $$ = Expr_AssignMod [$1, $3]; }
|
||||
| variable T_AND_EQUAL expr { $$ = Expr_AssignBitwiseAnd[$1, $3]; }
|
||||
| variable T_OR_EQUAL expr { $$ = Expr_AssignBitwiseOr [$1, $3]; }
|
||||
| variable T_XOR_EQUAL expr { $$ = Expr_AssignBitwiseXor[$1, $3]; }
|
||||
| variable T_SL_EQUAL expr { $$ = Expr_AssignShiftLeft [$1, $3]; }
|
||||
| variable T_SR_EQUAL expr { $$ = Expr_AssignShiftRight[$1, $3]; }
|
||||
| variable T_INC { $$ = Expr_PostInc[$1]; }
|
||||
| T_INC variable { $$ = Expr_PreInc [$2]; }
|
||||
| variable T_DEC { $$ = Expr_PostDec[$1]; }
|
||||
| T_DEC variable { $$ = Expr_PreDec [$2]; }
|
||||
| expr T_BOOLEAN_OR expr { $$ = Expr_BooleanOr [$1, $3]; }
|
||||
| expr T_BOOLEAN_AND expr { $$ = Expr_BooleanAnd[$1, $3]; }
|
||||
| expr T_LOGICAL_OR expr { $$ = Expr_LogicalOr [$1, $3]; }
|
||||
| expr T_LOGICAL_AND expr { $$ = Expr_LogicalAnd[$1, $3]; }
|
||||
| expr T_LOGICAL_XOR expr { $$ = Expr_LogicalXor[$1, $3]; }
|
||||
| expr '|' expr { $$ = Expr_BitwiseOr [$1, $3]; }
|
||||
| expr '&' expr { $$ = Expr_BitwiseAnd[$1, $3]; }
|
||||
| expr '^' expr { $$ = Expr_BitwiseXor[$1, $3]; }
|
||||
| expr '.' expr { $$ = Expr_Concat [$1, $3]; }
|
||||
| expr '+' expr { $$ = Expr_Plus [$1, $3]; }
|
||||
| expr '-' expr { $$ = Expr_Minus [$1, $3]; }
|
||||
| expr '*' expr { $$ = Expr_Mul [$1, $3]; }
|
||||
| expr '/' expr { $$ = Expr_Div [$1, $3]; }
|
||||
| expr '%' expr { $$ = Expr_Mod [$1, $3]; }
|
||||
| expr T_SL expr { $$ = Expr_ShiftLeft [$1, $3]; }
|
||||
| expr T_SR expr { $$ = Expr_ShiftRight[$1, $3]; }
|
||||
| '+' expr %prec T_INC { $$ = Expr_UnaryPlus [$2]; }
|
||||
| '-' expr %prec T_INC { $$ = Expr_UnaryMinus[$2]; }
|
||||
| '!' expr { $$ = Expr_BooleanNot[$2]; }
|
||||
| '~' expr { $$ = Expr_BitwiseNot[$2]; }
|
||||
| expr T_IS_IDENTICAL expr { $$ = Expr_Identical [$1, $3]; }
|
||||
| expr T_IS_NOT_IDENTICAL expr { $$ = Expr_NotIdentical [$1, $3]; }
|
||||
| expr T_IS_EQUAL expr { $$ = Expr_Equal [$1, $3]; }
|
||||
| expr T_IS_NOT_EQUAL expr { $$ = Expr_NotEqual [$1, $3]; }
|
||||
| expr '<' expr { $$ = Expr_Smaller [$1, $3]; }
|
||||
| expr T_IS_SMALLER_OR_EQUAL expr { $$ = Expr_SmallerOrEqual[$1, $3]; }
|
||||
| expr '>' expr { $$ = Expr_Greater [$1, $3]; }
|
||||
| expr T_IS_GREATER_OR_EQUAL expr { $$ = Expr_GreaterOrEqual[$1, $3]; }
|
||||
| expr T_INSTANCEOF class_name_reference { $$ = Expr_Instanceof [$1, $3]; }
|
||||
| T_CLONE expr { $$ = Expr\Clone_[$2]; }
|
||||
| variable T_PLUS_EQUAL expr { $$ = Expr\AssignOp\Plus [$1, $3]; }
|
||||
| variable T_MINUS_EQUAL expr { $$ = Expr\AssignOp\Minus [$1, $3]; }
|
||||
| variable T_MUL_EQUAL expr { $$ = Expr\AssignOp\Mul [$1, $3]; }
|
||||
| variable T_DIV_EQUAL expr { $$ = Expr\AssignOp\Div [$1, $3]; }
|
||||
| variable T_CONCAT_EQUAL expr { $$ = Expr\AssignOp\Concat [$1, $3]; }
|
||||
| variable T_MOD_EQUAL expr { $$ = Expr\AssignOp\Mod [$1, $3]; }
|
||||
| variable T_AND_EQUAL expr { $$ = Expr\AssignOp\BitwiseAnd[$1, $3]; }
|
||||
| variable T_OR_EQUAL expr { $$ = Expr\AssignOp\BitwiseOr [$1, $3]; }
|
||||
| variable T_XOR_EQUAL expr { $$ = Expr\AssignOp\BitwiseXor[$1, $3]; }
|
||||
| variable T_SL_EQUAL expr { $$ = Expr\AssignOp\ShiftLeft [$1, $3]; }
|
||||
| variable T_SR_EQUAL expr { $$ = Expr\AssignOp\ShiftRight[$1, $3]; }
|
||||
| variable T_POW_EQUAL expr { $$ = Expr\AssignOp\Pow [$1, $3]; }
|
||||
| variable T_INC { $$ = Expr\PostInc[$1]; }
|
||||
| T_INC variable { $$ = Expr\PreInc [$2]; }
|
||||
| variable T_DEC { $$ = Expr\PostDec[$1]; }
|
||||
| T_DEC variable { $$ = Expr\PreDec [$2]; }
|
||||
| expr T_BOOLEAN_OR expr { $$ = Expr\BinaryOp\BooleanOr [$1, $3]; }
|
||||
| expr T_BOOLEAN_AND expr { $$ = Expr\BinaryOp\BooleanAnd[$1, $3]; }
|
||||
| expr T_LOGICAL_OR expr { $$ = Expr\BinaryOp\LogicalOr [$1, $3]; }
|
||||
| expr T_LOGICAL_AND expr { $$ = Expr\BinaryOp\LogicalAnd[$1, $3]; }
|
||||
| expr T_LOGICAL_XOR expr { $$ = Expr\BinaryOp\LogicalXor[$1, $3]; }
|
||||
| expr '|' expr { $$ = Expr\BinaryOp\BitwiseOr [$1, $3]; }
|
||||
| expr '&' expr { $$ = Expr\BinaryOp\BitwiseAnd[$1, $3]; }
|
||||
| expr '^' expr { $$ = Expr\BinaryOp\BitwiseXor[$1, $3]; }
|
||||
| expr '.' expr { $$ = Expr\BinaryOp\Concat [$1, $3]; }
|
||||
| expr '+' expr { $$ = Expr\BinaryOp\Plus [$1, $3]; }
|
||||
| expr '-' expr { $$ = Expr\BinaryOp\Minus [$1, $3]; }
|
||||
| expr '*' expr { $$ = Expr\BinaryOp\Mul [$1, $3]; }
|
||||
| expr '/' expr { $$ = Expr\BinaryOp\Div [$1, $3]; }
|
||||
| expr '%' expr { $$ = Expr\BinaryOp\Mod [$1, $3]; }
|
||||
| expr T_SL expr { $$ = Expr\BinaryOp\ShiftLeft [$1, $3]; }
|
||||
| expr T_SR expr { $$ = Expr\BinaryOp\ShiftRight[$1, $3]; }
|
||||
| expr T_POW expr { $$ = Expr\BinaryOp\Pow [$1, $3]; }
|
||||
| '+' expr %prec T_INC { $$ = Expr\UnaryPlus [$2]; }
|
||||
| '-' expr %prec T_INC { $$ = Expr\UnaryMinus[$2]; }
|
||||
| '!' expr { $$ = Expr\BooleanNot[$2]; }
|
||||
| '~' expr { $$ = Expr\BitwiseNot[$2]; }
|
||||
| expr T_IS_IDENTICAL expr { $$ = Expr\BinaryOp\Identical [$1, $3]; }
|
||||
| expr T_IS_NOT_IDENTICAL expr { $$ = Expr\BinaryOp\NotIdentical [$1, $3]; }
|
||||
| expr T_IS_EQUAL expr { $$ = Expr\BinaryOp\Equal [$1, $3]; }
|
||||
| expr T_IS_NOT_EQUAL expr { $$ = Expr\BinaryOp\NotEqual [$1, $3]; }
|
||||
| expr '<' expr { $$ = Expr\BinaryOp\Smaller [$1, $3]; }
|
||||
| expr T_IS_SMALLER_OR_EQUAL expr { $$ = Expr\BinaryOp\SmallerOrEqual[$1, $3]; }
|
||||
| expr '>' expr { $$ = Expr\BinaryOp\Greater [$1, $3]; }
|
||||
| expr T_IS_GREATER_OR_EQUAL expr { $$ = Expr\BinaryOp\GreaterOrEqual[$1, $3]; }
|
||||
| expr T_INSTANCEOF class_name_reference { $$ = Expr\Instanceof_[$1, $3]; }
|
||||
| parentheses_expr { $$ = $1; }
|
||||
/* we need a separate '(' new_expr ')' rule to avoid problems caused by a s/r conflict */
|
||||
| '(' new_expr ')' { $$ = $2; }
|
||||
| expr '?' expr ':' expr { $$ = Expr_Ternary[$1, $3, $5]; }
|
||||
| expr '?' ':' expr { $$ = Expr_Ternary[$1, null, $4]; }
|
||||
| T_ISSET '(' variables_list ')' { $$ = Expr_Isset[$3]; }
|
||||
| T_EMPTY '(' expr ')' { $$ = Expr_Empty[$3]; }
|
||||
| T_INCLUDE expr { $$ = Expr_Include[$2, Expr_Include::TYPE_INCLUDE]; }
|
||||
| T_INCLUDE_ONCE expr { $$ = Expr_Include[$2, Expr_Include::TYPE_INCLUDE_ONCE]; }
|
||||
| T_EVAL parentheses_expr { $$ = Expr_Eval[$2]; }
|
||||
| T_REQUIRE expr { $$ = Expr_Include[$2, Expr_Include::TYPE_REQUIRE]; }
|
||||
| T_REQUIRE_ONCE expr { $$ = Expr_Include[$2, Expr_Include::TYPE_REQUIRE_ONCE]; }
|
||||
| T_INT_CAST expr { $$ = Expr_Cast_Int [$2]; }
|
||||
| T_DOUBLE_CAST expr { $$ = Expr_Cast_Double [$2]; }
|
||||
| T_STRING_CAST expr { $$ = Expr_Cast_String [$2]; }
|
||||
| T_ARRAY_CAST expr { $$ = Expr_Cast_Array [$2]; }
|
||||
| T_OBJECT_CAST expr { $$ = Expr_Cast_Object [$2]; }
|
||||
| T_BOOL_CAST expr { $$ = Expr_Cast_Bool [$2]; }
|
||||
| T_UNSET_CAST expr { $$ = Expr_Cast_Unset [$2]; }
|
||||
| T_EXIT exit_expr { $$ = Expr_Exit [$2]; }
|
||||
| '@' expr { $$ = Expr_ErrorSuppress[$2]; }
|
||||
| expr '?' expr ':' expr { $$ = Expr\Ternary[$1, $3, $5]; }
|
||||
| expr '?' ':' expr { $$ = Expr\Ternary[$1, null, $4]; }
|
||||
| T_ISSET '(' variables_list ')' { $$ = Expr\Isset_[$3]; }
|
||||
| T_EMPTY '(' expr ')' { $$ = Expr\Empty_[$3]; }
|
||||
| T_INCLUDE expr { $$ = Expr\Include_[$2, Expr\Include_::TYPE_INCLUDE]; }
|
||||
| T_INCLUDE_ONCE expr { $$ = Expr\Include_[$2, Expr\Include_::TYPE_INCLUDE_ONCE]; }
|
||||
| T_EVAL parentheses_expr { $$ = Expr\Eval_[$2]; }
|
||||
| T_REQUIRE expr { $$ = Expr\Include_[$2, Expr\Include_::TYPE_REQUIRE]; }
|
||||
| T_REQUIRE_ONCE expr { $$ = Expr\Include_[$2, Expr\Include_::TYPE_REQUIRE_ONCE]; }
|
||||
| T_INT_CAST expr { $$ = Expr\Cast\Int [$2]; }
|
||||
| T_DOUBLE_CAST expr { $$ = Expr\Cast\Double [$2]; }
|
||||
| T_STRING_CAST expr { $$ = Expr\Cast\String [$2]; }
|
||||
| T_ARRAY_CAST expr { $$ = Expr\Cast\Array_ [$2]; }
|
||||
| T_OBJECT_CAST expr { $$ = Expr\Cast\Object [$2]; }
|
||||
| T_BOOL_CAST expr { $$ = Expr\Cast\Bool [$2]; }
|
||||
| T_UNSET_CAST expr { $$ = Expr\Cast\Unset_ [$2]; }
|
||||
| T_EXIT exit_expr { $$ = Expr\Exit_ [$2]; }
|
||||
| '@' expr { $$ = Expr\ErrorSuppress[$2]; }
|
||||
| scalar { $$ = $1; }
|
||||
| array_expr { $$ = $1; }
|
||||
| scalar_dereference { $$ = $1; }
|
||||
| '`' backticks_expr '`' { $$ = Expr_ShellExec[$2]; }
|
||||
| T_PRINT expr { $$ = Expr_Print[$2]; }
|
||||
| T_YIELD { $$ = Expr_Yield[null, null]; }
|
||||
| '`' backticks_expr '`' { $$ = Expr\ShellExec[$2]; }
|
||||
| T_PRINT expr { $$ = Expr\Print_[$2]; }
|
||||
| T_YIELD { $$ = Expr\Yield_[null, null]; }
|
||||
| T_FUNCTION optional_ref '(' parameter_list ')' lexical_vars '{' inner_statement_list '}'
|
||||
{ $$ = Expr_Closure[[static: false, byRef: $2, params: $4, uses: $6, stmts: $8]]; }
|
||||
{ $$ = Expr\Closure[[static: false, byRef: $2, params: $4, uses: $6, stmts: $8]]; }
|
||||
| T_STATIC T_FUNCTION optional_ref '(' parameter_list ')' lexical_vars '{' inner_statement_list '}'
|
||||
{ $$ = Expr_Closure[[static: true, byRef: $3, params: $5, uses: $7, stmts: $9]]; }
|
||||
{ $$ = Expr\Closure[[static: true, byRef: $3, params: $5, uses: $7, stmts: $9]]; }
|
||||
;
|
||||
|
||||
parentheses_expr:
|
||||
@ -599,25 +615,25 @@ parentheses_expr:
|
||||
;
|
||||
|
||||
yield_expr:
|
||||
T_YIELD expr { $$ = Expr_Yield[$2, null]; }
|
||||
| T_YIELD expr T_DOUBLE_ARROW expr { $$ = Expr_Yield[$4, $2]; }
|
||||
T_YIELD expr { $$ = Expr\Yield_[$2, null]; }
|
||||
| T_YIELD expr T_DOUBLE_ARROW expr { $$ = Expr\Yield_[$4, $2]; }
|
||||
;
|
||||
|
||||
array_expr:
|
||||
T_ARRAY '(' array_pair_list ')' { $$ = Expr_Array[$3]; }
|
||||
| '[' array_pair_list ']' { $$ = Expr_Array[$2]; }
|
||||
T_ARRAY '(' array_pair_list ')' { $$ = Expr\Array_[$3]; }
|
||||
| '[' array_pair_list ']' { $$ = Expr\Array_[$2]; }
|
||||
;
|
||||
|
||||
scalar_dereference:
|
||||
array_expr '[' dim_offset ']' { $$ = Expr_ArrayDimFetch[$1, $3]; }
|
||||
array_expr '[' dim_offset ']' { $$ = Expr\ArrayDimFetch[$1, $3]; }
|
||||
| T_CONSTANT_ENCAPSED_STRING '[' dim_offset ']'
|
||||
{ $$ = Expr_ArrayDimFetch[Scalar_String[Scalar_String::parse($1)], $3]; }
|
||||
| scalar_dereference '[' dim_offset ']' { $$ = Expr_ArrayDimFetch[$1, $3]; }
|
||||
{ $$ = Expr\ArrayDimFetch[Scalar\String[Scalar\String::parse($1)], $3]; }
|
||||
| scalar_dereference '[' dim_offset ']' { $$ = Expr\ArrayDimFetch[$1, $3]; }
|
||||
/* alternative array syntax missing intentionally */
|
||||
;
|
||||
|
||||
new_expr:
|
||||
T_NEW class_name_reference ctor_arguments { $$ = Expr_New[$2, $3]; }
|
||||
T_NEW class_name_reference ctor_arguments { $$ = Expr\New_[$2, $3]; }
|
||||
;
|
||||
|
||||
lexical_vars:
|
||||
@ -631,33 +647,33 @@ lexical_var_list:
|
||||
;
|
||||
|
||||
lexical_var:
|
||||
optional_ref T_VARIABLE { $$ = Expr_ClosureUse[parseVar($2), $1]; }
|
||||
optional_ref T_VARIABLE { $$ = Expr\ClosureUse[parseVar($2), $1]; }
|
||||
;
|
||||
|
||||
function_call:
|
||||
name argument_list { $$ = Expr_FuncCall[$1, $2]; }
|
||||
name argument_list { $$ = Expr\FuncCall[$1, $2]; }
|
||||
| class_name_or_var T_PAAMAYIM_NEKUDOTAYIM T_STRING argument_list
|
||||
{ $$ = Expr_StaticCall[$1, $3, $4]; }
|
||||
{ $$ = Expr\StaticCall[$1, $3, $4]; }
|
||||
| class_name_or_var T_PAAMAYIM_NEKUDOTAYIM '{' expr '}' argument_list
|
||||
{ $$ = Expr_StaticCall[$1, $4, $6]; }
|
||||
{ $$ = Expr\StaticCall[$1, $4, $6]; }
|
||||
| static_property argument_list {
|
||||
if ($1 instanceof PHPParser_Node_Expr_StaticPropertyFetch) {
|
||||
$$ = Expr_StaticCall[$1->class, Expr_Variable[$1->name], $2];
|
||||
} elseif ($1 instanceof PHPParser_Node_Expr_ArrayDimFetch) {
|
||||
if ($1 instanceof Node\Expr\StaticPropertyFetch) {
|
||||
$$ = Expr\StaticCall[$1->class, Expr\Variable[$1->name], $2];
|
||||
} elseif ($1 instanceof Node\Expr\ArrayDimFetch) {
|
||||
$tmp = $1;
|
||||
while ($tmp->var instanceof PHPParser_Node_Expr_ArrayDimFetch) {
|
||||
while ($tmp->var instanceof Node\Expr\ArrayDimFetch) {
|
||||
$tmp = $tmp->var;
|
||||
}
|
||||
|
||||
$$ = Expr_StaticCall[$tmp->var->class, $1, $2];
|
||||
$tmp->var = Expr_Variable[$tmp->var->name];
|
||||
$$ = Expr\StaticCall[$tmp->var->class, $1, $2];
|
||||
$tmp->var = Expr\Variable[$tmp->var->name];
|
||||
} else {
|
||||
throw new Exception;
|
||||
throw new \Exception;
|
||||
}
|
||||
}
|
||||
| variable_without_objects argument_list
|
||||
{ $$ = Expr_FuncCall[$1, $2]; }
|
||||
| function_call '[' dim_offset ']' { $$ = Expr_ArrayDimFetch[$1, $3]; }
|
||||
{ $$ = Expr\FuncCall[$1, $2]; }
|
||||
| function_call '[' dim_offset ']' { $$ = Expr\ArrayDimFetch[$1, $3]; }
|
||||
/* alternative array syntax missing intentionally */
|
||||
;
|
||||
|
||||
@ -667,9 +683,9 @@ class_name:
|
||||
;
|
||||
|
||||
name:
|
||||
namespace_name { $$ = Name[$1]; }
|
||||
| T_NS_SEPARATOR namespace_name { $$ = Name_FullyQualified[$2]; }
|
||||
| T_NAMESPACE T_NS_SEPARATOR namespace_name { $$ = Name_Relative[$3]; }
|
||||
namespace_name_parts { $$ = Name[$1]; }
|
||||
| T_NS_SEPARATOR namespace_name_parts { $$ = Name\FullyQualified[$2]; }
|
||||
| T_NAMESPACE T_NS_SEPARATOR namespace_name_parts { $$ = Name\Relative[$3]; }
|
||||
;
|
||||
|
||||
class_name_reference:
|
||||
@ -689,11 +705,11 @@ class_name_or_var:
|
||||
|
||||
object_access_for_dcnr:
|
||||
| base_variable T_OBJECT_OPERATOR object_property
|
||||
{ $$ = Expr_PropertyFetch[$1, $3]; }
|
||||
{ $$ = Expr\PropertyFetch[$1, $3]; }
|
||||
| object_access_for_dcnr T_OBJECT_OPERATOR object_property
|
||||
{ $$ = Expr_PropertyFetch[$1, $3]; }
|
||||
| object_access_for_dcnr '[' dim_offset ']' { $$ = Expr_ArrayDimFetch[$1, $3]; }
|
||||
| object_access_for_dcnr '{' expr '}' { $$ = Expr_ArrayDimFetch[$1, $3]; }
|
||||
{ $$ = Expr\PropertyFetch[$1, $3]; }
|
||||
| object_access_for_dcnr '[' dim_offset ']' { $$ = Expr\ArrayDimFetch[$1, $3]; }
|
||||
| object_access_for_dcnr '{' expr '}' { $$ = Expr\ArrayDimFetch[$1, $3]; }
|
||||
;
|
||||
|
||||
exit_expr:
|
||||
@ -704,7 +720,7 @@ exit_expr:
|
||||
|
||||
backticks_expr:
|
||||
/* empty */ { $$ = array(); }
|
||||
| T_ENCAPSED_AND_WHITESPACE { $$ = array(Scalar_String::parseEscapeSequences($1, '`')); }
|
||||
| T_ENCAPSED_AND_WHITESPACE { $$ = array(Scalar\String::parseEscapeSequences($1, '`')); }
|
||||
| encaps_list { parseEncapsed($1, '`'); $$ = $1; }
|
||||
;
|
||||
|
||||
@ -714,41 +730,80 @@ ctor_arguments:
|
||||
;
|
||||
|
||||
common_scalar:
|
||||
T_LNUMBER { $$ = Scalar_LNumber[Scalar_LNumber::parse($1)]; }
|
||||
| T_DNUMBER { $$ = Scalar_DNumber[Scalar_DNumber::parse($1)]; }
|
||||
| T_CONSTANT_ENCAPSED_STRING { $$ = Scalar_String[Scalar_String::parse($1)]; }
|
||||
| T_LINE { $$ = Scalar_LineConst[]; }
|
||||
| T_FILE { $$ = Scalar_FileConst[]; }
|
||||
| T_DIR { $$ = Scalar_DirConst[]; }
|
||||
| T_CLASS_C { $$ = Scalar_ClassConst[]; }
|
||||
| T_TRAIT_C { $$ = Scalar_TraitConst[]; }
|
||||
| T_METHOD_C { $$ = Scalar_MethodConst[]; }
|
||||
| T_FUNC_C { $$ = Scalar_FuncConst[]; }
|
||||
| T_NS_C { $$ = Scalar_NSConst[]; }
|
||||
T_LNUMBER { $$ = Scalar\LNumber[Scalar\LNumber::parse($1)]; }
|
||||
| T_DNUMBER { $$ = Scalar\DNumber[Scalar\DNumber::parse($1)]; }
|
||||
| T_CONSTANT_ENCAPSED_STRING { $$ = Scalar\String[Scalar\String::parse($1)]; }
|
||||
| T_LINE { $$ = Scalar\MagicConst\Line[]; }
|
||||
| T_FILE { $$ = Scalar\MagicConst\File[]; }
|
||||
| T_DIR { $$ = Scalar\MagicConst\Dir[]; }
|
||||
| T_CLASS_C { $$ = Scalar\MagicConst\Class_[]; }
|
||||
| T_TRAIT_C { $$ = Scalar\MagicConst\Trait_[]; }
|
||||
| T_METHOD_C { $$ = Scalar\MagicConst\Method[]; }
|
||||
| T_FUNC_C { $$ = Scalar\MagicConst\Function_[]; }
|
||||
| T_NS_C { $$ = Scalar\MagicConst\Namespace_[]; }
|
||||
| T_START_HEREDOC T_ENCAPSED_AND_WHITESPACE T_END_HEREDOC
|
||||
{ $$ = Scalar_String[Scalar_String::parseDocString($1, $2)]; }
|
||||
{ $$ = Scalar\String[Scalar\String::parseDocString($1, $2)]; }
|
||||
| T_START_HEREDOC T_END_HEREDOC
|
||||
{ $$ = Scalar_String['']; }
|
||||
| name { $$ = Expr_ConstFetch[$1]; }
|
||||
{ $$ = Scalar\String['']; }
|
||||
| name { $$ = Expr\ConstFetch[$1]; }
|
||||
;
|
||||
|
||||
static_scalar: /* compile-time evaluated scalars */
|
||||
/* Arrays are currently not allowed in static scalar operations */
|
||||
static_scalar:
|
||||
static_scalar_value { $$ = $1; }
|
||||
| T_ARRAY '(' static_array_pair_list ')' { $$ = Expr\Array_[$3]; }
|
||||
| '[' static_array_pair_list ']' { $$ = Expr\Array_[$2]; }
|
||||
;
|
||||
|
||||
static_scalar_value:
|
||||
common_scalar { $$ = $1; }
|
||||
| class_name T_PAAMAYIM_NEKUDOTAYIM class_const_name { $$ = Expr_ClassConstFetch[$1, $3]; }
|
||||
| '+' static_scalar { $$ = Expr_UnaryPlus[$2]; }
|
||||
| '-' static_scalar { $$ = Expr_UnaryMinus[$2]; }
|
||||
| T_ARRAY '(' static_array_pair_list ')' { $$ = Expr_Array[$3]; }
|
||||
| '[' static_array_pair_list ']' { $$ = Expr_Array[$2]; }
|
||||
| class_name T_PAAMAYIM_NEKUDOTAYIM class_const_name { $$ = Expr\ClassConstFetch[$1, $3]; }
|
||||
| static_operation { $$ = $1; }
|
||||
;
|
||||
|
||||
static_operation:
|
||||
static_scalar_value T_BOOLEAN_OR static_scalar_value { $$ = Expr\BinaryOp\BooleanOr [$1, $3]; }
|
||||
| static_scalar_value T_BOOLEAN_AND static_scalar_value { $$ = Expr\BinaryOp\BooleanAnd[$1, $3]; }
|
||||
| static_scalar_value T_LOGICAL_OR static_scalar_value { $$ = Expr\BinaryOp\LogicalOr [$1, $3]; }
|
||||
| static_scalar_value T_LOGICAL_AND static_scalar_value { $$ = Expr\BinaryOp\LogicalAnd[$1, $3]; }
|
||||
| static_scalar_value T_LOGICAL_XOR static_scalar_value { $$ = Expr\BinaryOp\LogicalXor[$1, $3]; }
|
||||
| static_scalar_value '|' static_scalar_value { $$ = Expr\BinaryOp\BitwiseOr [$1, $3]; }
|
||||
| static_scalar_value '&' static_scalar_value { $$ = Expr\BinaryOp\BitwiseAnd[$1, $3]; }
|
||||
| static_scalar_value '^' static_scalar_value { $$ = Expr\BinaryOp\BitwiseXor[$1, $3]; }
|
||||
| static_scalar_value '.' static_scalar_value { $$ = Expr\BinaryOp\Concat [$1, $3]; }
|
||||
| static_scalar_value '+' static_scalar_value { $$ = Expr\BinaryOp\Plus [$1, $3]; }
|
||||
| static_scalar_value '-' static_scalar_value { $$ = Expr\BinaryOp\Minus [$1, $3]; }
|
||||
| static_scalar_value '*' static_scalar_value { $$ = Expr\BinaryOp\Mul [$1, $3]; }
|
||||
| static_scalar_value '/' static_scalar_value { $$ = Expr\BinaryOp\Div [$1, $3]; }
|
||||
| static_scalar_value '%' static_scalar_value { $$ = Expr\BinaryOp\Mod [$1, $3]; }
|
||||
| static_scalar_value T_SL static_scalar_value { $$ = Expr\BinaryOp\ShiftLeft [$1, $3]; }
|
||||
| static_scalar_value T_SR static_scalar_value { $$ = Expr\BinaryOp\ShiftRight[$1, $3]; }
|
||||
| static_scalar_value T_POW static_scalar_value { $$ = Expr\BinaryOp\Pow [$1, $3]; }
|
||||
| '+' static_scalar_value %prec T_INC { $$ = Expr\UnaryPlus [$2]; }
|
||||
| '-' static_scalar_value %prec T_INC { $$ = Expr\UnaryMinus[$2]; }
|
||||
| '!' static_scalar_value { $$ = Expr\BooleanNot[$2]; }
|
||||
| '~' static_scalar_value { $$ = Expr\BitwiseNot[$2]; }
|
||||
| static_scalar_value T_IS_IDENTICAL static_scalar_value { $$ = Expr\BinaryOp\Identical [$1, $3]; }
|
||||
| static_scalar_value T_IS_NOT_IDENTICAL static_scalar_value { $$ = Expr\BinaryOp\NotIdentical [$1, $3]; }
|
||||
| static_scalar_value T_IS_EQUAL static_scalar_value { $$ = Expr\BinaryOp\Equal [$1, $3]; }
|
||||
| static_scalar_value T_IS_NOT_EQUAL static_scalar_value { $$ = Expr\BinaryOp\NotEqual [$1, $3]; }
|
||||
| static_scalar_value '<' static_scalar_value { $$ = Expr\BinaryOp\Smaller [$1, $3]; }
|
||||
| static_scalar_value T_IS_SMALLER_OR_EQUAL static_scalar_value { $$ = Expr\BinaryOp\SmallerOrEqual[$1, $3]; }
|
||||
| static_scalar_value '>' static_scalar_value { $$ = Expr\BinaryOp\Greater [$1, $3]; }
|
||||
| static_scalar_value T_IS_GREATER_OR_EQUAL static_scalar_value { $$ = Expr\BinaryOp\GreaterOrEqual[$1, $3]; }
|
||||
| static_scalar_value '?' static_scalar_value ':' static_scalar_value { $$ = Expr\Ternary[$1, $3, $5]; }
|
||||
| static_scalar_value '?' ':' static_scalar_value { $$ = Expr\Ternary[$1, null, $4]; }
|
||||
| '(' static_scalar_value ')' { $$ = $2; }
|
||||
;
|
||||
|
||||
scalar:
|
||||
common_scalar { $$ = $1; }
|
||||
| class_name_or_var T_PAAMAYIM_NEKUDOTAYIM class_const_name
|
||||
{ $$ = Expr_ClassConstFetch[$1, $3]; }
|
||||
{ $$ = Expr\ClassConstFetch[$1, $3]; }
|
||||
| '"' encaps_list '"'
|
||||
{ parseEncapsed($2, '"'); $$ = Scalar_Encapsed[$2]; }
|
||||
{ parseEncapsed($2, '"'); $$ = Scalar\Encapsed[$2]; }
|
||||
| T_START_HEREDOC encaps_list T_END_HEREDOC
|
||||
{ parseEncapsedDoc($2); $$ = Scalar_Encapsed[$2]; }
|
||||
{ parseEncapsedDoc($2); $$ = Scalar\Encapsed[$2]; }
|
||||
;
|
||||
|
||||
class_const_name:
|
||||
@ -772,8 +827,8 @@ non_empty_static_array_pair_list:
|
||||
;
|
||||
|
||||
static_array_pair:
|
||||
static_scalar T_DOUBLE_ARROW static_scalar { $$ = Expr_ArrayItem[$3, $1, false]; }
|
||||
| static_scalar { $$ = Expr_ArrayItem[$1, null, false]; }
|
||||
static_scalar T_DOUBLE_ARROW static_scalar { $$ = Expr\ArrayItem[$3, $1, false]; }
|
||||
| static_scalar { $$ = Expr\ArrayItem[$1, null, false]; }
|
||||
;
|
||||
|
||||
variable:
|
||||
@ -784,19 +839,19 @@ variable:
|
||||
;
|
||||
|
||||
new_expr_array_deref:
|
||||
'(' new_expr ')' '[' dim_offset ']' { $$ = Expr_ArrayDimFetch[$2, $5]; }
|
||||
| new_expr_array_deref '[' dim_offset ']' { $$ = Expr_ArrayDimFetch[$1, $3]; }
|
||||
'(' new_expr ')' '[' dim_offset ']' { $$ = Expr\ArrayDimFetch[$2, $5]; }
|
||||
| new_expr_array_deref '[' dim_offset ']' { $$ = Expr\ArrayDimFetch[$1, $3]; }
|
||||
/* alternative array syntax missing intentionally */
|
||||
;
|
||||
|
||||
object_access:
|
||||
variable_or_new_expr T_OBJECT_OPERATOR object_property
|
||||
{ $$ = Expr_PropertyFetch[$1, $3]; }
|
||||
{ $$ = Expr\PropertyFetch[$1, $3]; }
|
||||
| variable_or_new_expr T_OBJECT_OPERATOR object_property argument_list
|
||||
{ $$ = Expr_MethodCall[$1, $3, $4]; }
|
||||
| object_access argument_list { $$ = Expr_FuncCall[$1, $2]; }
|
||||
| object_access '[' dim_offset ']' { $$ = Expr_ArrayDimFetch[$1, $3]; }
|
||||
| object_access '{' expr '}' { $$ = Expr_ArrayDimFetch[$1, $3]; }
|
||||
{ $$ = Expr\MethodCall[$1, $3, $4]; }
|
||||
| object_access argument_list { $$ = Expr\FuncCall[$1, $2]; }
|
||||
| object_access '[' dim_offset ']' { $$ = Expr\ArrayDimFetch[$1, $3]; }
|
||||
| object_access '{' expr '}' { $$ = Expr\ArrayDimFetch[$1, $3]; }
|
||||
;
|
||||
|
||||
variable_or_new_expr:
|
||||
@ -806,7 +861,7 @@ variable_or_new_expr:
|
||||
|
||||
variable_without_objects:
|
||||
reference_variable { $$ = $1; }
|
||||
| '$' variable_without_objects { $$ = Expr_Variable[$2]; }
|
||||
| '$' variable_without_objects { $$ = Expr\Variable[$2]; }
|
||||
;
|
||||
|
||||
base_variable:
|
||||
@ -816,24 +871,24 @@ base_variable:
|
||||
|
||||
static_property:
|
||||
class_name_or_var T_PAAMAYIM_NEKUDOTAYIM '$' reference_variable
|
||||
{ $$ = Expr_StaticPropertyFetch[$1, $4]; }
|
||||
{ $$ = Expr\StaticPropertyFetch[$1, $4]; }
|
||||
| static_property_with_arrays { $$ = $1; }
|
||||
;
|
||||
|
||||
static_property_with_arrays:
|
||||
class_name_or_var T_PAAMAYIM_NEKUDOTAYIM T_VARIABLE
|
||||
{ $$ = Expr_StaticPropertyFetch[$1, parseVar($3)]; }
|
||||
{ $$ = Expr\StaticPropertyFetch[$1, parseVar($3)]; }
|
||||
| class_name_or_var T_PAAMAYIM_NEKUDOTAYIM '$' '{' expr '}'
|
||||
{ $$ = Expr_StaticPropertyFetch[$1, $5]; }
|
||||
| static_property_with_arrays '[' dim_offset ']' { $$ = Expr_ArrayDimFetch[$1, $3]; }
|
||||
| static_property_with_arrays '{' expr '}' { $$ = Expr_ArrayDimFetch[$1, $3]; }
|
||||
{ $$ = Expr\StaticPropertyFetch[$1, $5]; }
|
||||
| static_property_with_arrays '[' dim_offset ']' { $$ = Expr\ArrayDimFetch[$1, $3]; }
|
||||
| static_property_with_arrays '{' expr '}' { $$ = Expr\ArrayDimFetch[$1, $3]; }
|
||||
;
|
||||
|
||||
reference_variable:
|
||||
reference_variable '[' dim_offset ']' { $$ = Expr_ArrayDimFetch[$1, $3]; }
|
||||
| reference_variable '{' expr '}' { $$ = Expr_ArrayDimFetch[$1, $3]; }
|
||||
| T_VARIABLE { $$ = Expr_Variable[parseVar($1)]; }
|
||||
| '$' '{' expr '}' { $$ = Expr_Variable[$3]; }
|
||||
reference_variable '[' dim_offset ']' { $$ = Expr\ArrayDimFetch[$1, $3]; }
|
||||
| reference_variable '{' expr '}' { $$ = Expr\ArrayDimFetch[$1, $3]; }
|
||||
| T_VARIABLE { $$ = Expr\Variable[parseVar($1)]; }
|
||||
| '$' '{' expr '}' { $$ = Expr\Variable[$3]; }
|
||||
;
|
||||
|
||||
dim_offset:
|
||||
@ -848,7 +903,7 @@ object_property:
|
||||
;
|
||||
|
||||
list_expr:
|
||||
T_LIST '(' list_expr_elements ')' { $$ = Expr_List[$3]; }
|
||||
T_LIST '(' list_expr_elements ')' { $$ = Expr\List_[$3]; }
|
||||
;
|
||||
|
||||
list_expr_elements:
|
||||
@ -873,10 +928,10 @@ non_empty_array_pair_list:
|
||||
;
|
||||
|
||||
array_pair:
|
||||
expr T_DOUBLE_ARROW expr { $$ = Expr_ArrayItem[$3, $1, false]; }
|
||||
| expr { $$ = Expr_ArrayItem[$1, null, false]; }
|
||||
| expr T_DOUBLE_ARROW '&' variable { $$ = Expr_ArrayItem[$4, $1, true]; }
|
||||
| '&' variable { $$ = Expr_ArrayItem[$2, null, true]; }
|
||||
expr T_DOUBLE_ARROW expr { $$ = Expr\ArrayItem[$3, $1, false]; }
|
||||
| expr { $$ = Expr\ArrayItem[$1, null, false]; }
|
||||
| expr T_DOUBLE_ARROW '&' variable { $$ = Expr\ArrayItem[$4, $1, true]; }
|
||||
| '&' variable { $$ = Expr\ArrayItem[$2, null, true]; }
|
||||
;
|
||||
|
||||
encaps_list:
|
||||
@ -887,20 +942,20 @@ encaps_list:
|
||||
;
|
||||
|
||||
encaps_var:
|
||||
T_VARIABLE { $$ = Expr_Variable[parseVar($1)]; }
|
||||
| T_VARIABLE '[' encaps_var_offset ']' { $$ = Expr_ArrayDimFetch[Expr_Variable[parseVar($1)], $3]; }
|
||||
| T_VARIABLE T_OBJECT_OPERATOR T_STRING { $$ = Expr_PropertyFetch[Expr_Variable[parseVar($1)], $3]; }
|
||||
| T_DOLLAR_OPEN_CURLY_BRACES expr '}' { $$ = Expr_Variable[$2]; }
|
||||
| T_DOLLAR_OPEN_CURLY_BRACES T_STRING_VARNAME '}' { $$ = Expr_Variable[$2]; }
|
||||
T_VARIABLE { $$ = Expr\Variable[parseVar($1)]; }
|
||||
| T_VARIABLE '[' encaps_var_offset ']' { $$ = Expr\ArrayDimFetch[Expr\Variable[parseVar($1)], $3]; }
|
||||
| T_VARIABLE T_OBJECT_OPERATOR T_STRING { $$ = Expr\PropertyFetch[Expr\Variable[parseVar($1)], $3]; }
|
||||
| T_DOLLAR_OPEN_CURLY_BRACES expr '}' { $$ = Expr\Variable[$2]; }
|
||||
| T_DOLLAR_OPEN_CURLY_BRACES T_STRING_VARNAME '}' { $$ = Expr\Variable[$2]; }
|
||||
| T_DOLLAR_OPEN_CURLY_BRACES T_STRING_VARNAME '[' expr ']' '}'
|
||||
{ $$ = Expr_ArrayDimFetch[Expr_Variable[$2], $4]; }
|
||||
{ $$ = Expr\ArrayDimFetch[Expr\Variable[$2], $4]; }
|
||||
| T_CURLY_OPEN variable '}' { $$ = $2; }
|
||||
;
|
||||
|
||||
encaps_var_offset:
|
||||
T_STRING { $$ = Scalar_String[$1]; }
|
||||
| T_NUM_STRING { $$ = Scalar_String[$1]; }
|
||||
| T_VARIABLE { $$ = Expr_Variable[parseVar($1)]; }
|
||||
T_STRING { $$ = Scalar\String[$1]; }
|
||||
| T_NUM_STRING { $$ = Scalar\String[$1]; }
|
||||
| T_VARIABLE { $$ = Expr\Variable[parseVar($1)]; }
|
||||
;
|
||||
|
||||
%%
|
||||
|
@ -1,33 +0,0 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @codeCoverageIgnore
|
||||
*/
|
||||
class PHPParser_Autoloader
|
||||
{
|
||||
/**
|
||||
* Registers PHPParser_Autoloader as an SPL autoloader.
|
||||
*/
|
||||
static public function register()
|
||||
{
|
||||
ini_set('unserialize_callback_func', 'spl_autoload_call');
|
||||
spl_autoload_register(array(__CLASS__, 'autoload'));
|
||||
}
|
||||
|
||||
/**
|
||||
* Handles autoloading of classes.
|
||||
*
|
||||
* @param string $class A class name.
|
||||
*/
|
||||
static public function autoload($class)
|
||||
{
|
||||
if (0 !== strpos($class, 'PHPParser')) {
|
||||
return;
|
||||
}
|
||||
|
||||
$file = dirname(dirname(__FILE__)) . '/' . strtr($class, '_', '/') . '.php';
|
||||
if (is_file($file)) {
|
||||
require $file;
|
||||
}
|
||||
}
|
||||
}
|
@ -1,5 +0,0 @@
|
||||
<?php
|
||||
|
||||
class PHPParser_Comment_Doc extends PHPParser_Comment
|
||||
{
|
||||
}
|
@ -1,200 +0,0 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* ATTENTION: This code is WRITE-ONLY. Do not try to read it.
|
||||
*/
|
||||
class PHPParser_Lexer_Emulative extends PHPParser_Lexer
|
||||
{
|
||||
protected $newKeywords;
|
||||
protected $inObjectAccess;
|
||||
|
||||
public function __construct() {
|
||||
parent::__construct();
|
||||
|
||||
$newKeywordsPerVersion = array(
|
||||
'5.5.0-dev' => array(
|
||||
'finally' => PHPParser_Parser::T_FINALLY,
|
||||
'yield' => PHPParser_Parser::T_YIELD,
|
||||
),
|
||||
'5.4.0-dev' => array(
|
||||
'callable' => PHPParser_Parser::T_CALLABLE,
|
||||
'insteadof' => PHPParser_Parser::T_INSTEADOF,
|
||||
'trait' => PHPParser_Parser::T_TRAIT,
|
||||
'__trait__' => PHPParser_Parser::T_TRAIT_C,
|
||||
),
|
||||
'5.3.0-dev' => array(
|
||||
'__dir__' => PHPParser_Parser::T_DIR,
|
||||
'goto' => PHPParser_Parser::T_GOTO,
|
||||
'namespace' => PHPParser_Parser::T_NAMESPACE,
|
||||
'__namespace__' => PHPParser_Parser::T_NS_C,
|
||||
),
|
||||
);
|
||||
|
||||
$this->newKeywords = array();
|
||||
foreach ($newKeywordsPerVersion as $version => $newKeywords) {
|
||||
if (version_compare(PHP_VERSION, $version, '>=')) {
|
||||
break;
|
||||
}
|
||||
|
||||
$this->newKeywords += $newKeywords;
|
||||
}
|
||||
}
|
||||
|
||||
public function startLexing($code) {
|
||||
$this->inObjectAccess = false;
|
||||
|
||||
// on PHP 5.4 don't do anything
|
||||
if (version_compare(PHP_VERSION, '5.4.0RC1', '>=')) {
|
||||
parent::startLexing($code);
|
||||
} else {
|
||||
$code = $this->preprocessCode($code);
|
||||
parent::startLexing($code);
|
||||
$this->postprocessTokens();
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Replaces new features in the code by ~__EMU__{NAME}__{DATA}__~ sequences.
|
||||
* ~LABEL~ is never valid PHP code, that's why we can (to some degree) safely
|
||||
* use it here.
|
||||
* Later when preprocessing the tokens these sequences will either be replaced
|
||||
* by real tokens or replaced with their original content (e.g. if they occured
|
||||
* inside a string, i.e. a place where they don't have a special meaning).
|
||||
*/
|
||||
protected function preprocessCode($code) {
|
||||
// binary notation (0b010101101001...)
|
||||
$code = preg_replace('(\b0b[01]+\b)', '~__EMU__BINARY__$0__~', $code);
|
||||
|
||||
if (version_compare(PHP_VERSION, '5.3.0', '<')) {
|
||||
// namespace separator (backslash not followed by some special characters,
|
||||
// which are not valid after a NS separator, but would cause problems with
|
||||
// escape sequence parsing if one would replace the backslash there)
|
||||
$code = preg_replace('(\\\\(?!["\'`${\\\\]))', '~__EMU__NS__~', $code);
|
||||
|
||||
// nowdoc (<<<'ABC'\ncontent\nABC;)
|
||||
$code = preg_replace_callback(
|
||||
'((*BSR_ANYCRLF) # set \R to (?>\r\n|\r|\n)
|
||||
(b?<<<[\t ]*\'([a-zA-Z_\x7f-\xff][a-zA-Z0-9_\x7f-\xff]*)\'\R) # opening token
|
||||
((?:(?!\2;?\R).*\R)*) # content
|
||||
(\2) # closing token
|
||||
(?=;?\R) # must be followed by newline (with optional semicolon)
|
||||
)x',
|
||||
array($this, 'encodeNowdocCallback'),
|
||||
$code
|
||||
);
|
||||
}
|
||||
|
||||
return $code;
|
||||
}
|
||||
|
||||
/*
|
||||
* As nowdocs can have arbitrary content but LABELs can only contain a certain
|
||||
* range of characters, the nowdoc content is encoded as hex and separated by
|
||||
* 'x' tokens. So the result of the encoding will look like this:
|
||||
* ~__EMU__NOWDOC__{HEX(START_TOKEN)}x{HEX(CONTENT)}x{HEX(END_TOKEN)}~
|
||||
*/
|
||||
public function encodeNowdocCallback(array $matches) {
|
||||
return '~__EMU__NOWDOC__'
|
||||
. bin2hex($matches[1]) . 'x' . bin2hex($matches[3]) . 'x' . bin2hex($matches[4])
|
||||
. '__~';
|
||||
}
|
||||
|
||||
/*
|
||||
* Replaces the ~__EMU__...~ sequences with real tokens or their original
|
||||
* value.
|
||||
*/
|
||||
protected function postprocessTokens() {
|
||||
// we need to manually iterate and manage a count because we'll change
|
||||
// the tokens array on the way
|
||||
for ($i = 0, $c = count($this->tokens); $i < $c; ++$i) {
|
||||
// first check that the following tokens are form ~LABEL~,
|
||||
// then match the __EMU__... sequence.
|
||||
if ('~' === $this->tokens[$i]
|
||||
&& isset($this->tokens[$i + 2])
|
||||
&& '~' === $this->tokens[$i + 2]
|
||||
&& T_STRING === $this->tokens[$i + 1][0]
|
||||
&& preg_match('(^__EMU__([A-Z]++)__(?:([A-Za-z0-9]++)__)?$)', $this->tokens[$i + 1][1], $matches)
|
||||
) {
|
||||
if ('BINARY' === $matches[1]) {
|
||||
// the binary number can either be an integer or a double, so return a LNUMBER
|
||||
// or DNUMBER respectively
|
||||
$replace = array(
|
||||
array(is_int(bindec($matches[2])) ? T_LNUMBER : T_DNUMBER, $matches[2], $this->tokens[$i + 1][2])
|
||||
);
|
||||
} elseif ('NS' === $matches[1]) {
|
||||
// a \ single char token is returned here and replaced by a
|
||||
// PHPParser_Parser::T_NS_SEPARATOR token in ->getNextToken(). This hacks around
|
||||
// the limitations arising from T_NS_SEPARATOR not being defined on 5.3
|
||||
$replace = array('\\');
|
||||
} elseif ('NOWDOC' === $matches[1]) {
|
||||
// decode the encoded nowdoc payload; pack('H*' is bin2hex( for 5.3
|
||||
list($start, $content, $end) = explode('x', $matches[2]);
|
||||
list($start, $content, $end) = array(pack('H*', $start), pack('H*', $content), pack('H*', $end));
|
||||
|
||||
$replace = array();
|
||||
$replace[] = array(T_START_HEREDOC, $start, $this->tokens[$i + 1][2]);
|
||||
if ('' !== $content) {
|
||||
$replace[] = array(T_ENCAPSED_AND_WHITESPACE, $content, -1);
|
||||
}
|
||||
$replace[] = array(T_END_HEREDOC, $end, -1);
|
||||
} else {
|
||||
// just ignore all other __EMU__ sequences
|
||||
continue;
|
||||
}
|
||||
|
||||
array_splice($this->tokens, $i, 3, $replace);
|
||||
$c -= 3 - count($replace);
|
||||
// for multichar tokens (e.g. strings) replace any ~__EMU__...~ sequences
|
||||
// in their content with the original character sequence
|
||||
} elseif (is_array($this->tokens[$i])
|
||||
&& 0 !== strpos($this->tokens[$i][1], '__EMU__')
|
||||
) {
|
||||
$this->tokens[$i][1] = preg_replace_callback(
|
||||
'(~__EMU__([A-Z]++)__(?:([A-Za-z0-9]++)__)?~)',
|
||||
array($this, 'restoreContentCallback'),
|
||||
$this->tokens[$i][1]
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* This method is a callback for restoring EMU sequences in
|
||||
* multichar tokens (like strings) to their original value.
|
||||
*/
|
||||
public function restoreContentCallback(array $matches) {
|
||||
if ('BINARY' === $matches[1]) {
|
||||
return $matches[2];
|
||||
} elseif ('NS' === $matches[1]) {
|
||||
return '\\';
|
||||
} elseif ('NOWDOC' === $matches[1]) {
|
||||
list($start, $content, $end) = explode('x', $matches[2]);
|
||||
return pack('H*', $start) . pack('H*', $content) . pack('H*', $end);
|
||||
} else {
|
||||
return $matches[0];
|
||||
}
|
||||
}
|
||||
|
||||
public function getNextToken(&$value = null, &$startAttributes = null, &$endAttributes = null) {
|
||||
$token = parent::getNextToken($value, $startAttributes, $endAttributes);
|
||||
|
||||
// replace new keywords by their respective tokens. This is not done
|
||||
// if we currently are in an object access (e.g. in $obj->namespace
|
||||
// "namespace" stays a T_STRING tokens and isn't converted to T_NAMESPACE)
|
||||
if (PHPParser_Parser::T_STRING === $token && !$this->inObjectAccess) {
|
||||
if (isset($this->newKeywords[strtolower($value)])) {
|
||||
return $this->newKeywords[strtolower($value)];
|
||||
}
|
||||
// backslashes are replaced by T_NS_SEPARATOR tokens
|
||||
} elseif (92 === $token) { // ord('\\')
|
||||
return PHPParser_Parser::T_NS_SEPARATOR;
|
||||
// keep track of whether we currently are in an object access (after ->)
|
||||
} elseif (PHPParser_Parser::T_OBJECT_OPERATOR === $token) {
|
||||
$this->inObjectAccess = true;
|
||||
} else {
|
||||
$this->inObjectAccess = false;
|
||||
}
|
||||
|
||||
return $token;
|
||||
}
|
||||
}
|
@ -1,25 +0,0 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @property PHPParser_Node_Expr $value Value to pass
|
||||
* @property bool $byRef Whether to pass by ref
|
||||
*/
|
||||
class PHPParser_Node_Arg extends PHPParser_NodeAbstract
|
||||
{
|
||||
/**
|
||||
* Constructs a function call argument node.
|
||||
*
|
||||
* @param PHPParser_Node_Expr $value Value to pass
|
||||
* @param bool $byRef Whether to pass by ref
|
||||
* @param array $attributes Additional attributes
|
||||
*/
|
||||
public function __construct(PHPParser_Node_Expr $value, $byRef = false, array $attributes = array()) {
|
||||
parent::__construct(
|
||||
array(
|
||||
'value' => $value,
|
||||
'byRef' => $byRef
|
||||
),
|
||||
$attributes
|
||||
);
|
||||
}
|
||||
}
|
@ -1,25 +0,0 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @property string $name Name
|
||||
* @property PHPParser_Node_Expr $value Value
|
||||
*/
|
||||
class PHPParser_Node_Const extends PHPParser_NodeAbstract
|
||||
{
|
||||
/**
|
||||
* Constructs a const node for use in class const and const statements.
|
||||
*
|
||||
* @param string $name Name
|
||||
* @param PHPParser_Node_Expr $value Value
|
||||
* @param array $attributes Additional attributes
|
||||
*/
|
||||
public function __construct($name, PHPParser_Node_Expr $value, array $attributes = array()) {
|
||||
parent::__construct(
|
||||
array(
|
||||
'name' => $name,
|
||||
'value' => $value,
|
||||
),
|
||||
$attributes
|
||||
);
|
||||
}
|
||||
}
|
@ -1,5 +0,0 @@
|
||||
<?php
|
||||
|
||||
abstract class PHPParser_Node_Expr extends PHPParser_NodeAbstract
|
||||
{
|
||||
}
|
@ -1,25 +0,0 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @property PHPParser_Node_Expr $var Variable
|
||||
* @property null|PHPParser_Node_Expr $dim Array index / dim
|
||||
*/
|
||||
class PHPParser_Node_Expr_ArrayDimFetch extends PHPParser_Node_Expr
|
||||
{
|
||||
/**
|
||||
* Constructs an array index fetch node.
|
||||
*
|
||||
* @param PHPParser_Node_Expr $var Variable
|
||||
* @param null|PHPParser_Node_Expr $dim Array index / dim
|
||||
* @param array $attributes Additional attributes
|
||||
*/
|
||||
public function __construct(PHPParser_Node_Expr $var, PHPParser_Node_Expr $dim = null, array $attributes = array()) {
|
||||
parent::__construct(
|
||||
array(
|
||||
'var' => $var,
|
||||
'dim' => $dim
|
||||
),
|
||||
$attributes
|
||||
);
|
||||
}
|
||||
}
|
@ -1,28 +0,0 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @property PHPParser_Node_Expr $value Value
|
||||
* @property null|PHPParser_Node_Expr $key Key
|
||||
* @property bool $byRef Whether to assign by reference
|
||||
*/
|
||||
class PHPParser_Node_Expr_ArrayItem extends PHPParser_Node_Expr
|
||||
{
|
||||
/**
|
||||
* Constructs an array item node.
|
||||
*
|
||||
* @param PHPParser_Node_Expr $value Value
|
||||
* @param null|PHPParser_Node_Expr $key Key
|
||||
* @param bool $byRef Whether to assign by reference
|
||||
* @param array $attributes Additional attributes
|
||||
*/
|
||||
public function __construct(PHPParser_Node_Expr $value, PHPParser_Node_Expr $key = null, $byRef = false, array $attributes = array()) {
|
||||
parent::__construct(
|
||||
array(
|
||||
'key' => $key,
|
||||
'value' => $value,
|
||||
'byRef' => $byRef
|
||||
),
|
||||
$attributes
|
||||
);
|
||||
}
|
||||
}
|
@ -1,25 +0,0 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @property PHPParser_Node_Expr $var Variable
|
||||
* @property PHPParser_Node_Expr $expr Expression
|
||||
*/
|
||||
class PHPParser_Node_Expr_Assign extends PHPParser_Node_Expr
|
||||
{
|
||||
/**
|
||||
* Constructs an assignment node.
|
||||
*
|
||||
* @param PHPParser_Node_Expr $var Variable
|
||||
* @param PHPParser_Node_Expr $expr Expression
|
||||
* @param array $attributes Additional attributes
|
||||
*/
|
||||
public function __construct(PHPParser_Node_Expr $var, PHPParser_Node_Expr $expr, array $attributes = array()) {
|
||||
parent::__construct(
|
||||
array(
|
||||
'var' => $var,
|
||||
'expr' => $expr
|
||||
),
|
||||
$attributes
|
||||
);
|
||||
}
|
||||
}
|
@ -1,25 +0,0 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @property PHPParser_Node_Expr $var Variable
|
||||
* @property PHPParser_Node_Expr $expr Expression
|
||||
*/
|
||||
class PHPParser_Node_Expr_AssignBitwiseAnd extends PHPParser_Node_Expr
|
||||
{
|
||||
/**
|
||||
* Constructs an assignment with bitwise and node.
|
||||
*
|
||||
* @param PHPParser_Node_Expr $var Variable
|
||||
* @param PHPParser_Node_Expr $expr Expression
|
||||
* @param array $attributes Additional attributes
|
||||
*/
|
||||
public function __construct(PHPParser_Node_Expr $var, PHPParser_Node_Expr $expr, array $attributes = array()) {
|
||||
parent::__construct(
|
||||
array(
|
||||
'var' => $var,
|
||||
'expr' => $expr
|
||||
),
|
||||
$attributes
|
||||
);
|
||||
}
|
||||
}
|
@ -1,25 +0,0 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @property PHPParser_Node_Expr $var Variable
|
||||
* @property PHPParser_Node_Expr $expr Expression
|
||||
*/
|
||||
class PHPParser_Node_Expr_AssignBitwiseOr extends PHPParser_Node_Expr
|
||||
{
|
||||
/**
|
||||
* Constructs an assignment with bitwise or node.
|
||||
*
|
||||
* @param PHPParser_Node_Expr $var Variable
|
||||
* @param PHPParser_Node_Expr $expr Expression
|
||||
* @param array $attributes Additional attributes
|
||||
*/
|
||||
public function __construct(PHPParser_Node_Expr $var, PHPParser_Node_Expr $expr, array $attributes = array()) {
|
||||
parent::__construct(
|
||||
array(
|
||||
'var' => $var,
|
||||
'expr' => $expr
|
||||
),
|
||||
$attributes
|
||||
);
|
||||
}
|
||||
}
|
@ -1,25 +0,0 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @property PHPParser_Node_Expr $var Variable
|
||||
* @property PHPParser_Node_Expr $expr Expression
|
||||
*/
|
||||
class PHPParser_Node_Expr_AssignBitwiseXor extends PHPParser_Node_Expr
|
||||
{
|
||||
/**
|
||||
* Constructs an assignment with bitwise xor node.
|
||||
*
|
||||
* @param PHPParser_Node_Expr $var Variable
|
||||
* @param PHPParser_Node_Expr $expr Expression
|
||||
* @param array $attributes Additional attributes
|
||||
*/
|
||||
public function __construct(PHPParser_Node_Expr $var, PHPParser_Node_Expr $expr, array $attributes = array()) {
|
||||
parent::__construct(
|
||||
array(
|
||||
'var' => $var,
|
||||
'expr' => $expr
|
||||
),
|
||||
$attributes
|
||||
);
|
||||
}
|
||||
}
|
@ -1,25 +0,0 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @property PHPParser_Node_Expr $var Variable
|
||||
* @property PHPParser_Node_Expr $expr Expression
|
||||
*/
|
||||
class PHPParser_Node_Expr_AssignConcat extends PHPParser_Node_Expr
|
||||
{
|
||||
/**
|
||||
* Constructs an assignment with concat node.
|
||||
*
|
||||
* @param PHPParser_Node_Expr $var Variable
|
||||
* @param PHPParser_Node_Expr $expr Expression
|
||||
* @param array $attributes Additional attributes
|
||||
*/
|
||||
public function __construct(PHPParser_Node_Expr $var, PHPParser_Node_Expr $expr, array $attributes = array()) {
|
||||
parent::__construct(
|
||||
array(
|
||||
'var' => $var,
|
||||
'expr' => $expr
|
||||
),
|
||||
$attributes
|
||||
);
|
||||
}
|
||||
}
|
@ -1,25 +0,0 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @property PHPParser_Node_Expr $var Variable
|
||||
* @property PHPParser_Node_Expr $expr Expression
|
||||
*/
|
||||
class PHPParser_Node_Expr_AssignDiv extends PHPParser_Node_Expr
|
||||
{
|
||||
/**
|
||||
* Constructs an assignment with division node.
|
||||
*
|
||||
* @param PHPParser_Node_Expr $var Variable
|
||||
* @param PHPParser_Node_Expr $expr Expression
|
||||
* @param array $attributes Additional attributes
|
||||
*/
|
||||
public function __construct(PHPParser_Node_Expr $var, PHPParser_Node_Expr $expr, array $attributes = array()) {
|
||||
parent::__construct(
|
||||
array(
|
||||
'var' => $var,
|
||||
'expr' => $expr
|
||||
),
|
||||
$attributes
|
||||
);
|
||||
}
|
||||
}
|
@ -1,25 +0,0 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @property PHPParser_Node_Expr $var Variable
|
||||
* @property PHPParser_Node_Expr $expr Expression
|
||||
*/
|
||||
class PHPParser_Node_Expr_AssignMinus extends PHPParser_Node_Expr
|
||||
{
|
||||
/**
|
||||
* Constructs an assignment with minus node.
|
||||
*
|
||||
* @param PHPParser_Node_Expr $var Variable
|
||||
* @param PHPParser_Node_Expr $expr Expression
|
||||
* @param array $attributes Additional attributes
|
||||
*/
|
||||
public function __construct(PHPParser_Node_Expr $var, PHPParser_Node_Expr $expr, array $attributes = array()) {
|
||||
parent::__construct(
|
||||
array(
|
||||
'var' => $var,
|
||||
'expr' => $expr
|
||||
),
|
||||
$attributes
|
||||
);
|
||||
}
|
||||
}
|
@ -1,25 +0,0 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @property PHPParser_Node_Expr $var Variable
|
||||
* @property PHPParser_Node_Expr $expr Expression
|
||||
*/
|
||||
class PHPParser_Node_Expr_AssignMod extends PHPParser_Node_Expr
|
||||
{
|
||||
/**
|
||||
* Constructs an assignment with modulo node.
|
||||
*
|
||||
* @param PHPParser_Node_Expr $var Variable
|
||||
* @param PHPParser_Node_Expr $expr Expression
|
||||
* @param array $attributes Additional attributes
|
||||
*/
|
||||
public function __construct(PHPParser_Node_Expr $var, PHPParser_Node_Expr $expr, array $attributes = array()) {
|
||||
parent::__construct(
|
||||
array(
|
||||
'var' => $var,
|
||||
'expr' => $expr
|
||||
),
|
||||
$attributes
|
||||
);
|
||||
}
|
||||
}
|
@ -1,25 +0,0 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @property PHPParser_Node_Expr $var Variable
|
||||
* @property PHPParser_Node_Expr $expr Expression
|
||||
*/
|
||||
class PHPParser_Node_Expr_AssignMul extends PHPParser_Node_Expr
|
||||
{
|
||||
/**
|
||||
* Constructs an assignment with multiplication node.
|
||||
*
|
||||
* @param PHPParser_Node_Expr $var Variable
|
||||
* @param PHPParser_Node_Expr $expr Expression
|
||||
* @param array $attributes Additional attributes
|
||||
*/
|
||||
public function __construct(PHPParser_Node_Expr $var, PHPParser_Node_Expr $expr, array $attributes = array()) {
|
||||
parent::__construct(
|
||||
array(
|
||||
'var' => $var,
|
||||
'expr' => $expr
|
||||
),
|
||||
$attributes
|
||||
);
|
||||
}
|
||||
}
|
@ -1,25 +0,0 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @property PHPParser_Node_Expr $var Variable
|
||||
* @property PHPParser_Node_Expr $expr Expression
|
||||
*/
|
||||
class PHPParser_Node_Expr_AssignPlus extends PHPParser_Node_Expr
|
||||
{
|
||||
/**
|
||||
* Constructs an assignment with addition node.
|
||||
*
|
||||
* @param PHPParser_Node_Expr $var Variable
|
||||
* @param PHPParser_Node_Expr $expr Expression
|
||||
* @param array $attributes Additional attributes
|
||||
*/
|
||||
public function __construct(PHPParser_Node_Expr $var, PHPParser_Node_Expr $expr, array $attributes = array()) {
|
||||
parent::__construct(
|
||||
array(
|
||||
'var' => $var,
|
||||
'expr' => $expr
|
||||
),
|
||||
$attributes
|
||||
);
|
||||
}
|
||||
}
|
@ -1,25 +0,0 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @property PHPParser_Node_Expr $var Variable reference is assigned to
|
||||
* @property PHPParser_Node_Expr $expr Variable which is referenced
|
||||
*/
|
||||
class PHPParser_Node_Expr_AssignRef extends PHPParser_Node_Expr
|
||||
{
|
||||
/**
|
||||
* Constructs an assignment node.
|
||||
*
|
||||
* @param PHPParser_Node_Expr $var Variable
|
||||
* @param PHPParser_Node_Expr $expr Expression
|
||||
* @param array $attributes Additional attributes
|
||||
*/
|
||||
public function __construct(PHPParser_Node_Expr $var, PHPParser_Node_Expr $expr, array $attributes = array()) {
|
||||
parent::__construct(
|
||||
array(
|
||||
'var' => $var,
|
||||
'expr' => $expr
|
||||
),
|
||||
$attributes
|
||||
);
|
||||
}
|
||||
}
|
@ -1,25 +0,0 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @property PHPParser_Node_Expr $var Variable
|
||||
* @property PHPParser_Node_Expr $expr Expression
|
||||
*/
|
||||
class PHPParser_Node_Expr_AssignShiftLeft extends PHPParser_Node_Expr
|
||||
{
|
||||
/**
|
||||
* Constructs an assignment with left shift node.
|
||||
*
|
||||
* @param PHPParser_Node_Expr $var Variable
|
||||
* @param PHPParser_Node_Expr $expr Expression
|
||||
* @param array $attributes Additional attributes
|
||||
*/
|
||||
public function __construct(PHPParser_Node_Expr $var, PHPParser_Node_Expr $expr, array $attributes = array()) {
|
||||
parent::__construct(
|
||||
array(
|
||||
'var' => $var,
|
||||
'expr' => $expr
|
||||
),
|
||||
$attributes
|
||||
);
|
||||
}
|
||||
}
|
@ -1,25 +0,0 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @property PHPParser_Node_Expr $var Variable
|
||||
* @property PHPParser_Node_Expr $expr Expression
|
||||
*/
|
||||
class PHPParser_Node_Expr_AssignShiftRight extends PHPParser_Node_Expr
|
||||
{
|
||||
/**
|
||||
* Constructs an assignment with right shift node.
|
||||
*
|
||||
* @param PHPParser_Node_Expr $var Variable
|
||||
* @param PHPParser_Node_Expr $expr Expression
|
||||
* @param array $attributes Additional attributes
|
||||
*/
|
||||
public function __construct(PHPParser_Node_Expr $var, PHPParser_Node_Expr $expr, array $attributes = array()) {
|
||||
parent::__construct(
|
||||
array(
|
||||
'var' => $var,
|
||||
'expr' => $expr
|
||||
),
|
||||
$attributes
|
||||
);
|
||||
}
|
||||
}
|
@ -1,25 +0,0 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @property PHPParser_Node_Expr $left The left hand side expression
|
||||
* @property PHPParser_Node_Expr $right The right hand side expression
|
||||
*/
|
||||
class PHPParser_Node_Expr_BitwiseAnd extends PHPParser_Node_Expr
|
||||
{
|
||||
/**
|
||||
* Constructs a bitwise and node.
|
||||
*
|
||||
* @param PHPParser_Node_Expr $left The left hand side expression
|
||||
* @param PHPParser_Node_Expr $right The right hand side expression
|
||||
* @param array $attributes Additional attributes
|
||||
*/
|
||||
public function __construct(PHPParser_Node_Expr $left, PHPParser_Node_Expr $right, array $attributes = array()) {
|
||||
parent::__construct(
|
||||
array(
|
||||
'left' => $left,
|
||||
'right' => $right
|
||||
),
|
||||
$attributes
|
||||
);
|
||||
}
|
||||
}
|
@ -1,22 +0,0 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @property PHPParser_Node_Expr $expr Expression
|
||||
*/
|
||||
class PHPParser_Node_Expr_BitwiseNot extends PHPParser_Node_Expr
|
||||
{
|
||||
/**
|
||||
* Constructs a bitwise not node.
|
||||
*
|
||||
* @param PHPParser_Node_Expr $expr Expression
|
||||
* @param array $attributes Additional attributes
|
||||
*/
|
||||
public function __construct(PHPParser_Node_Expr $expr, array $attributes = array()) {
|
||||
parent::__construct(
|
||||
array(
|
||||
'expr' => $expr
|
||||
),
|
||||
$attributes
|
||||
);
|
||||
}
|
||||
}
|
@ -1,25 +0,0 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @property PHPParser_Node_Expr $left The left hand side expression
|
||||
* @property PHPParser_Node_Expr $right The right hand side expression
|
||||
*/
|
||||
class PHPParser_Node_Expr_BitwiseOr extends PHPParser_Node_Expr
|
||||
{
|
||||
/**
|
||||
* Constructs a bitwise or node.
|
||||
*
|
||||
* @param PHPParser_Node_Expr $left The left hand side expression
|
||||
* @param PHPParser_Node_Expr $right The right hand side expression
|
||||
* @param array $attributes Additional attributes
|
||||
*/
|
||||
public function __construct(PHPParser_Node_Expr $left, PHPParser_Node_Expr $right, array $attributes = array()) {
|
||||
parent::__construct(
|
||||
array(
|
||||
'left' => $left,
|
||||
'right' => $right
|
||||
),
|
||||
$attributes
|
||||
);
|
||||
}
|
||||
}
|
@ -1,25 +0,0 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @property PHPParser_Node_Expr $left The left hand side expression
|
||||
* @property PHPParser_Node_Expr $right The right hand side expression
|
||||
*/
|
||||
class PHPParser_Node_Expr_BitwiseXor extends PHPParser_Node_Expr
|
||||
{
|
||||
/**
|
||||
* Constructs a bitwise xor node.
|
||||
*
|
||||
* @param PHPParser_Node_Expr $left The left hand side expression
|
||||
* @param PHPParser_Node_Expr $right The right hand side expression
|
||||
* @param array $attributes Additional attributes
|
||||
*/
|
||||
public function __construct(PHPParser_Node_Expr $left, PHPParser_Node_Expr $right, array $attributes = array()) {
|
||||
parent::__construct(
|
||||
array(
|
||||
'left' => $left,
|
||||
'right' => $right
|
||||
),
|
||||
$attributes
|
||||
);
|
||||
}
|
||||
}
|
@ -1,25 +0,0 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @property PHPParser_Node_Expr $left The left hand side expression
|
||||
* @property PHPParser_Node_Expr $right The right hand side expression
|
||||
*/
|
||||
class PHPParser_Node_Expr_BooleanAnd extends PHPParser_Node_Expr
|
||||
{
|
||||
/**
|
||||
* Constructs a boolean and node.
|
||||
*
|
||||
* @param PHPParser_Node_Expr $left The left hand side expression
|
||||
* @param PHPParser_Node_Expr $right The right hand side expression
|
||||
* @param array $attributes Additional attributes
|
||||
*/
|
||||
public function __construct(PHPParser_Node_Expr $left, PHPParser_Node_Expr $right, array $attributes = array()) {
|
||||
parent::__construct(
|
||||
array(
|
||||
'left' => $left,
|
||||
'right' => $right
|
||||
),
|
||||
$attributes
|
||||
);
|
||||
}
|
||||
}
|
@ -1,25 +0,0 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @property PHPParser_Node_Expr $left The left hand side expression
|
||||
* @property PHPParser_Node_Expr $right The right hand side expression
|
||||
*/
|
||||
class PHPParser_Node_Expr_BooleanOr extends PHPParser_Node_Expr
|
||||
{
|
||||
/**
|
||||
* Constructs a boolean or node.
|
||||
*
|
||||
* @param PHPParser_Node_Expr $left The left hand side expression
|
||||
* @param PHPParser_Node_Expr $right The right hand side expression
|
||||
* @param array $attributes Additional attributes
|
||||
*/
|
||||
public function __construct(PHPParser_Node_Expr $left, PHPParser_Node_Expr $right, array $attributes = array()) {
|
||||
parent::__construct(
|
||||
array(
|
||||
'left' => $left,
|
||||
'right' => $right
|
||||
),
|
||||
$attributes
|
||||
);
|
||||
}
|
||||
}
|
@ -1,22 +0,0 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @property PHPParser_Node_Expr $expr Expression
|
||||
*/
|
||||
abstract class PHPParser_Node_Expr_Cast extends PHPParser_Node_Expr
|
||||
{
|
||||
/**
|
||||
* Constructs a cast node.
|
||||
*
|
||||
* @param PHPParser_Node_Expr $expr Expression
|
||||
* @param array $attributes Additional attributes
|
||||
*/
|
||||
public function __construct(PHPParser_Node_Expr $expr, array $attributes = array()) {
|
||||
parent::__construct(
|
||||
array(
|
||||
'expr' => $expr
|
||||
),
|
||||
$attributes
|
||||
);
|
||||
}
|
||||
}
|
@ -1,5 +0,0 @@
|
||||
<?php
|
||||
|
||||
class PHPParser_Node_Expr_Cast_Array extends PHPParser_Node_Expr_Cast
|
||||
{
|
||||
}
|
@ -1,5 +0,0 @@
|
||||
<?php
|
||||
|
||||
class PHPParser_Node_Expr_Cast_Bool extends PHPParser_Node_Expr_Cast
|
||||
{
|
||||
}
|
@ -1,5 +0,0 @@
|
||||
<?php
|
||||
|
||||
class PHPParser_Node_Expr_Cast_Double extends PHPParser_Node_Expr_Cast
|
||||
{
|
||||
}
|
@ -1,5 +0,0 @@
|
||||
<?php
|
||||
|
||||
class PHPParser_Node_Expr_Cast_Int extends PHPParser_Node_Expr_Cast
|
||||
{
|
||||
}
|
@ -1,5 +0,0 @@
|
||||
<?php
|
||||
|
||||
class PHPParser_Node_Expr_Cast_Object extends PHPParser_Node_Expr_Cast
|
||||
{
|
||||
}
|
@ -1,5 +0,0 @@
|
||||
<?php
|
||||
|
||||
class PHPParser_Node_Expr_Cast_String extends PHPParser_Node_Expr_Cast
|
||||
{
|
||||
}
|
@ -1,5 +0,0 @@
|
||||
<?php
|
||||
|
||||
class PHPParser_Node_Expr_Cast_Unset extends PHPParser_Node_Expr_Cast
|
||||
{
|
||||
}
|
@ -1,25 +0,0 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @property PHPParser_Node_Name|PHPParser_Node_Expr $class Class name
|
||||
* @property string $name Constant name
|
||||
*/
|
||||
class PHPParser_Node_Expr_ClassConstFetch extends PHPParser_Node_Expr
|
||||
{
|
||||
/**
|
||||
* Constructs a class const fetch node.
|
||||
*
|
||||
* @param PHPParser_Node_Name|PHPParser_Node_Expr $class Class name
|
||||
* @param string $name Constant name
|
||||
* @param array $attributes Additional attributes
|
||||
*/
|
||||
public function __construct($class, $name, array $attributes = array()) {
|
||||
parent::__construct(
|
||||
array(
|
||||
'class' => $class,
|
||||
'name' => $name
|
||||
),
|
||||
$attributes
|
||||
);
|
||||
}
|
||||
}
|
@ -1,22 +0,0 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @property PHPParser_Node_Expr $expr Expression
|
||||
*/
|
||||
class PHPParser_Node_Expr_Clone extends PHPParser_Node_Expr
|
||||
{
|
||||
/**
|
||||
* Constructs a clone node.
|
||||
*
|
||||
* @param PHPParser_Node_Expr $expr Expression
|
||||
* @param array $attributes Additional attributes
|
||||
*/
|
||||
public function __construct(PHPParser_Node_Expr $expr, array $attributes = array()) {
|
||||
parent::__construct(
|
||||
array(
|
||||
'expr' => $expr
|
||||
),
|
||||
$attributes
|
||||
);
|
||||
}
|
||||
}
|
@ -1,35 +0,0 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @property PHPParser_Node[] $stmts Statements
|
||||
* @property PHPParser_Node_Param[] $params Parameters
|
||||
* @property PHPParser_Node_Expr_ClosureUse[] $uses use()s
|
||||
* @property bool $byRef Whether to return by reference
|
||||
* @property bool $static Whether the closure is static
|
||||
*/
|
||||
class PHPParser_Node_Expr_Closure extends PHPParser_Node_Expr
|
||||
{
|
||||
/**
|
||||
* Constructs a lambda function node.
|
||||
*
|
||||
* @param array $subNodes Array of the following optional subnodes:
|
||||
* 'stmts' => array(): Statements
|
||||
* 'params' => array(): Parameters
|
||||
* 'uses' => array(): use()s
|
||||
* 'byRef' => false : Whether to return by reference
|
||||
* 'static' => false : Whether the closure is static
|
||||
* @param array $attributes Additional attributes
|
||||
*/
|
||||
public function __construct(array $subNodes = array(), array $attributes = array()) {
|
||||
parent::__construct(
|
||||
$subNodes + array(
|
||||
'stmts' => array(),
|
||||
'params' => array(),
|
||||
'uses' => array(),
|
||||
'byRef' => false,
|
||||
'static' => false,
|
||||
),
|
||||
$attributes
|
||||
);
|
||||
}
|
||||
}
|
@ -1,25 +0,0 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @property PHPParser_Node_Expr $left The left hand side expression
|
||||
* @property PHPParser_Node_Expr $right The right hand side expression
|
||||
*/
|
||||
class PHPParser_Node_Expr_Concat extends PHPParser_Node_Expr
|
||||
{
|
||||
/**
|
||||
* Constructs a concat node.
|
||||
*
|
||||
* @param PHPParser_Node_Expr $left The left hand side expression
|
||||
* @param PHPParser_Node_Expr $right The right hand side expression
|
||||
* @param array $attributes Additional attributes
|
||||
*/
|
||||
public function __construct(PHPParser_Node_Expr $left, PHPParser_Node_Expr $right, array $attributes = array()) {
|
||||
parent::__construct(
|
||||
array(
|
||||
'left' => $left,
|
||||
'right' => $right
|
||||
),
|
||||
$attributes
|
||||
);
|
||||
}
|
||||
}
|
@ -1,22 +0,0 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @property PHPParser_Node_Name $name Constant name
|
||||
*/
|
||||
class PHPParser_Node_Expr_ConstFetch extends PHPParser_Node_Expr
|
||||
{
|
||||
/**
|
||||
* Constructs a const fetch node.
|
||||
*
|
||||
* @param PHPParser_Node_Name $name Constant name
|
||||
* @param array $attributes Additional attributes
|
||||
*/
|
||||
public function __construct(PHPParser_Node_Name $name, array $attributes = array()) {
|
||||
parent::__construct(
|
||||
array(
|
||||
'name' => $name
|
||||
),
|
||||
$attributes
|
||||
);
|
||||
}
|
||||
}
|
@ -1,25 +0,0 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @property PHPParser_Node_Expr $left The left hand side expression
|
||||
* @property PHPParser_Node_Expr $right The right hand side expression
|
||||
*/
|
||||
class PHPParser_Node_Expr_Div extends PHPParser_Node_Expr
|
||||
{
|
||||
/**
|
||||
* Constructs a division node.
|
||||
*
|
||||
* @param PHPParser_Node_Expr $left The left hand side expression
|
||||
* @param PHPParser_Node_Expr $right The right hand side expression
|
||||
* @param array $attributes Additional attributes
|
||||
*/
|
||||
public function __construct(PHPParser_Node_Expr $left, PHPParser_Node_Expr $right, array $attributes = array()) {
|
||||
parent::__construct(
|
||||
array(
|
||||
'left' => $left,
|
||||
'right' => $right
|
||||
),
|
||||
$attributes
|
||||
);
|
||||
}
|
||||
}
|
@ -1,22 +0,0 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @property PHPParser_Node_Expr $expr Expression
|
||||
*/
|
||||
class PHPParser_Node_Expr_Empty extends PHPParser_Node_Expr
|
||||
{
|
||||
/**
|
||||
* Constructs an empty() node.
|
||||
*
|
||||
* @param PHPParser_Node_Expr $expr Expression
|
||||
* @param array $attributes Additional attributes
|
||||
*/
|
||||
public function __construct(PHPParser_Node_Expr $expr, array $attributes = array()) {
|
||||
parent::__construct(
|
||||
array(
|
||||
'expr' => $expr
|
||||
),
|
||||
$attributes
|
||||
);
|
||||
}
|
||||
}
|
@ -1,25 +0,0 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @property PHPParser_Node_Expr $left The left hand side expression
|
||||
* @property PHPParser_Node_Expr $right The right hand side expression
|
||||
*/
|
||||
class PHPParser_Node_Expr_Equal extends PHPParser_Node_Expr
|
||||
{
|
||||
/**
|
||||
* Constructs a equality comparison node.
|
||||
*
|
||||
* @param PHPParser_Node_Expr $left The left hand side expression
|
||||
* @param PHPParser_Node_Expr $right The right hand side expression
|
||||
* @param array $attributes Additional attributes
|
||||
*/
|
||||
public function __construct(PHPParser_Node_Expr $left, PHPParser_Node_Expr $right, array $attributes = array()) {
|
||||
parent::__construct(
|
||||
array(
|
||||
'left' => $left,
|
||||
'right' => $right
|
||||
),
|
||||
$attributes
|
||||
);
|
||||
}
|
||||
}
|
@ -1,22 +0,0 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @property PHPParser_Node_Expr $expr Expression
|
||||
*/
|
||||
class PHPParser_Node_Expr_ErrorSuppress extends PHPParser_Node_Expr
|
||||
{
|
||||
/**
|
||||
* Constructs an error suppress node.
|
||||
*
|
||||
* @param PHPParser_Node_Expr $expr Expression
|
||||
* @param array $attributes Additional attributes
|
||||
*/
|
||||
public function __construct(PHPParser_Node_Expr $expr, array $attributes = array()) {
|
||||
parent::__construct(
|
||||
array(
|
||||
'expr' => $expr
|
||||
),
|
||||
$attributes
|
||||
);
|
||||
}
|
||||
}
|
@ -1,22 +0,0 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @property PHPParser_Node_Expr $expr Expression
|
||||
*/
|
||||
class PHPParser_Node_Expr_Eval extends PHPParser_Node_Expr
|
||||
{
|
||||
/**
|
||||
* Constructs an eval() node.
|
||||
*
|
||||
* @param PHPParser_Node_Expr $expr Expression
|
||||
* @param array $attributes Additional attributes
|
||||
*/
|
||||
public function __construct(PHPParser_Node_Expr $expr, array $attributes = array()) {
|
||||
parent::__construct(
|
||||
array(
|
||||
'expr' => $expr
|
||||
),
|
||||
$attributes
|
||||
);
|
||||
}
|
||||
}
|
@ -1,25 +0,0 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @property PHPParser_Node_Expr $left The left hand side expression
|
||||
* @property PHPParser_Node_Expr $right The right hand side expression
|
||||
*/
|
||||
class PHPParser_Node_Expr_Greater extends PHPParser_Node_Expr
|
||||
{
|
||||
/**
|
||||
* Constructs a greater than comparison node.
|
||||
*
|
||||
* @param PHPParser_Node_Expr $left The left hand side expression
|
||||
* @param PHPParser_Node_Expr $right The right hand side expression
|
||||
* @param array $attributes Additional attributes
|
||||
*/
|
||||
public function __construct(PHPParser_Node_Expr $left, PHPParser_Node_Expr $right, array $attributes = array()) {
|
||||
parent::__construct(
|
||||
array(
|
||||
'left' => $left,
|
||||
'right' => $right
|
||||
),
|
||||
$attributes
|
||||
);
|
||||
}
|
||||
}
|
@ -1,25 +0,0 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @property PHPParser_Node_Expr $left The left hand side expression
|
||||
* @property PHPParser_Node_Expr $right The right hand side expression
|
||||
*/
|
||||
class PHPParser_Node_Expr_GreaterOrEqual extends PHPParser_Node_Expr
|
||||
{
|
||||
/**
|
||||
* Constructs a greater than or equal node.
|
||||
*
|
||||
* @param PHPParser_Node_Expr $left The left hand side expression
|
||||
* @param PHPParser_Node_Expr $right The right hand side expression
|
||||
* @param array $attributes Additional attributes
|
||||
*/
|
||||
public function __construct(PHPParser_Node_Expr $left, PHPParser_Node_Expr $right, array $attributes = array()) {
|
||||
parent::__construct(
|
||||
array(
|
||||
'left' => $left,
|
||||
'right' => $right
|
||||
),
|
||||
$attributes
|
||||
);
|
||||
}
|
||||
}
|
@ -1,25 +0,0 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @property PHPParser_Node_Expr $left The left hand side expression
|
||||
* @property PHPParser_Node_Expr $right The right hand side expression
|
||||
*/
|
||||
class PHPParser_Node_Expr_Identical extends PHPParser_Node_Expr
|
||||
{
|
||||
/**
|
||||
* Constructs an identicality comparison node.
|
||||
*
|
||||
* @param PHPParser_Node_Expr $left The left hand side expression
|
||||
* @param PHPParser_Node_Expr $right The right hand side expression
|
||||
* @param array $attributes Additional attributes
|
||||
*/
|
||||
public function __construct(PHPParser_Node_Expr $left, PHPParser_Node_Expr $right, array $attributes = array()) {
|
||||
parent::__construct(
|
||||
array(
|
||||
'left' => $left,
|
||||
'right' => $right
|
||||
),
|
||||
$attributes
|
||||
);
|
||||
}
|
||||
}
|
@ -1,30 +0,0 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @property PHPParser_Node_Expr $expr Expression
|
||||
* @property int $type Type of include
|
||||
*/
|
||||
class PHPParser_Node_Expr_Include extends PHPParser_Node_Expr
|
||||
{
|
||||
const TYPE_INCLUDE = 1;
|
||||
const TYPE_INCLUDE_ONCE = 2;
|
||||
const TYPE_REQUIRE = 3;
|
||||
const TYPE_REQUIRE_ONCE = 4;
|
||||
|
||||
/**
|
||||
* Constructs an include node.
|
||||
*
|
||||
* @param PHPParser_Node_Expr $expr Expression
|
||||
* @param int $type Type of include
|
||||
* @param array $attributes Additional attributes
|
||||
*/
|
||||
public function __construct(PHPParser_Node_Expr $expr, $type, array $attributes = array()) {
|
||||
parent::__construct(
|
||||
array(
|
||||
'expr' => $expr,
|
||||
'type' => $type
|
||||
),
|
||||
$attributes
|
||||
);
|
||||
}
|
||||
}
|
@ -1,25 +0,0 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @property PHPParser_Node_Expr $expr Expression
|
||||
* @property PHPParser_Node_Name|PHPParser_Node_Expr $class Class name
|
||||
*/
|
||||
class PHPParser_Node_Expr_Instanceof extends PHPParser_Node_Expr
|
||||
{
|
||||
/**
|
||||
* Constructs an instanceof check node.
|
||||
*
|
||||
* @param PHPParser_Node_Expr $expr Expression
|
||||
* @param PHPParser_Node_Name|PHPParser_Node_Expr $class Class name
|
||||
* @param array $attributes Additional attributes
|
||||
*/
|
||||
public function __construct(PHPParser_Node_Expr $expr, $class, array $attributes = array()) {
|
||||
parent::__construct(
|
||||
array(
|
||||
'expr' => $expr,
|
||||
'class' => $class
|
||||
),
|
||||
$attributes
|
||||
);
|
||||
}
|
||||
}
|
@ -1,25 +0,0 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @property PHPParser_Node_Expr $left The left hand side expression
|
||||
* @property PHPParser_Node_Expr $right The right hand side expression
|
||||
*/
|
||||
class PHPParser_Node_Expr_LogicalAnd extends PHPParser_Node_Expr
|
||||
{
|
||||
/**
|
||||
* Constructs a logical and node.
|
||||
*
|
||||
* @param PHPParser_Node_Expr $left The left hand side expression
|
||||
* @param PHPParser_Node_Expr $right The right hand side expression
|
||||
* @param array $attributes Additional attributes
|
||||
*/
|
||||
public function __construct(PHPParser_Node_Expr $left, PHPParser_Node_Expr $right, array $attributes = array()) {
|
||||
parent::__construct(
|
||||
array(
|
||||
'left' => $left,
|
||||
'right' => $right
|
||||
),
|
||||
$attributes
|
||||
);
|
||||
}
|
||||
}
|
@ -1,25 +0,0 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @property PHPParser_Node_Expr $left The left hand side expression
|
||||
* @property PHPParser_Node_Expr $right The right hand side expression
|
||||
*/
|
||||
class PHPParser_Node_Expr_LogicalOr extends PHPParser_Node_Expr
|
||||
{
|
||||
/**
|
||||
* Constructs a logical or node.
|
||||
*
|
||||
* @param PHPParser_Node_Expr $left The left hand side expression
|
||||
* @param PHPParser_Node_Expr $right The right hand side expression
|
||||
* @param array $attributes Additional attributes
|
||||
*/
|
||||
public function __construct(PHPParser_Node_Expr $left, PHPParser_Node_Expr $right, array $attributes = array()) {
|
||||
parent::__construct(
|
||||
array(
|
||||
'left' => $left,
|
||||
'right' => $right
|
||||
),
|
||||
$attributes
|
||||
);
|
||||
}
|
||||
}
|
@ -1,25 +0,0 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @property PHPParser_Node_Expr $left The left hand side expression
|
||||
* @property PHPParser_Node_Expr $right The right hand side expression
|
||||
*/
|
||||
class PHPParser_Node_Expr_LogicalXor extends PHPParser_Node_Expr
|
||||
{
|
||||
/**
|
||||
* Constructs a logical xor node.
|
||||
*
|
||||
* @param PHPParser_Node_Expr $left The left hand side expression
|
||||
* @param PHPParser_Node_Expr $right The right hand side expression
|
||||
* @param array $attributes Additional attributes
|
||||
*/
|
||||
public function __construct(PHPParser_Node_Expr $left, PHPParser_Node_Expr $right, array $attributes = array()) {
|
||||
parent::__construct(
|
||||
array(
|
||||
'left' => $left,
|
||||
'right' => $right
|
||||
),
|
||||
$attributes
|
||||
);
|
||||
}
|
||||
}
|
@ -1,28 +0,0 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @property PHPParser_Node_Expr $var Variable holding object
|
||||
* @property string|PHPParser_Node_Expr $name Method name
|
||||
* @property PHPParser_Node_Arg[] $args Arguments
|
||||
*/
|
||||
class PHPParser_Node_Expr_MethodCall extends PHPParser_Node_Expr
|
||||
{
|
||||
/**
|
||||
* Constructs a function call node.
|
||||
*
|
||||
* @param PHPParser_Node_Expr $var Variable holding object
|
||||
* @param string|PHPParser_Node_Expr $name Method name
|
||||
* @param PHPParser_Node_Arg[] $args Arguments
|
||||
* @param array $attributes Additional attributes
|
||||
*/
|
||||
public function __construct(PHPParser_Node_Expr $var, $name, array $args = array(), array $attributes = array()) {
|
||||
parent::__construct(
|
||||
array(
|
||||
'var' => $var,
|
||||
'name' => $name,
|
||||
'args' => $args
|
||||
),
|
||||
$attributes
|
||||
);
|
||||
}
|
||||
}
|
@ -1,25 +0,0 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @property PHPParser_Node_Expr $left The left hand side expression
|
||||
* @property PHPParser_Node_Expr $right The right hand side expression
|
||||
*/
|
||||
class PHPParser_Node_Expr_Minus extends PHPParser_Node_Expr
|
||||
{
|
||||
/**
|
||||
* Constructs a substraction node.
|
||||
*
|
||||
* @param PHPParser_Node_Expr $left The left hand side expression
|
||||
* @param PHPParser_Node_Expr $right The right hand side expression
|
||||
* @param array $attributes Additional attributes
|
||||
*/
|
||||
public function __construct(PHPParser_Node_Expr $left, PHPParser_Node_Expr $right, array $attributes = array()) {
|
||||
parent::__construct(
|
||||
array(
|
||||
'left' => $left,
|
||||
'right' => $right
|
||||
),
|
||||
$attributes
|
||||
);
|
||||
}
|
||||
}
|
@ -1,25 +0,0 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @property PHPParser_Node_Expr $left The left hand side expression
|
||||
* @property PHPParser_Node_Expr $right The right hand side expression
|
||||
*/
|
||||
class PHPParser_Node_Expr_Mod extends PHPParser_Node_Expr
|
||||
{
|
||||
/**
|
||||
* Constructs a modulo node.
|
||||
*
|
||||
* @param PHPParser_Node_Expr $left The left hand side expression
|
||||
* @param PHPParser_Node_Expr $right The right hand side expression
|
||||
* @param array $attributes Additional attributes
|
||||
*/
|
||||
public function __construct(PHPParser_Node_Expr $left, PHPParser_Node_Expr $right, array $attributes = array()) {
|
||||
parent::__construct(
|
||||
array(
|
||||
'left' => $left,
|
||||
'right' => $right
|
||||
),
|
||||
$attributes
|
||||
);
|
||||
}
|
||||
}
|
@ -1,25 +0,0 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @property PHPParser_Node_Expr $left The left hand side expression
|
||||
* @property PHPParser_Node_Expr $right The right hand side expression
|
||||
*/
|
||||
class PHPParser_Node_Expr_Mul extends PHPParser_Node_Expr
|
||||
{
|
||||
/**
|
||||
* Constructs a multiplication node.
|
||||
*
|
||||
* @param PHPParser_Node_Expr $left The left hand side expression
|
||||
* @param PHPParser_Node_Expr $right The right hand side expression
|
||||
* @param array $attributes Additional attributes
|
||||
*/
|
||||
public function __construct(PHPParser_Node_Expr $left, PHPParser_Node_Expr $right, array $attributes = array()) {
|
||||
parent::__construct(
|
||||
array(
|
||||
'left' => $left,
|
||||
'right' => $right
|
||||
),
|
||||
$attributes
|
||||
);
|
||||
}
|
||||
}
|
@ -1,25 +0,0 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @property PHPParser_Node_Name|PHPParser_Node_Expr $class Class name
|
||||
* @property PHPParser_Node_Arg[] $args Arguments
|
||||
*/
|
||||
class PHPParser_Node_Expr_New extends PHPParser_Node_Expr
|
||||
{
|
||||
/**
|
||||
* Constructs a function call node.
|
||||
*
|
||||
* @param PHPParser_Node_Name|PHPParser_Node_Expr $class Class name
|
||||
* @param PHPParser_Node_Arg[] $args Arguments
|
||||
* @param array $attributes Additional attributes
|
||||
*/
|
||||
public function __construct($class, array $args = array(), array $attributes = array()) {
|
||||
parent::__construct(
|
||||
array(
|
||||
'class' => $class,
|
||||
'args' => $args
|
||||
),
|
||||
$attributes
|
||||
);
|
||||
}
|
||||
}
|
@ -1,25 +0,0 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @property PHPParser_Node_Expr $left The left hand side expression
|
||||
* @property PHPParser_Node_Expr $right The right hand side expression
|
||||
*/
|
||||
class PHPParser_Node_Expr_NotEqual extends PHPParser_Node_Expr
|
||||
{
|
||||
/**
|
||||
* Constructs a not equal comparison node.
|
||||
*
|
||||
* @param PHPParser_Node_Expr $left The left hand side expression
|
||||
* @param PHPParser_Node_Expr $right The right hand side expression
|
||||
* @param array $attributes Additional attributes
|
||||
*/
|
||||
public function __construct(PHPParser_Node_Expr $left, PHPParser_Node_Expr $right, array $attributes = array()) {
|
||||
parent::__construct(
|
||||
array(
|
||||
'left' => $left,
|
||||
'right' => $right
|
||||
),
|
||||
$attributes
|
||||
);
|
||||
}
|
||||
}
|
@ -1,25 +0,0 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @property PHPParser_Node_Expr $left The left hand side expression
|
||||
* @property PHPParser_Node_Expr $right The right hand side expression
|
||||
*/
|
||||
class PHPParser_Node_Expr_NotIdentical extends PHPParser_Node_Expr
|
||||
{
|
||||
/**
|
||||
* Constructs a not identical comparison node.
|
||||
*
|
||||
* @param PHPParser_Node_Expr $left The left hand side expression
|
||||
* @param PHPParser_Node_Expr $right The right hand side expression
|
||||
* @param array $attributes Additional attributes
|
||||
*/
|
||||
public function __construct(PHPParser_Node_Expr $left, PHPParser_Node_Expr $right, array $attributes = array()) {
|
||||
parent::__construct(
|
||||
array(
|
||||
'left' => $left,
|
||||
'right' => $right
|
||||
),
|
||||
$attributes
|
||||
);
|
||||
}
|
||||
}
|
@ -1,25 +0,0 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @property PHPParser_Node_Expr $left The left hand side expression
|
||||
* @property PHPParser_Node_Expr $right The right hand side expression
|
||||
*/
|
||||
class PHPParser_Node_Expr_Plus extends PHPParser_Node_Expr
|
||||
{
|
||||
/**
|
||||
* Constructs an addition node.
|
||||
*
|
||||
* @param PHPParser_Node_Expr $left The left hand side expression
|
||||
* @param PHPParser_Node_Expr $right The right hand side expression
|
||||
* @param array $attributes Additional attributes
|
||||
*/
|
||||
public function __construct(PHPParser_Node_Expr $left, PHPParser_Node_Expr $right, array $attributes = array()) {
|
||||
parent::__construct(
|
||||
array(
|
||||
'left' => $left,
|
||||
'right' => $right
|
||||
),
|
||||
$attributes
|
||||
);
|
||||
}
|
||||
}
|
@ -1,22 +0,0 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @property PHPParser_Node_Expr $var Variable
|
||||
*/
|
||||
class PHPParser_Node_Expr_PostDec extends PHPParser_Node_Expr
|
||||
{
|
||||
/**
|
||||
* Constructs a post decrement node.
|
||||
*
|
||||
* @param PHPParser_Node_Expr $var Variable
|
||||
* @param array $attributes Additional attributes
|
||||
*/
|
||||
public function __construct(PHPParser_Node_Expr $var, array $attributes = array()) {
|
||||
parent::__construct(
|
||||
array(
|
||||
'var' => $var
|
||||
),
|
||||
$attributes
|
||||
);
|
||||
}
|
||||
}
|
@ -1,22 +0,0 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @property PHPParser_Node_Expr $var Variable
|
||||
*/
|
||||
class PHPParser_Node_Expr_PostInc extends PHPParser_Node_Expr
|
||||
{
|
||||
/**
|
||||
* Constructs a post increment node.
|
||||
*
|
||||
* @param PHPParser_Node_Expr $var Variable
|
||||
* @param array $attributes Additional attributes
|
||||
*/
|
||||
public function __construct(PHPParser_Node_Expr $var, array $attributes = array()) {
|
||||
parent::__construct(
|
||||
array(
|
||||
'var' => $var
|
||||
),
|
||||
$attributes
|
||||
);
|
||||
}
|
||||
}
|
@ -1,22 +0,0 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @property PHPParser_Node_Expr $var Variable
|
||||
*/
|
||||
class PHPParser_Node_Expr_PreDec extends PHPParser_Node_Expr
|
||||
{
|
||||
/**
|
||||
* Constructs a pre decrement node.
|
||||
*
|
||||
* @param PHPParser_Node_Expr $var Variable
|
||||
* @param array $attributes Additional attributes
|
||||
*/
|
||||
public function __construct(PHPParser_Node_Expr $var, array $attributes = array()) {
|
||||
parent::__construct(
|
||||
array(
|
||||
'var' => $var
|
||||
),
|
||||
$attributes
|
||||
);
|
||||
}
|
||||
}
|
@ -1,22 +0,0 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @property PHPParser_Node_Expr $var Variable
|
||||
*/
|
||||
class PHPParser_Node_Expr_PreInc extends PHPParser_Node_Expr
|
||||
{
|
||||
/**
|
||||
* Constructs a pre increment node.
|
||||
*
|
||||
* @param PHPParser_Node_Expr $var Variable
|
||||
* @param array $attributes Additional attributes
|
||||
*/
|
||||
public function __construct(PHPParser_Node_Expr $var, array $attributes = array()) {
|
||||
parent::__construct(
|
||||
array(
|
||||
'var' => $var
|
||||
),
|
||||
$attributes
|
||||
);
|
||||
}
|
||||
}
|
@ -1,22 +0,0 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @property PHPParser_Node_Expr $expr Expression
|
||||
*/
|
||||
class PHPParser_Node_Expr_Print extends PHPParser_Node_Expr
|
||||
{
|
||||
/**
|
||||
* Constructs an print() node.
|
||||
*
|
||||
* @param PHPParser_Node_Expr $expr Expression
|
||||
* @param array $attributes Additional attributes
|
||||
*/
|
||||
public function __construct(PHPParser_Node_Expr $expr, array $attributes = array()) {
|
||||
parent::__construct(
|
||||
array(
|
||||
'expr' => $expr
|
||||
),
|
||||
$attributes
|
||||
);
|
||||
}
|
||||
}
|
@ -1,25 +0,0 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @property PHPParser_Node_Expr $var Variable holding object
|
||||
* @property string|PHPParser_Node_Expr $name Property Name
|
||||
*/
|
||||
class PHPParser_Node_Expr_PropertyFetch extends PHPParser_Node_Expr
|
||||
{
|
||||
/**
|
||||
* Constructs a function call node.
|
||||
*
|
||||
* @param PHPParser_Node_Expr $var Variable holding object
|
||||
* @param string|PHPParser_Node_Expr $name Property name
|
||||
* @param array $attributes Additional attributes
|
||||
*/
|
||||
public function __construct(PHPParser_Node_Expr $var, $name, array $attributes = array()) {
|
||||
parent::__construct(
|
||||
array(
|
||||
'var' => $var,
|
||||
'name' => $name
|
||||
),
|
||||
$attributes
|
||||
);
|
||||
}
|
||||
}
|
@ -1,25 +0,0 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @property PHPParser_Node_Expr $left The left hand side expression
|
||||
* @property PHPParser_Node_Expr $right The right hand side expression
|
||||
*/
|
||||
class PHPParser_Node_Expr_ShiftLeft extends PHPParser_Node_Expr
|
||||
{
|
||||
/**
|
||||
* Constructs a shift left node.
|
||||
*
|
||||
* @param PHPParser_Node_Expr $left The left hand side expression
|
||||
* @param PHPParser_Node_Expr $right The right hand side expression
|
||||
* @param array $attributes Additional attributes
|
||||
*/
|
||||
public function __construct(PHPParser_Node_Expr $left, PHPParser_Node_Expr $right, array $attributes = array()) {
|
||||
parent::__construct(
|
||||
array(
|
||||
'left' => $left,
|
||||
'right' => $right
|
||||
),
|
||||
$attributes
|
||||
);
|
||||
}
|
||||
}
|
@ -1,25 +0,0 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @property PHPParser_Node_Expr $left The left hand side expression
|
||||
* @property PHPParser_Node_Expr $right The right hand side expression
|
||||
*/
|
||||
class PHPParser_Node_Expr_ShiftRight extends PHPParser_Node_Expr
|
||||
{
|
||||
/**
|
||||
* Constructs a shift right node.
|
||||
*
|
||||
* @param PHPParser_Node_Expr $left The left hand side expression
|
||||
* @param PHPParser_Node_Expr $right The right hand side expression
|
||||
* @param array $attributes Additional attributes
|
||||
*/
|
||||
public function __construct(PHPParser_Node_Expr $left, PHPParser_Node_Expr $right, array $attributes = array()) {
|
||||
parent::__construct(
|
||||
array(
|
||||
'left' => $left,
|
||||
'right' => $right
|
||||
),
|
||||
$attributes
|
||||
);
|
||||
}
|
||||
}
|
@ -1,25 +0,0 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @property PHPParser_Node_Expr $left The left hand side expression
|
||||
* @property PHPParser_Node_Expr $right The right hand side expression
|
||||
*/
|
||||
class PHPParser_Node_Expr_Smaller extends PHPParser_Node_Expr
|
||||
{
|
||||
/**
|
||||
* Constructs a smaller than comparison node.
|
||||
*
|
||||
* @param PHPParser_Node_Expr $left The left hand side expression
|
||||
* @param PHPParser_Node_Expr $right The right hand side expression
|
||||
* @param array $attributes Additional attributes
|
||||
*/
|
||||
public function __construct(PHPParser_Node_Expr $left, PHPParser_Node_Expr $right, array $attributes = array()) {
|
||||
parent::__construct(
|
||||
array(
|
||||
'left' => $left,
|
||||
'right' => $right
|
||||
),
|
||||
$attributes
|
||||
);
|
||||
}
|
||||
}
|
@ -1,25 +0,0 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @property PHPParser_Node_Expr $left The left hand side expression
|
||||
* @property PHPParser_Node_Expr $right The right hand side expression
|
||||
*/
|
||||
class PHPParser_Node_Expr_SmallerOrEqual extends PHPParser_Node_Expr
|
||||
{
|
||||
/**
|
||||
* Constructs a smaller than or equal comparison node.
|
||||
*
|
||||
* @param PHPParser_Node_Expr $left The left hand side expression
|
||||
* @param PHPParser_Node_Expr $right The right hand side expression
|
||||
* @param array $attributes Additional attributes
|
||||
*/
|
||||
public function __construct(PHPParser_Node_Expr $left, PHPParser_Node_Expr $right, array $attributes = array()) {
|
||||
parent::__construct(
|
||||
array(
|
||||
'left' => $left,
|
||||
'right' => $right
|
||||
),
|
||||
$attributes
|
||||
);
|
||||
}
|
||||
}
|
@ -1,28 +0,0 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @property PHPParser_Node_Name|PHPParser_Node_Expr $class Class name
|
||||
* @property string|PHPParser_Node_Expr $name Method name
|
||||
* @property PHPParser_Node_Arg[] $args Arguments
|
||||
*/
|
||||
class PHPParser_Node_Expr_StaticCall extends PHPParser_Node_Expr
|
||||
{
|
||||
/**
|
||||
* Constructs a static method call node.
|
||||
*
|
||||
* @param PHPParser_Node_Name|PHPParser_Node_Expr $class Class name
|
||||
* @param string|PHPParser_Node_Expr $name Method name
|
||||
* @param PHPParser_Node_Arg[] $args Arguments
|
||||
* @param array $attributes Additional attributes
|
||||
*/
|
||||
public function __construct($class, $name, array $args = array(), array $attributes = array()) {
|
||||
parent::__construct(
|
||||
array(
|
||||
'class' => $class,
|
||||
'name' => $name,
|
||||
'args' => $args
|
||||
),
|
||||
$attributes
|
||||
);
|
||||
}
|
||||
}
|
@ -1,25 +0,0 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @property PHPParser_Node_Name|PHPParser_Node_Expr $class Class name
|
||||
* @property string|PHPParser_Node_Expr $name Property name
|
||||
*/
|
||||
class PHPParser_Node_Expr_StaticPropertyFetch extends PHPParser_Node_Expr
|
||||
{
|
||||
/**
|
||||
* Constructs a static property fetch node.
|
||||
*
|
||||
* @param PHPParser_Node_Name|PHPParser_Node_Expr $class Class name
|
||||
* @param string|PHPParser_Node_Expr $name Property name
|
||||
* @param array $attributes Additional attributes
|
||||
*/
|
||||
public function __construct($class, $name, array $attributes = array()) {
|
||||
parent::__construct(
|
||||
array(
|
||||
'class' => $class,
|
||||
'name' => $name
|
||||
),
|
||||
$attributes
|
||||
);
|
||||
}
|
||||
}
|
@ -1,28 +0,0 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @property PHPParser_Node_Expr $cond Condition
|
||||
* @property null|PHPParser_Node_Expr $if Expression for true
|
||||
* @property PHPParser_Node_Expr $else Expression for false
|
||||
*/
|
||||
class PHPParser_Node_Expr_Ternary extends PHPParser_Node_Expr
|
||||
{
|
||||
/**
|
||||
* Constructs a ternary operator node.
|
||||
*
|
||||
* @param PHPParser_Node_Expr $cond Condition
|
||||
* @param null|PHPParser_Node_Expr $if Expression for true
|
||||
* @param PHPParser_Node_Expr $else Expression for false
|
||||
* @param array $attributes Additional attributes
|
||||
*/
|
||||
public function __construct(PHPParser_Node_Expr $cond, $if, PHPParser_Node_Expr $else, array $attributes = array()) {
|
||||
parent::__construct(
|
||||
array(
|
||||
'cond' => $cond,
|
||||
'if' => $if,
|
||||
'else' => $else
|
||||
),
|
||||
$attributes
|
||||
);
|
||||
}
|
||||
}
|
@ -1,22 +0,0 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @property PHPParser_Node_Expr $expr Expression
|
||||
*/
|
||||
class PHPParser_Node_Expr_UnaryMinus extends PHPParser_Node_Expr
|
||||
{
|
||||
/**
|
||||
* Constructs a unary minus node.
|
||||
*
|
||||
* @param PHPParser_Node_Expr $expr Expression
|
||||
* @param array $attributes Additional attributes
|
||||
*/
|
||||
public function __construct(PHPParser_Node_Expr $expr, array $attributes = array()) {
|
||||
parent::__construct(
|
||||
array(
|
||||
'expr' => $expr
|
||||
),
|
||||
$attributes
|
||||
);
|
||||
}
|
||||
}
|
@ -1,25 +0,0 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @property null|PHPParser_Node_Expr $value Value expression
|
||||
* @property null|PHPParser_Node_Expr $key Key expression
|
||||
*/
|
||||
class PHPParser_Node_Expr_Yield extends PHPParser_Node_Expr
|
||||
{
|
||||
/**
|
||||
* Constructs a yield expression node.
|
||||
*
|
||||
* @param null|PHPParser_Node_Expr $value ´ Value expression
|
||||
* @param null|PHPParser_Node_Expr $key Key expression
|
||||
* @param array $attributes Additional attributes
|
||||
*/
|
||||
public function __construct(PHPParser_Node_Expr $value = null, PHPParser_Node_Expr $key = null, array $attributes = array()) {
|
||||
parent::__construct(
|
||||
array(
|
||||
'key' => $key,
|
||||
'value' => $value,
|
||||
),
|
||||
$attributes
|
||||
);
|
||||
}
|
||||
}
|
@ -1,31 +0,0 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @property string $name Name
|
||||
* @property null|PHPParser_Node_Expr $default Default value
|
||||
* @property null|string|PHPParser_Node_Name $type Typehint
|
||||
* @property bool $byRef Whether is passed by reference
|
||||
*/
|
||||
class PHPParser_Node_Param extends PHPParser_NodeAbstract
|
||||
{
|
||||
/**
|
||||
* Constructs a parameter node.
|
||||
*
|
||||
* @param string $name Name
|
||||
* @param null|PHPParser_Node_Expr $default Default value
|
||||
* @param null|string|PHPParser_Node_Name $type Typehint
|
||||
* @param bool $byRef Whether is passed by reference
|
||||
* @param array $attributes Additional attributes
|
||||
*/
|
||||
public function __construct($name, $default = null, $type = null, $byRef = false, array $attributes = array()) {
|
||||
parent::__construct(
|
||||
array(
|
||||
'name' => $name,
|
||||
'default' => $default,
|
||||
'type' => $type,
|
||||
'byRef' => $byRef
|
||||
),
|
||||
$attributes
|
||||
);
|
||||
}
|
||||
}
|
@ -1,5 +0,0 @@
|
||||
<?php
|
||||
|
||||
abstract class PHPParser_Node_Scalar extends PHPParser_Node_Expr
|
||||
{
|
||||
}
|
@ -1,13 +0,0 @@
|
||||
<?php
|
||||
|
||||
class PHPParser_Node_Scalar_ClassConst extends PHPParser_Node_Scalar
|
||||
{
|
||||
/**
|
||||
* Constructs a __CLASS__ const node
|
||||
*
|
||||
* @param array $attributes Additional attributes
|
||||
*/
|
||||
public function __construct(array $attributes = array()) {
|
||||
parent::__construct(array(), $attributes);
|
||||
}
|
||||
}
|
@ -1,13 +0,0 @@
|
||||
<?php
|
||||
|
||||
class PHPParser_Node_Scalar_DirConst extends PHPParser_Node_Scalar
|
||||
{
|
||||
/**
|
||||
* Constructs a __DIR__ const node
|
||||
*
|
||||
* @param array $attributes Additional attributes
|
||||
*/
|
||||
public function __construct(array $attributes = array()) {
|
||||
parent::__construct(array(), $attributes);
|
||||
}
|
||||
}
|
@ -1,13 +0,0 @@
|
||||
<?php
|
||||
|
||||
class PHPParser_Node_Scalar_FileConst extends PHPParser_Node_Scalar
|
||||
{
|
||||
/**
|
||||
* Constructs a __FILE__ const node
|
||||
*
|
||||
* @param array $attributes Additional attributes
|
||||
*/
|
||||
public function __construct(array $attributes = array()) {
|
||||
parent::__construct(array(), $attributes);
|
||||
}
|
||||
}
|
@ -1,13 +0,0 @@
|
||||
<?php
|
||||
|
||||
class PHPParser_Node_Scalar_FuncConst extends PHPParser_Node_Scalar
|
||||
{
|
||||
/**
|
||||
* Constructs a __FUNCTION__ const node
|
||||
*
|
||||
* @param array $attributes Additional attributes
|
||||
*/
|
||||
public function __construct(array $attributes = array()) {
|
||||
parent::__construct(array(), $attributes);
|
||||
}
|
||||
}
|
@ -1,13 +0,0 @@
|
||||
<?php
|
||||
|
||||
class PHPParser_Node_Scalar_LineConst extends PHPParser_Node_Scalar
|
||||
{
|
||||
/**
|
||||
* Constructs a __LINE__ const node
|
||||
*
|
||||
* @param array $attributes Additional attributes
|
||||
*/
|
||||
public function __construct(array $attributes = array()) {
|
||||
parent::__construct(array(), $attributes);
|
||||
}
|
||||
}
|
@ -1,13 +0,0 @@
|
||||
<?php
|
||||
|
||||
class PHPParser_Node_Scalar_MethodConst extends PHPParser_Node_Scalar
|
||||
{
|
||||
/**
|
||||
* Constructs a __METHOD__ const node
|
||||
*
|
||||
* @param array $attributes Additional attributes
|
||||
*/
|
||||
public function __construct(array $attributes = array()) {
|
||||
parent::__construct(array(), $attributes);
|
||||
}
|
||||
}
|
@ -1,13 +0,0 @@
|
||||
<?php
|
||||
|
||||
class PHPParser_Node_Scalar_NSConst extends PHPParser_Node_Scalar
|
||||
{
|
||||
/**
|
||||
* Constructs a __NAMESPACE__ const node
|
||||
*
|
||||
* @param array $attributes Additional attributes
|
||||
*/
|
||||
public function __construct(array $attributes = array()) {
|
||||
parent::__construct(array(), $attributes);
|
||||
}
|
||||
}
|
@ -1,13 +0,0 @@
|
||||
<?php
|
||||
|
||||
class PHPParser_Node_Scalar_TraitConst extends PHPParser_Node_Scalar
|
||||
{
|
||||
/**
|
||||
* Constructs a __TRAIT__ const node
|
||||
*
|
||||
* @param array $attributes Additional attributes
|
||||
*/
|
||||
public function __construct(array $attributes = array()) {
|
||||
parent::__construct(array(), $attributes);
|
||||
}
|
||||
}
|
@ -1,5 +0,0 @@
|
||||
<?php
|
||||
|
||||
abstract class PHPParser_Node_Stmt extends PHPParser_NodeAbstract
|
||||
{
|
||||
}
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user