mirror of
https://github.com/nikic/PHP-Parser.git
synced 2025-01-17 15:18:17 +01:00
Prefix all classes with PHPParser_
This commit is contained in:
parent
4006e55951
commit
620525a5da
49
README.md
49
README.md
@ -4,8 +4,7 @@ PHP Parser
|
||||
This is a PHP parser written in PHP. It's purpose is to simplify static code analysis and
|
||||
manipulation.
|
||||
|
||||
***Note: This project is work in progress. It is known to not function perfectly correct yet (see
|
||||
the "Known Issues" section at the end of this document).***
|
||||
***Note: This project is highly experimental. It may not always function correctly.***
|
||||
|
||||
Components
|
||||
==========
|
||||
@ -19,33 +18,34 @@ This package currently bundles several components:
|
||||
Parser and ParserDebug
|
||||
----------------------
|
||||
|
||||
Parsing is performed using `Parser->parse()`. This method accepts a `Lexer` as the only parameter
|
||||
and returns an array of statement nodes. If an error occurs it throws a ParseErrorException.
|
||||
Parsing is performed using `PHPParser_Parser->parse()`. This method accepts a `PHPParser_Lexer`
|
||||
as the only parameter and returns an array of statement nodes. If an error occurs it throws a
|
||||
PHPParser_ParseErrorException.
|
||||
|
||||
$code = '<?php // some code';
|
||||
|
||||
try {
|
||||
$parser = new Parser;
|
||||
$stmts = $parser->parse(new Lexer($code));
|
||||
} catch (ParseErrorException $e) {
|
||||
$parser = new PHPParser_Parser;
|
||||
$stmts = $parser->parse(new PHPParser_Lexer($code));
|
||||
} catch (PHPParser_ParseErrorException $e) {
|
||||
echo 'Parse Error: ', $e->getMessage();
|
||||
}
|
||||
|
||||
The `ParserDebug` class also parses a PHP code, but outputs a debug trace while doing so.
|
||||
The `PHPParser_ParserDebug` class also parses a PHP code, but outputs a debug trace while doing so.
|
||||
|
||||
Node Tree
|
||||
---------
|
||||
|
||||
The output of the parser is an array of statement nodes. All nodes are instances of `NodeAbstract`.
|
||||
Furthermore nodes are divided into three categories:
|
||||
The output of the parser is an array of statement nodes. All nodes are instances of
|
||||
`PHPParser_NodeAbstract`. Furthermore nodes are divided into three categories:
|
||||
|
||||
* `Node_Stmt`: A statement
|
||||
* `Node_Expr`: An expression
|
||||
* `Node_Scalar`: A scalar (which is a string, a number, aso.)
|
||||
`Node_Scalar` inherits from `Node_Expr`.
|
||||
* `PHPParser_Node_Stmt`: A statement
|
||||
* `PHPParser_Node_Expr`: An expression
|
||||
* `PHPParser_Node_Scalar`: A scalar (which is a string, a number, aso.)
|
||||
`PHPParser_Node_Scalar` inherits from `PHPParser_Node_Expr`.
|
||||
|
||||
Each node may have subnodes. For example `Node_Expr_Plus` has two subnodes, namely `left` and
|
||||
`right`, which represend the left hand side and right hand side expressions of the plus operation.
|
||||
Each node may have subnodes. For example `PHPParser_Node_Expr_Plus` has two subnodes, namely `left`
|
||||
and `right`, which represend the left hand side and right hand side expressions of the plus operation.
|
||||
Subnodes are accessed as normal properties:
|
||||
|
||||
$node->left
|
||||
@ -56,7 +56,7 @@ respective files.
|
||||
NodeDumper
|
||||
----------
|
||||
|
||||
Nodes can be dumped into a string representation using the `NodeDumper->dump()` method:
|
||||
Nodes can be dumped into a string representation using the `PHPParser_NodeDumper->dump()` method:
|
||||
|
||||
$code = <<<'CODE'
|
||||
<?php
|
||||
@ -68,12 +68,12 @@ Nodes can be dumped into a string representation using the `NodeDumper->dump()`
|
||||
CODE;
|
||||
|
||||
try {
|
||||
$parser = new Parser;
|
||||
$stmts = $parser->parse(new Lexer($code));
|
||||
$parser = new PHPParser_Parser;
|
||||
$stmts = $parser->parse(new PHPParser_Lexer($code));
|
||||
|
||||
$nodeDumper = new NodeDumper;
|
||||
$nodeDumper = new PHPParser_NodeDumper;
|
||||
echo '<pre>' . htmlspecialchars($nodeDumper->dump($stmts)) . '</pre>';
|
||||
} catch (ParseErrorException $e) {
|
||||
} catch (PHPParser_ParseErrorException $e) {
|
||||
echo 'Parse Error: ', $e->getMessage();
|
||||
}
|
||||
|
||||
@ -132,7 +132,7 @@ PrettyPrinter
|
||||
The pretty printer compiles nodes back to PHP code. "Pretty printing" here is just the formal
|
||||
name of the process and does not mean that the output is in any way pretty.
|
||||
|
||||
$prettyPrinter = new PrettyPrinter_Zend;
|
||||
$prettyPrinter = new PHPParser_PrettyPrinter_Zend;
|
||||
echo '<pre>' . htmlspecialchars($prettyPrinter->prettyPrint($stmts)) . '</pre>';
|
||||
|
||||
For the code mentioned in the above section this should create the output:
|
||||
@ -141,7 +141,4 @@ For the code mentioned in the above section this should create the output:
|
||||
{
|
||||
echo $msg, "\n";
|
||||
}
|
||||
printLine('Hallo World!!!');
|
||||
|
||||
Known Issues
|
||||
============
|
||||
printLine('Hallo World!!!');
|
@ -142,11 +142,11 @@ class YYParser
|
||||
* Parses PHP code into a node tree and prints out debugging information.
|
||||
#endif
|
||||
*
|
||||
* @param Lexer $lex A lexer
|
||||
* @param PHPParser_Lexer $lex A lexer
|
||||
*
|
||||
* @return array Array of statements
|
||||
*/
|
||||
public function parse(Lexer $lex) {
|
||||
public function parse(PHPParser_Lexer $lex) {
|
||||
$this->yyastk = array();
|
||||
$yysstk = array();
|
||||
$this->yysp = 0;
|
||||
@ -230,11 +230,11 @@ class YYParser
|
||||
#endif
|
||||
try {
|
||||
if ('HALT_COMPILER' === $this->{'yyn' . $yyn}()) {
|
||||
$this->yyval = new Node_Stmt_HaltCompiler(
|
||||
$this->yyval = new PHPParser_Node_Stmt_HaltCompiler(
|
||||
array('remaining' => $lex->handleHaltCompiler())
|
||||
);
|
||||
}
|
||||
} catch (ParseErrorException $e) {
|
||||
} catch (PHPParser_ParseErrorException $e) {
|
||||
$e->setRawLine($lex->getLine());
|
||||
|
||||
throw $e;
|
||||
@ -260,7 +260,7 @@ class YYParser
|
||||
/*switch ($yyerrflag) {
|
||||
case 0:*/
|
||||
#endif
|
||||
throw new ParseErrorException(
|
||||
throw new PHPParser_ParseErrorException(
|
||||
'Unexpected token ' . self::$yyterminals[$yychar],
|
||||
$lex->getLine()
|
||||
);
|
||||
|
@ -36,7 +36,7 @@ echo '<pre>';
|
||||
|
||||
$code = file_get_contents(IN);
|
||||
|
||||
$code = preg_replace('~[A-Z][a-zA-Z_]++::~', 'Node_$0', $code);
|
||||
$code = preg_replace('~[A-Z][a-zA-Z_]++::~', 'PHPParser_Node_$0', $code);
|
||||
$code = resolveNodes($code);
|
||||
$code = resolveMacros($code);
|
||||
|
||||
@ -63,7 +63,7 @@ function resolveNodes($code) {
|
||||
$paramCodes[] = '\'' . $key . '\' => ' . $value;
|
||||
}
|
||||
|
||||
return 'new Node_' . $matches['name'] . '(array(' . implode(', ', $paramCodes) . '))';
|
||||
return 'new PHPParser_Node_' . $matches['name'] . '(array(' . implode(', ', $paramCodes) . '))';
|
||||
},
|
||||
$code
|
||||
);
|
||||
|
@ -3,7 +3,7 @@
|
||||
echo '<pre>';
|
||||
|
||||
echo 'Building parser. Output: "',
|
||||
`kmyacc -l -v -L c -m php.kmyacc -p Parser zend_language_parser.phpy`,
|
||||
`kmyacc -l -v -L c -m php.kmyacc -p PHPParser_Parser zend_language_parser.phpy`,
|
||||
'"', "\n";
|
||||
|
||||
$source = file_get_contents('y.tab.c');
|
||||
@ -13,12 +13,12 @@ $source = str_replace(
|
||||
$source
|
||||
);
|
||||
|
||||
echo 'Moving parser to lib/Parser.php.', "\n";
|
||||
file_put_contents(dirname(__DIR__) . '/lib/Parser.php', $source);
|
||||
echo 'Moving parser to lib/PHPParser/Parser.php.', "\n";
|
||||
file_put_contents(dirname(__DIR__) . '/lib/PHPParser/Parser.php', $source);
|
||||
unlink(__DIR__ . '/y.tab.c');
|
||||
|
||||
echo 'Building debug parser. Output: "',
|
||||
`kmyacc -l -v -t -L c -m php.kmyacc -p ParserDebug zend_language_parser.phpy`,
|
||||
`kmyacc -l -v -t -L c -m php.kmyacc -p PHPParser_ParserDebug zend_language_parser.phpy`,
|
||||
'"', "\n";
|
||||
|
||||
$source = file_get_contents('y.tab.c');
|
||||
@ -34,8 +34,8 @@ $source = str_replace(
|
||||
$source
|
||||
);
|
||||
|
||||
echo 'Moving debug parser to lib/ParserDebug.php.', "\n";
|
||||
file_put_contents(dirname(__DIR__) . '/lib/ParserDebug.php', $source);
|
||||
echo 'Moving debug parser to lib/PHPParser/ParserDebug.php.', "\n";
|
||||
file_put_contents(dirname(__DIR__) . '/lib/PHPParser/ParserDebug.php', $source);
|
||||
unlink(__DIR__ . '/y.tab.c');
|
||||
|
||||
echo 'Done.';
|
||||
|
@ -1530,8 +1530,8 @@ state 15
|
||||
. reduce (93)
|
||||
|
||||
state 16
|
||||
(24) inner_statement_list : inner_statement_list . inner_statement
|
||||
(105) new_else_single : T_ELSE ':' inner_statement_list .
|
||||
(24) inner_statement_list : inner_statement_list . inner_statement
|
||||
|
||||
T_INCLUDE shift 56
|
||||
T_INCLUDE_ONCE shift 57
|
||||
@ -1730,8 +1730,8 @@ state 17
|
||||
. reduce (92)
|
||||
|
||||
state 18
|
||||
(24) inner_statement_list : inner_statement_list . inner_statement
|
||||
(101) new_elseif_list : new_elseif_list T_ELSEIF '(' expr ')' ':' inner_statement_list .
|
||||
(24) inner_statement_list : inner_statement_list . inner_statement
|
||||
|
||||
T_INCLUDE shift 56
|
||||
T_INCLUDE_ONCE shift 57
|
||||
@ -11966,6 +11966,7 @@ state 163
|
||||
. error
|
||||
|
||||
state 164
|
||||
(101) new_elseif_list : new_elseif_list T_ELSEIF '(' expr . ')' ':' inner_statement_list
|
||||
(181) expr : expr . T_BOOLEAN_OR expr
|
||||
(182) expr : expr . T_BOOLEAN_AND expr
|
||||
(183) expr : expr . T_LOGICAL_OR expr
|
||||
@ -11993,7 +11994,6 @@ state 164
|
||||
(209) expr : expr . T_INSTANCEOF class_name_reference
|
||||
(211) expr : expr . '?' expr ':' expr
|
||||
(212) expr : expr . '?' ':' expr
|
||||
(101) new_elseif_list : new_elseif_list T_ELSEIF '(' expr . ')' ':' inner_statement_list
|
||||
|
||||
T_LOGICAL_OR shift 83
|
||||
T_LOGICAL_XOR shift 84
|
||||
@ -16273,8 +16273,8 @@ state 305
|
||||
. reduce (102)
|
||||
|
||||
state 306
|
||||
(32) statement : T_IF '(' expr ')' ':' inner_statement_list new_elseif_list . new_else_single T_ENDIF ';'
|
||||
(101) new_elseif_list : new_elseif_list . T_ELSEIF '(' expr ')' ':' inner_statement_list
|
||||
(32) statement : T_IF '(' expr ')' ':' inner_statement_list new_elseif_list . new_else_single T_ENDIF ';'
|
||||
(104) new_else_single : .
|
||||
|
||||
T_ELSEIF shift 493
|
||||
@ -17399,9 +17399,9 @@ state 443
|
||||
. error
|
||||
|
||||
state 444
|
||||
(106) parameter_list : non_empty_parameter_list .
|
||||
(110) non_empty_parameter_list : non_empty_parameter_list . ',' optional_class_type optional_ref T_VARIABLE
|
||||
(111) non_empty_parameter_list : non_empty_parameter_list . ',' optional_class_type optional_ref T_VARIABLE '=' static_scalar
|
||||
(106) parameter_list : non_empty_parameter_list .
|
||||
|
||||
',' shift 262
|
||||
. reduce (106)
|
||||
@ -19432,4 +19432,4 @@ Statistics for zend_language_parser.phpy:
|
||||
3815 items
|
||||
1124 lookahead sets used
|
||||
13442+794=14236 action entries
|
||||
228096 bytes used
|
||||
229400 bytes used
|
||||
|
@ -113,7 +113,7 @@ top_statement_list:
|
||||
;
|
||||
|
||||
namespace_name:
|
||||
namespace_name_sub { $$ = new Node_Name(array('parts' => $1)); }
|
||||
namespace_name_sub { $$ = new PHPParser_Node_Name(array('parts' => $1)); }
|
||||
;
|
||||
|
||||
namespace_name_sub:
|
||||
@ -126,11 +126,11 @@ top_statement:
|
||||
| function_declaration_statement { $$ = $1; }
|
||||
| class_declaration_statement { $$ = $1; }
|
||||
| T_HALT_COMPILER { return 'HALT_COMPILER'; }
|
||||
| T_NAMESPACE namespace_name ';' { $$ = new Node_Stmt_Namespace(array('ns' => $2)); }
|
||||
| T_NAMESPACE namespace_name '{' top_statement_list '}' { $$ = array(new Node_Stmt_Namespace(array('ns' => $2)), $4); }
|
||||
| T_NAMESPACE '{' top_statement_list '}' { $$ = array(new Node_Stmt_Namespace(array('ns' => null)), $3); }
|
||||
| T_USE use_declarations ';' { $$ = new Node_Stmt_Use(array('uses' => $2)); }
|
||||
| constant_declaration ';' { $$ = new Node_Stmt_Const(array('consts' => $1)); }
|
||||
| T_NAMESPACE namespace_name ';' { $$ = new PHPParser_Node_Stmt_Namespace(array('ns' => $2)); }
|
||||
| T_NAMESPACE namespace_name '{' top_statement_list '}' { $$ = array(new PHPParser_Node_Stmt_Namespace(array('ns' => $2)), $4); }
|
||||
| T_NAMESPACE '{' top_statement_list '}' { $$ = array(new PHPParser_Node_Stmt_Namespace(array('ns' => null)), $3); }
|
||||
| T_USE use_declarations ';' { $$ = new PHPParser_Node_Stmt_Use(array('uses' => $2)); }
|
||||
| constant_declaration ';' { $$ = new PHPParser_Node_Stmt_Const(array('consts' => $1)); }
|
||||
;
|
||||
|
||||
use_declarations:
|
||||
@ -139,15 +139,15 @@ use_declarations:
|
||||
;
|
||||
|
||||
use_declaration:
|
||||
namespace_name { $$ = new Node_Stmt_UseUse(array('ns' => $1, 'alias' => null)); }
|
||||
| namespace_name T_AS T_STRING { $$ = new Node_Stmt_UseUse(array('ns' => $1, 'alias' => $3)); }
|
||||
| T_NS_SEPARATOR namespace_name { $$ = new Node_Stmt_UseUse(array('ns' => $2, 'alias' => null)); }
|
||||
| T_NS_SEPARATOR namespace_name T_AS T_STRING { $$ = new Node_Stmt_UseUse(array('ns' => $2, 'alias' => $4)); }
|
||||
namespace_name { $$ = new PHPParser_Node_Stmt_UseUse(array('ns' => $1, 'alias' => null)); }
|
||||
| namespace_name T_AS T_STRING { $$ = new PHPParser_Node_Stmt_UseUse(array('ns' => $1, 'alias' => $3)); }
|
||||
| T_NS_SEPARATOR namespace_name { $$ = new PHPParser_Node_Stmt_UseUse(array('ns' => $2, 'alias' => null)); }
|
||||
| T_NS_SEPARATOR namespace_name T_AS T_STRING { $$ = new PHPParser_Node_Stmt_UseUse(array('ns' => $2, 'alias' => $4)); }
|
||||
;
|
||||
|
||||
constant_declaration:
|
||||
constant_declaration ',' T_STRING '=' static_scalar { $1[] = new Node_Stmt_ConstConst(array('name' => $3, 'value' => $5)); $$ = $1; }
|
||||
| T_CONST T_STRING '=' static_scalar { $$ = array(new Node_Stmt_ConstConst(array('name' => $2, 'value' => $4))); }
|
||||
constant_declaration ',' T_STRING '=' static_scalar { $1[] = new PHPParser_Node_Stmt_ConstConst(array('name' => $3, 'value' => $5)); $$ = $1; }
|
||||
| T_CONST T_STRING '=' static_scalar { $$ = array(new PHPParser_Node_Stmt_ConstConst(array('name' => $2, 'value' => $4))); }
|
||||
;
|
||||
|
||||
inner_statement_list:
|
||||
@ -164,38 +164,38 @@ inner_statement:
|
||||
|
||||
statement:
|
||||
'{' inner_statement_list '}' { $$ = $2; }
|
||||
| T_IF '(' expr ')' statement elseif_list else_single { $$ = new Node_Stmt_If(array('cond' => $3, 'stmts' => is_array($5) ? $5 : array($5), 'elseifList' => $6, 'else' => $7)); }
|
||||
| T_IF '(' expr ')' statement elseif_list else_single { $$ = new PHPParser_Node_Stmt_If(array('cond' => $3, 'stmts' => is_array($5) ? $5 : array($5), 'elseifList' => $6, 'else' => $7)); }
|
||||
| T_IF '(' expr ')' ':' inner_statement_list new_elseif_list new_else_single T_ENDIF ';'
|
||||
{ $$ = new Node_Stmt_If(array('cond' => $3, 'stmts' => $6, 'elseifList' => $7, 'else' => $8)); }
|
||||
| T_WHILE '(' expr ')' while_statement { $$ = new Node_Stmt_While(array('cond' => $3, 'stmts' => is_array($5) ? $5 : array($5))); }
|
||||
| T_DO statement T_WHILE '(' expr ')' ';' { $$ = new Node_Stmt_Do(array('stmts' => is_array($2) ? $2 : array($2), 'cond' => $5)); }
|
||||
{ $$ = new PHPParser_Node_Stmt_If(array('cond' => $3, 'stmts' => $6, 'elseifList' => $7, 'else' => $8)); }
|
||||
| T_WHILE '(' expr ')' while_statement { $$ = new PHPParser_Node_Stmt_While(array('cond' => $3, 'stmts' => is_array($5) ? $5 : array($5))); }
|
||||
| T_DO statement T_WHILE '(' expr ')' ';' { $$ = new PHPParser_Node_Stmt_Do(array('stmts' => is_array($2) ? $2 : array($2), 'cond' => $5)); }
|
||||
| T_FOR '(' for_expr ';' for_expr ';' for_expr ')' for_statement
|
||||
{ $$ = new Node_Stmt_For(array('init' => $3, 'cond' => $5, 'loop' => $7, 'stmts' => is_array($9) ? $9 : array($9))); }
|
||||
| T_SWITCH '(' expr ')' switch_case_list { $$ = new Node_Stmt_Switch(array('cond' => $3, 'caseList' => $5)); }
|
||||
| T_BREAK ';' { $$ = new Node_Stmt_Break(array('num' => null)); }
|
||||
| T_BREAK expr ';' { $$ = new Node_Stmt_Break(array('num' => $2)); }
|
||||
| T_CONTINUE ';' { $$ = new Node_Stmt_Continue(array('num' => null)); }
|
||||
| T_CONTINUE expr ';' { $$ = new Node_Stmt_Continue(array('num' => $2)); }
|
||||
| T_RETURN ';' { $$ = new Node_Stmt_Return(array('expr' => null)); }
|
||||
| T_RETURN expr ';' { $$ = new Node_Stmt_Return(array('expr' => $2)); }
|
||||
| T_GLOBAL global_var_list ';' { $$ = new Node_Stmt_Global(array('vars' => $2)); }
|
||||
| T_STATIC static_var_list ';' { $$ = new Node_Stmt_Static(array('vars' => $2)); }
|
||||
| T_ECHO expr_list ';' { $$ = new Node_Stmt_Echo(array('exprs' => $2)); }
|
||||
| T_INLINE_HTML { $$ = new Node_Stmt_InlineHTML(array('value' => $1)); }
|
||||
{ $$ = new PHPParser_Node_Stmt_For(array('init' => $3, 'cond' => $5, 'loop' => $7, 'stmts' => is_array($9) ? $9 : array($9))); }
|
||||
| T_SWITCH '(' expr ')' switch_case_list { $$ = new PHPParser_Node_Stmt_Switch(array('cond' => $3, 'caseList' => $5)); }
|
||||
| T_BREAK ';' { $$ = new PHPParser_Node_Stmt_Break(array('num' => null)); }
|
||||
| T_BREAK expr ';' { $$ = new PHPParser_Node_Stmt_Break(array('num' => $2)); }
|
||||
| T_CONTINUE ';' { $$ = new PHPParser_Node_Stmt_Continue(array('num' => null)); }
|
||||
| T_CONTINUE expr ';' { $$ = new PHPParser_Node_Stmt_Continue(array('num' => $2)); }
|
||||
| T_RETURN ';' { $$ = new PHPParser_Node_Stmt_Return(array('expr' => null)); }
|
||||
| T_RETURN expr ';' { $$ = new PHPParser_Node_Stmt_Return(array('expr' => $2)); }
|
||||
| T_GLOBAL global_var_list ';' { $$ = new PHPParser_Node_Stmt_Global(array('vars' => $2)); }
|
||||
| T_STATIC static_var_list ';' { $$ = new PHPParser_Node_Stmt_Static(array('vars' => $2)); }
|
||||
| T_ECHO expr_list ';' { $$ = new PHPParser_Node_Stmt_Echo(array('exprs' => $2)); }
|
||||
| T_INLINE_HTML { $$ = new PHPParser_Node_Stmt_InlineHTML(array('value' => $1)); }
|
||||
| expr ';' { $$ = $1; }
|
||||
| T_UNSET '(' variables_list ')' ';' { $$ = new Node_Stmt_Unset(array('vars' => $3)); }
|
||||
| T_UNSET '(' variables_list ')' ';' { $$ = new PHPParser_Node_Stmt_Unset(array('vars' => $3)); }
|
||||
| T_FOREACH '(' expr T_AS variable ')' foreach_statement
|
||||
{ $$ = new Node_Stmt_Foreach(array('expr' => $3, 'keyVar' => null, 'byRef' => false, 'valueVar' => $5, 'stmts' => is_array($7) ? $7 : array($7))); }
|
||||
{ $$ = new PHPParser_Node_Stmt_Foreach(array('expr' => $3, 'keyVar' => null, 'byRef' => false, 'valueVar' => $5, 'stmts' => is_array($7) ? $7 : array($7))); }
|
||||
| T_FOREACH '(' expr T_AS '&' variable ')' foreach_statement
|
||||
{ $$ = new Node_Stmt_Foreach(array('expr' => $3, 'keyVar' => null, 'byRef' => true, 'valueVar' => $6, 'stmts' => is_array($8) ? $8 : array($8))); }
|
||||
{ $$ = new PHPParser_Node_Stmt_Foreach(array('expr' => $3, 'keyVar' => null, 'byRef' => true, 'valueVar' => $6, 'stmts' => is_array($8) ? $8 : array($8))); }
|
||||
| T_FOREACH '(' expr T_AS variable T_DOUBLE_ARROW optional_ref variable ')' foreach_statement
|
||||
{ $$ = new Node_Stmt_Foreach(array('expr' => $3, 'keyVar' => $5, 'byRef' => $7, 'valueVar' => $8, 'stmts' => is_array($10) ? $10 : array($10))); }
|
||||
| T_DECLARE '(' declare_list ')' declare_statement { $$ = new Node_Stmt_Declare(array('declares' => $3, 'stmts' => is_array($5) ? $5 : array($5))); }
|
||||
{ $$ = new PHPParser_Node_Stmt_Foreach(array('expr' => $3, 'keyVar' => $5, 'byRef' => $7, 'valueVar' => $8, 'stmts' => is_array($10) ? $10 : array($10))); }
|
||||
| T_DECLARE '(' declare_list ')' declare_statement { $$ = new PHPParser_Node_Stmt_Declare(array('declares' => $3, 'stmts' => is_array($5) ? $5 : array($5))); }
|
||||
| ';' { $$ = array(); /* means: no statement */ }
|
||||
| T_TRY '{' inner_statement_list '}' catches { $$ = new Node_Stmt_TryCatch(array('stmts' => $3, 'catches' => $5)); }
|
||||
| T_THROW expr ';' { $$ = new Node_Stmt_Throw(array('expr' => $2)); }
|
||||
| T_GOTO T_STRING ';' { $$ = new Node_Stmt_Goto(array('name' => $2)); }
|
||||
| T_STRING ':' { $$ = new Node_Stmt_Label(array('name' => $1)); }
|
||||
| T_TRY '{' inner_statement_list '}' catches { $$ = new PHPParser_Node_Stmt_TryCatch(array('stmts' => $3, 'catches' => $5)); }
|
||||
| T_THROW expr ';' { $$ = new PHPParser_Node_Stmt_Throw(array('expr' => $2)); }
|
||||
| T_GOTO T_STRING ';' { $$ = new PHPParser_Node_Stmt_Goto(array('name' => $2)); }
|
||||
| T_STRING ':' { $$ = new PHPParser_Node_Stmt_Label(array('name' => $1)); }
|
||||
;
|
||||
|
||||
catches:
|
||||
@ -205,7 +205,7 @@ catches:
|
||||
|
||||
catch:
|
||||
T_CATCH '(' name T_VARIABLE ')' '{' inner_statement_list '}'
|
||||
{ $$ = new Node_Stmt_Catch(array('type' => $3, 'var' => substr($4, 1), 'stmts' => $7)); }
|
||||
{ $$ = new PHPParser_Node_Stmt_Catch(array('type' => $3, 'var' => substr($4, 1), 'stmts' => $7)); }
|
||||
;
|
||||
|
||||
variables_list:
|
||||
@ -220,20 +220,20 @@ optional_ref:
|
||||
|
||||
function_declaration_statement:
|
||||
T_FUNCTION optional_ref T_STRING '(' parameter_list ')' '{' inner_statement_list '}'
|
||||
{ $$ = new Node_Stmt_Func(array('byRef' => $2, 'name' => $3, 'params' => $5, 'stmts' => $8)); }
|
||||
{ $$ = new PHPParser_Node_Stmt_Func(array('byRef' => $2, 'name' => $3, 'params' => $5, 'stmts' => $8)); }
|
||||
;
|
||||
|
||||
class_declaration_statement:
|
||||
class_entry_type T_STRING extends_from implements_list '{' class_statement_list '}'
|
||||
{ $$ = new Node_Stmt_Class(array('type' => $1, 'name' => $2, 'extends' => $3, 'implements' => $4, 'stmts' => $6)); }
|
||||
{ $$ = new PHPParser_Node_Stmt_Class(array('type' => $1, 'name' => $2, 'extends' => $3, 'implements' => $4, 'stmts' => $6)); }
|
||||
| T_INTERFACE T_STRING interface_extends_list '{' class_statement_list '}'
|
||||
{ $$ = new Node_Stmt_Interface(array('name' => $2, 'extends' => $3, 'stmts' => $5)); }
|
||||
{ $$ = new PHPParser_Node_Stmt_Interface(array('name' => $2, 'extends' => $3, 'stmts' => $5)); }
|
||||
;
|
||||
|
||||
class_entry_type:
|
||||
T_CLASS { $$ = 0; }
|
||||
| T_ABSTRACT T_CLASS { $$ = Node_Stmt_Class::MODIFIER_ABSTRACT; }
|
||||
| T_FINAL T_CLASS { $$ = Node_Stmt_Class::MODIFIER_FINAL; }
|
||||
| T_ABSTRACT T_CLASS { $$ = PHPParser_Node_Stmt_Class::MODIFIER_ABSTRACT; }
|
||||
| T_FINAL T_CLASS { $$ = PHPParser_Node_Stmt_Class::MODIFIER_FINAL; }
|
||||
;
|
||||
|
||||
extends_from:
|
||||
@ -272,8 +272,8 @@ declare_statement:
|
||||
;
|
||||
|
||||
declare_list:
|
||||
T_STRING '=' static_scalar { $$ = array(new Node_Stmt_DeclareDeclare(array('key' => $1, 'value' => $3))); }
|
||||
| declare_list ',' T_STRING '=' static_scalar { $1[] = new Node_Stmt_DeclareDeclare(array('key' => $3, 'value' => $5)); $$ = $1; }
|
||||
T_STRING '=' static_scalar { $$ = array(new PHPParser_Node_Stmt_DeclareDeclare(array('key' => $1, 'value' => $3))); }
|
||||
| declare_list ',' T_STRING '=' static_scalar { $1[] = new PHPParser_Node_Stmt_DeclareDeclare(array('key' => $3, 'value' => $5)); $$ = $1; }
|
||||
;
|
||||
|
||||
switch_case_list:
|
||||
@ -286,9 +286,9 @@ switch_case_list:
|
||||
case_list:
|
||||
/* empty */ { $$ = array(); }
|
||||
| case_list T_CASE expr case_separator inner_statement_list
|
||||
{ $1[] = new Node_Stmt_Case(array('cond' => $3, 'stmts' => $5)); $$ = $1; }
|
||||
{ $1[] = new PHPParser_Node_Stmt_Case(array('cond' => $3, 'stmts' => $5)); $$ = $1; }
|
||||
| case_list T_DEFAULT case_separator inner_statement_list
|
||||
{ $1[] = new Node_Stmt_Case(array('cond' => null, 'stmts' => $4)); $$ = $1; }
|
||||
{ $1[] = new PHPParser_Node_Stmt_Case(array('cond' => null, 'stmts' => $4)); $$ = $1; }
|
||||
;
|
||||
|
||||
case_separator:
|
||||
@ -303,23 +303,23 @@ while_statement:
|
||||
|
||||
elseif_list:
|
||||
/* empty */ { $$ = array();}
|
||||
| elseif_list T_ELSEIF '(' expr ')' statement { $1[] = new Node_Stmt_ElseIf(array('cond' => $4, 'stmts' => is_array($6) ? $6 : array($6))); $$ = $1; }
|
||||
| elseif_list T_ELSEIF '(' expr ')' statement { $1[] = new PHPParser_Node_Stmt_ElseIf(array('cond' => $4, 'stmts' => is_array($6) ? $6 : array($6))); $$ = $1; }
|
||||
;
|
||||
|
||||
new_elseif_list:
|
||||
/* empty */ { $$ = array(); }
|
||||
| new_elseif_list T_ELSEIF '(' expr ')' ':' inner_statement_list
|
||||
{ $1[] = new Node_Stmt_ElseIf(array('cond' => $4, 'stmts' => $7)); $$ = $1; }
|
||||
{ $1[] = new PHPParser_Node_Stmt_ElseIf(array('cond' => $4, 'stmts' => $7)); $$ = $1; }
|
||||
;
|
||||
|
||||
else_single:
|
||||
/* empty */ { $$ = null; }
|
||||
| T_ELSE statement { $$ = new Node_Stmt_Else(array('stmts' => is_array($2) ? $2 : array($2))); }
|
||||
| T_ELSE statement { $$ = new PHPParser_Node_Stmt_Else(array('stmts' => is_array($2) ? $2 : array($2))); }
|
||||
;
|
||||
|
||||
new_else_single:
|
||||
/* empty */ { $$ = null; }
|
||||
| T_ELSE ':' inner_statement_list { $$ = new Node_Stmt_Else(array('stmts' => $3)); }
|
||||
| T_ELSE ':' inner_statement_list { $$ = new PHPParser_Node_Stmt_Else(array('stmts' => $3)); }
|
||||
;
|
||||
|
||||
parameter_list:
|
||||
@ -329,13 +329,13 @@ parameter_list:
|
||||
|
||||
non_empty_parameter_list:
|
||||
optional_class_type optional_ref T_VARIABLE
|
||||
{ $$ = array(new Node_Stmt_FuncParam(array('type' => $1, 'name' => substr($3, 1), 'byRef' => $2, 'default' => null))); }
|
||||
{ $$ = array(new PHPParser_Node_Stmt_FuncParam(array('type' => $1, 'name' => substr($3, 1), 'byRef' => $2, 'default' => null))); }
|
||||
| optional_class_type optional_ref T_VARIABLE '=' static_scalar
|
||||
{ $$ = array(new Node_Stmt_FuncParam(array('type' => $1, 'name' => substr($3, 1), 'byRef' => $2, 'default' => $5))); }
|
||||
{ $$ = array(new PHPParser_Node_Stmt_FuncParam(array('type' => $1, 'name' => substr($3, 1), 'byRef' => $2, 'default' => $5))); }
|
||||
| non_empty_parameter_list ',' optional_class_type optional_ref T_VARIABLE
|
||||
{ $1[] = new Node_Stmt_FuncParam(array('type' => $3, 'name' => substr($5, 1), 'byRef' => $4, 'default' => null)); $$ = $1; }
|
||||
{ $1[] = new PHPParser_Node_Stmt_FuncParam(array('type' => $3, 'name' => substr($5, 1), 'byRef' => $4, 'default' => null)); $$ = $1; }
|
||||
| non_empty_parameter_list ',' optional_class_type optional_ref T_VARIABLE '=' static_scalar
|
||||
{ $1[] = new Node_Stmt_FuncParam(array('type' => $3, 'name' => substr($5, 1), 'byRef' => $4, 'default' => $7)); $$ = $1; }
|
||||
{ $1[] = new PHPParser_Node_Stmt_FuncParam(array('type' => $3, 'name' => substr($5, 1), 'byRef' => $4, 'default' => $7)); $$ = $1; }
|
||||
;
|
||||
|
||||
optional_class_type:
|
||||
@ -350,12 +350,12 @@ function_call_argument_list:
|
||||
;
|
||||
|
||||
non_empty_function_call_argument_list:
|
||||
expr { $$ = array(new Node_Expr_FuncCallArg(array('value' => $1, 'byRef' => false))); }
|
||||
| '&' variable { $$ = array(new Node_Expr_FuncCallArg(array('value' => $2, 'byRef' => true))); }
|
||||
expr { $$ = array(new PHPParser_Node_Expr_FuncCallArg(array('value' => $1, 'byRef' => false))); }
|
||||
| '&' variable { $$ = array(new PHPParser_Node_Expr_FuncCallArg(array('value' => $2, 'byRef' => true))); }
|
||||
| non_empty_function_call_argument_list ',' expr
|
||||
{ $1[] = new Node_Expr_FuncCallArg(array('value' => $3, 'byRef' => false)); $$ = $1; }
|
||||
{ $1[] = new PHPParser_Node_Expr_FuncCallArg(array('value' => $3, 'byRef' => false)); $$ = $1; }
|
||||
| non_empty_function_call_argument_list ',' '&' variable
|
||||
{ $1[] = new Node_Expr_FuncCallArg(array('value' => $4, 'byRef' => true)); $$ = $1; }
|
||||
{ $1[] = new PHPParser_Node_Expr_FuncCallArg(array('value' => $4, 'byRef' => true)); $$ = $1; }
|
||||
;
|
||||
|
||||
global_var_list:
|
||||
@ -364,16 +364,16 @@ global_var_list:
|
||||
;
|
||||
|
||||
global_var:
|
||||
T_VARIABLE { $$ = new Node_Variable(array('name' => substr($1, 1))); }
|
||||
| '$' variable { $$ = new Node_Variable(array('name' => $2)); }
|
||||
| '$' '{' expr '}' { $$ = new Node_Variable(array('name' => $3)); }
|
||||
T_VARIABLE { $$ = new PHPParser_Node_Variable(array('name' => substr($1, 1))); }
|
||||
| '$' variable { $$ = new PHPParser_Node_Variable(array('name' => $2)); }
|
||||
| '$' '{' expr '}' { $$ = new PHPParser_Node_Variable(array('name' => $3)); }
|
||||
;
|
||||
|
||||
static_var_list:
|
||||
static_var_list ',' T_VARIABLE { $1[] = new Node_Stmt_StaticVar(array('name' => substr($3, 1), 'default' => null)); $$ = $1; }
|
||||
| static_var_list ',' T_VARIABLE '=' static_scalar { $1[] = new Node_Stmt_StaticVar(array('name' => substr($3, 1), 'default' => $5)); $$ = $1; }
|
||||
| T_VARIABLE { $$ = array(new Node_Stmt_StaticVar(array('name' => substr($1, 1), 'default' => null))); }
|
||||
| T_VARIABLE '=' static_scalar { $$ = array(new Node_Stmt_StaticVar(array('name' => substr($1, 1), 'default' => $3))); }
|
||||
static_var_list ',' T_VARIABLE { $1[] = new PHPParser_Node_Stmt_StaticVar(array('name' => substr($3, 1), 'default' => null)); $$ = $1; }
|
||||
| static_var_list ',' T_VARIABLE '=' static_scalar { $1[] = new PHPParser_Node_Stmt_StaticVar(array('name' => substr($3, 1), 'default' => $5)); $$ = $1; }
|
||||
| T_VARIABLE { $$ = array(new PHPParser_Node_Stmt_StaticVar(array('name' => substr($1, 1), 'default' => null))); }
|
||||
| T_VARIABLE '=' static_scalar { $$ = array(new PHPParser_Node_Stmt_StaticVar(array('name' => substr($1, 1), 'default' => $3))); }
|
||||
;
|
||||
|
||||
class_statement_list:
|
||||
@ -382,10 +382,10 @@ class_statement_list:
|
||||
;
|
||||
|
||||
class_statement:
|
||||
variable_modifiers class_variable_declaration ';' { $$ = new Node_Stmt_Property(array('type' => $1, 'props' => $2)); }
|
||||
| class_constant_declaration ';' { $$ = new Node_Stmt_ClassConst(array('consts' => $1)); }
|
||||
variable_modifiers class_variable_declaration ';' { $$ = new PHPParser_Node_Stmt_Property(array('type' => $1, 'props' => $2)); }
|
||||
| class_constant_declaration ';' { $$ = new PHPParser_Node_Stmt_ClassConst(array('consts' => $1)); }
|
||||
| method_modifiers T_FUNCTION optional_ref T_STRING '(' parameter_list ')' method_body
|
||||
{ $$ = new Node_Stmt_ClassMethod(array('type' => $1, 'byRef' => $3, 'name' => $4, 'params' => $6, 'stmts' => $8)); }
|
||||
{ $$ = new PHPParser_Node_Stmt_ClassMethod(array('type' => $1, 'byRef' => $3, 'name' => $4, 'params' => $6, 'stmts' => $8)); }
|
||||
;
|
||||
|
||||
method_body:
|
||||
@ -395,43 +395,43 @@ method_body:
|
||||
|
||||
variable_modifiers:
|
||||
non_empty_member_modifiers { $$ = $1; }
|
||||
| T_VAR { $$ = Node_Stmt_Class::MODIFIER_PUBLIC; }
|
||||
| T_VAR { $$ = PHPParser_Node_Stmt_Class::MODIFIER_PUBLIC; }
|
||||
;
|
||||
|
||||
method_modifiers:
|
||||
/* empty */ { $$ = Node_Stmt_Class::MODIFIER_PUBLIC; }
|
||||
/* empty */ { $$ = PHPParser_Node_Stmt_Class::MODIFIER_PUBLIC; }
|
||||
| non_empty_member_modifiers { $$ = $1; }
|
||||
;
|
||||
|
||||
non_empty_member_modifiers:
|
||||
member_modifier { $$ = $1; }
|
||||
| non_empty_member_modifiers member_modifier { Node_Stmt_Class::verifyModifier($1, $2); $$ = $1 | $2; }
|
||||
| non_empty_member_modifiers member_modifier { PHPParser_Node_Stmt_Class::verifyModifier($1, $2); $$ = $1 | $2; }
|
||||
;
|
||||
|
||||
member_modifier:
|
||||
T_PUBLIC { $$ = Node_Stmt_Class::MODIFIER_PUBLIC; }
|
||||
| T_PROTECTED { $$ = Node_Stmt_Class::MODIFIER_PROTECTED; }
|
||||
| T_PRIVATE { $$ = Node_Stmt_Class::MODIFIER_PRIVATE; }
|
||||
| T_STATIC { $$ = Node_Stmt_Class::MODIFIER_STATIC; }
|
||||
| T_ABSTRACT { $$ = Node_Stmt_Class::MODIFIER_ABSTRACT; }
|
||||
| T_FINAL { $$ = Node_Stmt_Class::MODIFIER_FINAL; }
|
||||
T_PUBLIC { $$ = PHPParser_Node_Stmt_Class::MODIFIER_PUBLIC; }
|
||||
| T_PROTECTED { $$ = PHPParser_Node_Stmt_Class::MODIFIER_PROTECTED; }
|
||||
| T_PRIVATE { $$ = PHPParser_Node_Stmt_Class::MODIFIER_PRIVATE; }
|
||||
| T_STATIC { $$ = PHPParser_Node_Stmt_Class::MODIFIER_STATIC; }
|
||||
| T_ABSTRACT { $$ = PHPParser_Node_Stmt_Class::MODIFIER_ABSTRACT; }
|
||||
| T_FINAL { $$ = PHPParser_Node_Stmt_Class::MODIFIER_FINAL; }
|
||||
;
|
||||
|
||||
class_variable_declaration:
|
||||
class_variable_declaration ',' T_VARIABLE
|
||||
{ $1[] = new Node_Stmt_PropertyProperty(array('name' => substr($3, 1), 'default' => null)); $$ = $1; }
|
||||
{ $1[] = new PHPParser_Node_Stmt_PropertyProperty(array('name' => substr($3, 1), 'default' => null)); $$ = $1; }
|
||||
| class_variable_declaration ',' T_VARIABLE '=' static_scalar
|
||||
{ $1[] = new Node_Stmt_PropertyProperty(array('name' => substr($3, 1), 'default' => $5)); $$ = $1; }
|
||||
{ $1[] = new PHPParser_Node_Stmt_PropertyProperty(array('name' => substr($3, 1), 'default' => $5)); $$ = $1; }
|
||||
| T_VARIABLE
|
||||
{ $$ = array(new Node_Stmt_PropertyProperty(array('name' => substr($1, 1), 'default' => null))); }
|
||||
{ $$ = array(new PHPParser_Node_Stmt_PropertyProperty(array('name' => substr($1, 1), 'default' => null))); }
|
||||
| T_VARIABLE '=' static_scalar
|
||||
{ $$ = array(new Node_Stmt_PropertyProperty(array('name' => substr($1, 1), 'default' => $3))); }
|
||||
{ $$ = array(new PHPParser_Node_Stmt_PropertyProperty(array('name' => substr($1, 1), 'default' => $3))); }
|
||||
;
|
||||
|
||||
class_constant_declaration:
|
||||
class_constant_declaration ',' T_STRING '=' static_scalar
|
||||
{ $1[] = new Node_Stmt_ClassConstConst(array('name' => $3, 'value' => $5)); $$ = $1; }
|
||||
| T_CONST T_STRING '=' static_scalar { $$ = array(new Node_Stmt_ClassConstConst(array('name' => $2, 'value' => $4))); }
|
||||
{ $1[] = new PHPParser_Node_Stmt_ClassConstConst(array('name' => $3, 'value' => $5)); $$ = $1; }
|
||||
| T_CONST T_STRING '=' static_scalar { $$ = array(new PHPParser_Node_Stmt_ClassConstConst(array('name' => $2, 'value' => $4))); }
|
||||
;
|
||||
|
||||
expr_list:
|
||||
@ -446,83 +446,83 @@ for_expr:
|
||||
|
||||
expr:
|
||||
variable { $$ = $1; }
|
||||
| T_LIST '(' assignment_list ')' '=' expr { $$ = new Node_Expr_List(array('assignList' => $3, 'expr' => $6)); }
|
||||
| variable '=' expr { $$ = new Node_Expr_Assign(array('var' => $1, 'expr' => $3)); }
|
||||
| variable '=' '&' variable { $$ = new Node_Expr_AssignRef(array('var' => $1, 'refVar' => $4)); }
|
||||
| T_LIST '(' assignment_list ')' '=' expr { $$ = new PHPParser_Node_Expr_List(array('assignList' => $3, 'expr' => $6)); }
|
||||
| variable '=' expr { $$ = new PHPParser_Node_Expr_Assign(array('var' => $1, 'expr' => $3)); }
|
||||
| variable '=' '&' variable { $$ = new PHPParser_Node_Expr_AssignRef(array('var' => $1, 'refVar' => $4)); }
|
||||
| variable '=' '&' T_NEW class_name_reference ctor_arguments
|
||||
{ $$ = new Node_Expr_Assign(array('var' => $1, 'expr' => new Node_Expr_New(array('class' => $5, 'args' => $6)))); }
|
||||
{ $$ = new PHPParser_Node_Expr_Assign(array('var' => $1, 'expr' => new PHPParser_Node_Expr_New(array('class' => $5, 'args' => $6)))); }
|
||||
/* reference dropped intentially, TODO: Throw error? */
|
||||
| T_NEW class_name_reference ctor_arguments { $$ = new Node_Expr_New(array('class' => $2, 'args' => $3)); }
|
||||
| T_CLONE expr { $$ = new Node_Expr_Clone(array('expr' => $2)); }
|
||||
| variable T_PLUS_EQUAL expr { $$ = new Node_Expr_AssignPlus(array('var' => $1, 'expr' => $3)); }
|
||||
| variable T_MINUS_EQUAL expr { $$ = new Node_Expr_AssignMinus(array('var' => $1, 'expr' => $3)); }
|
||||
| variable T_MUL_EQUAL expr { $$ = new Node_Expr_AssignMul(array('var' => $1, 'expr' => $3)); }
|
||||
| variable T_DIV_EQUAL expr { $$ = new Node_Expr_AssignDiv(array('var' => $1, 'expr' => $3)); }
|
||||
| variable T_CONCAT_EQUAL expr { $$ = new Node_Expr_AssignConcat(array('var' => $1, 'expr' => $3)); }
|
||||
| variable T_MOD_EQUAL expr { $$ = new Node_Expr_AssignMod(array('var' => $1, 'expr' => $3)); }
|
||||
| variable T_AND_EQUAL expr { $$ = new Node_Expr_AssignBinAnd(array('var' => $1, 'expr' => $3)); }
|
||||
| variable T_OR_EQUAL expr { $$ = new Node_Expr_AssignBinOr(array('var' => $1, 'expr' => $3)); }
|
||||
| variable T_XOR_EQUAL expr { $$ = new Node_Expr_AssignBinXor(array('var' => $1, 'expr' => $3)); }
|
||||
| variable T_SL_EQUAL expr { $$ = new Node_Expr_AssignShiftLeft(array('var' => $1, 'expr' => $3)); }
|
||||
| variable T_SR_EQUAL expr { $$ = new Node_Expr_AssignShiftRight(array('var' => $1, 'expr' => $3)); }
|
||||
| variable T_INC { $$ = new Node_Expr_PostInc(array('var' => $1)); }
|
||||
| T_INC variable { $$ = new Node_Expr_PreInc(array('var' => $2)); }
|
||||
| variable T_DEC { $$ = new Node_Expr_PostDec(array('var' => $1)); }
|
||||
| T_DEC variable { $$ = new Node_Expr_PreDec(array('var' => $2)); }
|
||||
| expr T_BOOLEAN_OR expr { $$ = new Node_Expr_BooleanOr(array('left' => $1, 'right' => $3)); }
|
||||
| expr T_BOOLEAN_AND expr { $$ = new Node_Expr_BooleanAnd(array('left' => $1, 'right' => $3)); }
|
||||
| expr T_LOGICAL_OR expr { $$ = new Node_Expr_LogicalOr(array('left' => $1, 'right' => $3)); }
|
||||
| expr T_LOGICAL_AND expr { $$ = new Node_Expr_LogicalAnd(array('left' => $1, 'right' => $3)); }
|
||||
| expr T_LOGICAL_XOR expr { $$ = new Node_Expr_LogicalXor(array('left' => $1, 'right' => $3)); }
|
||||
| expr '|' expr { $$ = new Node_Expr_BinaryOr(array('left' => $1, 'right' => $3)); }
|
||||
| expr '&' expr { $$ = new Node_Expr_BinaryAnd(array('left' => $1, 'right' => $3)); }
|
||||
| expr '^' expr { $$ = new Node_Expr_BinaryXor(array('left' => $1, 'right' => $3)); }
|
||||
| expr '.' expr { $$ = new Node_Expr_Concat(array('left' => $1, 'right' => $3)); }
|
||||
| expr '+' expr { $$ = new Node_Expr_Plus(array('left' => $1, 'right' => $3)); }
|
||||
| expr '-' expr { $$ = new Node_Expr_Minus(array('left' => $1, 'right' => $3)); }
|
||||
| expr '*' expr { $$ = new Node_Expr_Mul(array('left' => $1, 'right' => $3)); }
|
||||
| expr '/' expr { $$ = new Node_Expr_Div(array('left' => $1, 'right' => $3)); }
|
||||
| expr '%' expr { $$ = new Node_Expr_Mod(array('left' => $1, 'right' => $3)); }
|
||||
| expr T_SL expr { $$ = new Node_Expr_ShiftLeft(array('left' => $1, 'right' => $3)); }
|
||||
| expr T_SR expr { $$ = new Node_Expr_ShiftRight(array('left' => $1, 'right' => $3)); }
|
||||
| '+' expr %prec T_INC { $$ = new Node_Expr_UnaryPlus(array('expr' => $2)); }
|
||||
| '-' expr %prec T_INC { $$ = new Node_Expr_UnaryMinus(array('expr' => $2)); }
|
||||
| '!' expr { $$ = new Node_Expr_BooleanNot(array('expr' => $2)); }
|
||||
| '~' expr { $$ = new Node_Expr_BinaryNot(array('expr' => $2)); }
|
||||
| expr T_IS_IDENTICAL expr { $$ = new Node_Expr_Identical(array('left' => $1, 'right' => $3)); }
|
||||
| expr T_IS_NOT_IDENTICAL expr { $$ = new Node_Expr_NotIdentical(array('left' => $1, 'right' => $3)); }
|
||||
| expr T_IS_EQUAL expr { $$ = new Node_Expr_Equal(array('left' => $1, 'right' => $3)); }
|
||||
| expr T_IS_NOT_EQUAL expr { $$ = new Node_Expr_NotEqual(array('left' => $1, 'right' => $3)); }
|
||||
| expr '<' expr { $$ = new Node_Expr_Smaller(array('left' => $1, 'right' => $3)); }
|
||||
| expr T_IS_SMALLER_OR_EQUAL expr { $$ = new Node_Expr_SmallerOrEqual(array('left' => $1, 'right' => $3)); }
|
||||
| expr '>' expr { $$ = new Node_Expr_Greater(array('left' => $1, 'right' => $3)); }
|
||||
| expr T_IS_GREATER_OR_EQUAL expr { $$ = new Node_Expr_GreaterOrEqual(array('left' => $1, 'right' => $3)); }
|
||||
| expr T_INSTANCEOF class_name_reference { $$ = new Node_Expr_Instanceof(array('expr' => $1, 'class' => $3)); }
|
||||
| T_NEW class_name_reference ctor_arguments { $$ = new PHPParser_Node_Expr_New(array('class' => $2, 'args' => $3)); }
|
||||
| T_CLONE expr { $$ = new PHPParser_Node_Expr_Clone(array('expr' => $2)); }
|
||||
| variable T_PLUS_EQUAL expr { $$ = new PHPParser_Node_Expr_AssignPlus(array('var' => $1, 'expr' => $3)); }
|
||||
| variable T_MINUS_EQUAL expr { $$ = new PHPParser_Node_Expr_AssignMinus(array('var' => $1, 'expr' => $3)); }
|
||||
| variable T_MUL_EQUAL expr { $$ = new PHPParser_Node_Expr_AssignMul(array('var' => $1, 'expr' => $3)); }
|
||||
| variable T_DIV_EQUAL expr { $$ = new PHPParser_Node_Expr_AssignDiv(array('var' => $1, 'expr' => $3)); }
|
||||
| variable T_CONCAT_EQUAL expr { $$ = new PHPParser_Node_Expr_AssignConcat(array('var' => $1, 'expr' => $3)); }
|
||||
| variable T_MOD_EQUAL expr { $$ = new PHPParser_Node_Expr_AssignMod(array('var' => $1, 'expr' => $3)); }
|
||||
| variable T_AND_EQUAL expr { $$ = new PHPParser_Node_Expr_AssignBinAnd(array('var' => $1, 'expr' => $3)); }
|
||||
| variable T_OR_EQUAL expr { $$ = new PHPParser_Node_Expr_AssignBinOr(array('var' => $1, 'expr' => $3)); }
|
||||
| variable T_XOR_EQUAL expr { $$ = new PHPParser_Node_Expr_AssignBinXor(array('var' => $1, 'expr' => $3)); }
|
||||
| variable T_SL_EQUAL expr { $$ = new PHPParser_Node_Expr_AssignShiftLeft(array('var' => $1, 'expr' => $3)); }
|
||||
| variable T_SR_EQUAL expr { $$ = new PHPParser_Node_Expr_AssignShiftRight(array('var' => $1, 'expr' => $3)); }
|
||||
| variable T_INC { $$ = new PHPParser_Node_Expr_PostInc(array('var' => $1)); }
|
||||
| T_INC variable { $$ = new PHPParser_Node_Expr_PreInc(array('var' => $2)); }
|
||||
| variable T_DEC { $$ = new PHPParser_Node_Expr_PostDec(array('var' => $1)); }
|
||||
| T_DEC variable { $$ = new PHPParser_Node_Expr_PreDec(array('var' => $2)); }
|
||||
| expr T_BOOLEAN_OR expr { $$ = new PHPParser_Node_Expr_BooleanOr(array('left' => $1, 'right' => $3)); }
|
||||
| expr T_BOOLEAN_AND expr { $$ = new PHPParser_Node_Expr_BooleanAnd(array('left' => $1, 'right' => $3)); }
|
||||
| expr T_LOGICAL_OR expr { $$ = new PHPParser_Node_Expr_LogicalOr(array('left' => $1, 'right' => $3)); }
|
||||
| expr T_LOGICAL_AND expr { $$ = new PHPParser_Node_Expr_LogicalAnd(array('left' => $1, 'right' => $3)); }
|
||||
| expr T_LOGICAL_XOR expr { $$ = new PHPParser_Node_Expr_LogicalXor(array('left' => $1, 'right' => $3)); }
|
||||
| expr '|' expr { $$ = new PHPParser_Node_Expr_BinaryOr(array('left' => $1, 'right' => $3)); }
|
||||
| expr '&' expr { $$ = new PHPParser_Node_Expr_BinaryAnd(array('left' => $1, 'right' => $3)); }
|
||||
| expr '^' expr { $$ = new PHPParser_Node_Expr_BinaryXor(array('left' => $1, 'right' => $3)); }
|
||||
| expr '.' expr { $$ = new PHPParser_Node_Expr_Concat(array('left' => $1, 'right' => $3)); }
|
||||
| expr '+' expr { $$ = new PHPParser_Node_Expr_Plus(array('left' => $1, 'right' => $3)); }
|
||||
| expr '-' expr { $$ = new PHPParser_Node_Expr_Minus(array('left' => $1, 'right' => $3)); }
|
||||
| expr '*' expr { $$ = new PHPParser_Node_Expr_Mul(array('left' => $1, 'right' => $3)); }
|
||||
| expr '/' expr { $$ = new PHPParser_Node_Expr_Div(array('left' => $1, 'right' => $3)); }
|
||||
| expr '%' expr { $$ = new PHPParser_Node_Expr_Mod(array('left' => $1, 'right' => $3)); }
|
||||
| expr T_SL expr { $$ = new PHPParser_Node_Expr_ShiftLeft(array('left' => $1, 'right' => $3)); }
|
||||
| expr T_SR expr { $$ = new PHPParser_Node_Expr_ShiftRight(array('left' => $1, 'right' => $3)); }
|
||||
| '+' expr %prec T_INC { $$ = new PHPParser_Node_Expr_UnaryPlus(array('expr' => $2)); }
|
||||
| '-' expr %prec T_INC { $$ = new PHPParser_Node_Expr_UnaryMinus(array('expr' => $2)); }
|
||||
| '!' expr { $$ = new PHPParser_Node_Expr_BooleanNot(array('expr' => $2)); }
|
||||
| '~' expr { $$ = new PHPParser_Node_Expr_BinaryNot(array('expr' => $2)); }
|
||||
| expr T_IS_IDENTICAL expr { $$ = new PHPParser_Node_Expr_Identical(array('left' => $1, 'right' => $3)); }
|
||||
| expr T_IS_NOT_IDENTICAL expr { $$ = new PHPParser_Node_Expr_NotIdentical(array('left' => $1, 'right' => $3)); }
|
||||
| expr T_IS_EQUAL expr { $$ = new PHPParser_Node_Expr_Equal(array('left' => $1, 'right' => $3)); }
|
||||
| expr T_IS_NOT_EQUAL expr { $$ = new PHPParser_Node_Expr_NotEqual(array('left' => $1, 'right' => $3)); }
|
||||
| expr '<' expr { $$ = new PHPParser_Node_Expr_Smaller(array('left' => $1, 'right' => $3)); }
|
||||
| expr T_IS_SMALLER_OR_EQUAL expr { $$ = new PHPParser_Node_Expr_SmallerOrEqual(array('left' => $1, 'right' => $3)); }
|
||||
| expr '>' expr { $$ = new PHPParser_Node_Expr_Greater(array('left' => $1, 'right' => $3)); }
|
||||
| expr T_IS_GREATER_OR_EQUAL expr { $$ = new PHPParser_Node_Expr_GreaterOrEqual(array('left' => $1, 'right' => $3)); }
|
||||
| expr T_INSTANCEOF class_name_reference { $$ = new PHPParser_Node_Expr_Instanceof(array('expr' => $1, 'class' => $3)); }
|
||||
| '(' expr ')' { $$ = $2; }
|
||||
| expr '?' expr ':' expr { $$ = new Node_Expr_Ternary(array('cond' => $1, 'if' => $3, 'else' => $5)); }
|
||||
| expr '?' ':' expr { $$ = new Node_Expr_Ternary(array('cond' => $1, 'if' => null, 'else' => $4)); }
|
||||
| T_ISSET '(' variables_list ')' { $$ = new Node_Expr_Isset(array('vars' => $3)); }
|
||||
| T_EMPTY '(' variable ')' { $$ = new Node_Expr_Empty(array('var' => $3)); }
|
||||
| T_INCLUDE expr { $$ = new Node_Expr_Include(array('expr' => $2, 'type' => Node_Expr_Include::TYPE_INCLUDE)); }
|
||||
| T_INCLUDE_ONCE expr { $$ = new Node_Expr_Include(array('expr' => $2, 'type' => Node_Expr_Include::TYPE_INCLUDE_ONCE)); }
|
||||
| T_EVAL '(' expr ')' { $$ = new Node_Expr_Eval(array('expr' => $3)); }
|
||||
| T_REQUIRE expr { $$ = new Node_Expr_Include(array('expr' => $2, 'type' => Node_Expr_Include::TYPE_REQUIRE)); }
|
||||
| T_REQUIRE_ONCE expr { $$ = new Node_Expr_Include(array('expr' => $2, 'type' => Node_Expr_Include::TYPE_REQUIRE_ONCE)); }
|
||||
| T_INT_CAST expr { $$ = new Node_Expr_IntCast(array('expr' => $2)); }
|
||||
| T_DOUBLE_CAST expr { $$ = new Node_Expr_DoubleCast(array('expr' => $2)); }
|
||||
| T_STRING_CAST expr { $$ = new Node_Expr_StringCast(array('expr' => $2)); }
|
||||
| T_ARRAY_CAST expr { $$ = new Node_Expr_ArrayCast(array('expr' => $2)); }
|
||||
| T_OBJECT_CAST expr { $$ = new Node_Expr_ObjectCast(array('expr' => $2)); }
|
||||
| T_BOOL_CAST expr { $$ = new Node_Expr_BoolCast(array('expr' => $2)); }
|
||||
| T_UNSET_CAST expr { $$ = new Node_Expr_UnsetCast(array('expr' => $2)); }
|
||||
| T_EXIT exit_expr { $$ = new Node_Expr_Exit(array('expr' => $2)); }
|
||||
| '@' expr { $$ = new Node_Expr_ErrorSuppress(array('expr' => $2)); }
|
||||
| expr '?' expr ':' expr { $$ = new PHPParser_Node_Expr_Ternary(array('cond' => $1, 'if' => $3, 'else' => $5)); }
|
||||
| expr '?' ':' expr { $$ = new PHPParser_Node_Expr_Ternary(array('cond' => $1, 'if' => null, 'else' => $4)); }
|
||||
| T_ISSET '(' variables_list ')' { $$ = new PHPParser_Node_Expr_Isset(array('vars' => $3)); }
|
||||
| T_EMPTY '(' variable ')' { $$ = new PHPParser_Node_Expr_Empty(array('var' => $3)); }
|
||||
| T_INCLUDE expr { $$ = new PHPParser_Node_Expr_Include(array('expr' => $2, 'type' => PHPParser_Node_Expr_Include::TYPE_INCLUDE)); }
|
||||
| T_INCLUDE_ONCE expr { $$ = new PHPParser_Node_Expr_Include(array('expr' => $2, 'type' => PHPParser_Node_Expr_Include::TYPE_INCLUDE_ONCE)); }
|
||||
| T_EVAL '(' expr ')' { $$ = new PHPParser_Node_Expr_Eval(array('expr' => $3)); }
|
||||
| T_REQUIRE expr { $$ = new PHPParser_Node_Expr_Include(array('expr' => $2, 'type' => PHPParser_Node_Expr_Include::TYPE_REQUIRE)); }
|
||||
| T_REQUIRE_ONCE expr { $$ = new PHPParser_Node_Expr_Include(array('expr' => $2, 'type' => PHPParser_Node_Expr_Include::TYPE_REQUIRE_ONCE)); }
|
||||
| T_INT_CAST expr { $$ = new PHPParser_Node_Expr_IntCast(array('expr' => $2)); }
|
||||
| T_DOUBLE_CAST expr { $$ = new PHPParser_Node_Expr_DoubleCast(array('expr' => $2)); }
|
||||
| T_STRING_CAST expr { $$ = new PHPParser_Node_Expr_StringCast(array('expr' => $2)); }
|
||||
| T_ARRAY_CAST expr { $$ = new PHPParser_Node_Expr_ArrayCast(array('expr' => $2)); }
|
||||
| T_OBJECT_CAST expr { $$ = new PHPParser_Node_Expr_ObjectCast(array('expr' => $2)); }
|
||||
| T_BOOL_CAST expr { $$ = new PHPParser_Node_Expr_BoolCast(array('expr' => $2)); }
|
||||
| T_UNSET_CAST expr { $$ = new PHPParser_Node_Expr_UnsetCast(array('expr' => $2)); }
|
||||
| T_EXIT exit_expr { $$ = new PHPParser_Node_Expr_Exit(array('expr' => $2)); }
|
||||
| '@' expr { $$ = new PHPParser_Node_Expr_ErrorSuppress(array('expr' => $2)); }
|
||||
| scalar { $$ = $1; }
|
||||
| T_ARRAY '(' array_pair_list ')' { $$ = new Node_Expr_Array(array('items' => $3)); }
|
||||
| '`' backticks_expr '`' { $$ = new Node_Expr_ShellExec(array('parts' => $2)); }
|
||||
| T_PRINT expr { $$ = new Node_Expr_Print(array('expr' => $2)); }
|
||||
| T_ARRAY '(' array_pair_list ')' { $$ = new PHPParser_Node_Expr_Array(array('items' => $3)); }
|
||||
| '`' backticks_expr '`' { $$ = new PHPParser_Node_Expr_ShellExec(array('parts' => $2)); }
|
||||
| T_PRINT expr { $$ = new PHPParser_Node_Expr_Print(array('expr' => $2)); }
|
||||
| T_FUNCTION optional_ref '(' parameter_list ')' lexical_vars '{' inner_statement_list '}'
|
||||
{ $$ = new Node_Expr_LambdaFunc(array('byRef' => $2, 'params' => $4, 'useVars' => $6, 'stmts' => $8)); }
|
||||
{ $$ = new PHPParser_Node_Expr_LambdaFunc(array('byRef' => $2, 'params' => $4, 'useVars' => $6, 'stmts' => $8)); }
|
||||
;
|
||||
|
||||
lexical_vars:
|
||||
@ -532,34 +532,34 @@ lexical_vars:
|
||||
|
||||
lexical_var_list:
|
||||
lexical_var_list ',' optional_ref T_VARIABLE
|
||||
{ $1[] = new Node_Expr_LambdaFuncUse(array('var' => substr($4, 1), 'byRef' => $3)); $$ = $1; }
|
||||
{ $1[] = new PHPParser_Node_Expr_LambdaFuncUse(array('var' => substr($4, 1), 'byRef' => $3)); $$ = $1; }
|
||||
| optional_ref T_VARIABLE
|
||||
{ $$ = array(new Node_Expr_LambdaFuncUse(array('var' => substr($2, 1), 'byRef' => $1))); }
|
||||
{ $$ = array(new PHPParser_Node_Expr_LambdaFuncUse(array('var' => substr($2, 1), 'byRef' => $1))); }
|
||||
;
|
||||
|
||||
function_call:
|
||||
name '(' function_call_argument_list ')' { $$ = new Node_Expr_FuncCall(array('func' => $1, 'args' => $3)); }
|
||||
name '(' function_call_argument_list ')' { $$ = new PHPParser_Node_Expr_FuncCall(array('func' => $1, 'args' => $3)); }
|
||||
| class_name T_PAAMAYIM_NEKUDOTAYIM T_STRING '(' function_call_argument_list ')'
|
||||
{ $$ = new Node_Expr_StaticCall(array('class' => $1, 'func' => $3, 'args' => $5)); }
|
||||
{ $$ = new PHPParser_Node_Expr_StaticCall(array('class' => $1, 'func' => $3, 'args' => $5)); }
|
||||
| reference_variable T_PAAMAYIM_NEKUDOTAYIM T_STRING '(' function_call_argument_list ')'
|
||||
{ $$ = new Node_Expr_StaticCall(array('class' => $1, 'func' => $3, 'args' => $5)); }
|
||||
{ $$ = new PHPParser_Node_Expr_StaticCall(array('class' => $1, 'func' => $3, 'args' => $5)); }
|
||||
| static_property_with_arrays '(' function_call_argument_list ')' {
|
||||
if ($1 instanceof Node_Expr_StaticPropertyFetch) {
|
||||
$$ = new Node_Expr_StaticCall(array('class' => $1->class, 'func' => $1->name, 'args' => $3));
|
||||
} elseif ($1 instanceof Node_Expr_ArrayDimFetch) {
|
||||
if ($1 instanceof PHPParser_Node_Expr_StaticPropertyFetch) {
|
||||
$$ = new PHPParser_Node_Expr_StaticCall(array('class' => $1->class, 'func' => $1->name, 'args' => $3));
|
||||
} elseif ($1 instanceof PHPParser_Node_Expr_ArrayDimFetch) {
|
||||
$2 = $1; // $2 is just a temporary variable. Nothing to do with the '('
|
||||
while ($2->var instanceof Node_Expr_ArrayDimFetch) {
|
||||
while ($2->var instanceof PHPParser_Node_Expr_ArrayDimFetch) {
|
||||
$2 = $2->var;
|
||||
}
|
||||
|
||||
$$ = new Node_Expr_StaticCall(array('class' => $2->var->class, 'func' => $1, 'args' => $3));
|
||||
$2->var = new Node_Variable(array('name' => $2->var->name));
|
||||
$$ = new PHPParser_Node_Expr_StaticCall(array('class' => $2->var->class, 'func' => $1, 'args' => $3));
|
||||
$2->var = new PHPParser_Node_Variable(array('name' => $2->var->name));
|
||||
} else {
|
||||
throw new Exception;
|
||||
}
|
||||
}
|
||||
| variable_without_objects '(' function_call_argument_list ')'
|
||||
{ $$ = new Node_Expr_FuncCall(array('func' => $1, 'args' => $3)); }
|
||||
{ $$ = new PHPParser_Node_Expr_FuncCall(array('func' => $1, 'args' => $3)); }
|
||||
;
|
||||
|
||||
class_name:
|
||||
@ -569,8 +569,8 @@ class_name:
|
||||
|
||||
name:
|
||||
namespace_name { $$ = $1; }
|
||||
| T_NAMESPACE T_NS_SEPARATOR namespace_name { $3->resolveType(Node_Name::RELATIVE); $$ = $3; }
|
||||
| T_NS_SEPARATOR namespace_name { $2->resolveType(Node_Name::ABSOLUTE); $$ = $2; }
|
||||
| T_NAMESPACE T_NS_SEPARATOR namespace_name { $3->resolveType(PHPParser_Node_Name::RELATIVE); $$ = $3; }
|
||||
| T_NS_SEPARATOR namespace_name { $2->resolveType(PHPParser_Node_Name::ABSOLUTE); $$ = $2; }
|
||||
;
|
||||
|
||||
class_name_reference:
|
||||
@ -585,11 +585,11 @@ dynamic_class_name_reference:
|
||||
|
||||
object_access_for_dcnr:
|
||||
| base_variable T_OBJECT_OPERATOR object_property
|
||||
{ $$ = new Node_Expr_PropertyFetch(array('var' => $1, 'name' => $3)); }
|
||||
{ $$ = new PHPParser_Node_Expr_PropertyFetch(array('var' => $1, 'name' => $3)); }
|
||||
| object_access_for_dcnr T_OBJECT_OPERATOR object_property
|
||||
{ $$ = new Node_Expr_PropertyFetch(array('var' => $1, 'name' => $3)); }
|
||||
| object_access_for_dcnr '[' dim_offset ']' { $$ = new Node_Expr_ArrayDimFetch(array('var' => $1, 'dim' => $3)); }
|
||||
| object_access_for_dcnr '{' expr '}' { $$ = new Node_Expr_ArrayDimFetch(array('var' => $1, 'dim' => $3)); }
|
||||
{ $$ = new PHPParser_Node_Expr_PropertyFetch(array('var' => $1, 'name' => $3)); }
|
||||
| object_access_for_dcnr '[' dim_offset ']' { $$ = new PHPParser_Node_Expr_ArrayDimFetch(array('var' => $1, 'dim' => $3)); }
|
||||
| object_access_for_dcnr '{' expr '}' { $$ = new PHPParser_Node_Expr_ArrayDimFetch(array('var' => $1, 'dim' => $3)); }
|
||||
;
|
||||
|
||||
exit_expr:
|
||||
@ -600,7 +600,7 @@ exit_expr:
|
||||
|
||||
backticks_expr:
|
||||
/* empty */ { $$ = array(); }
|
||||
| T_ENCAPSED_AND_WHITESPACE { $$ = array(Node_Scalar_String::parseEscapeSequences($1)); }
|
||||
| T_ENCAPSED_AND_WHITESPACE { $$ = array(PHPParser_Node_Scalar_String::parseEscapeSequences($1)); }
|
||||
| encaps_list { $$ = $1; }
|
||||
;
|
||||
|
||||
@ -610,38 +610,38 @@ ctor_arguments:
|
||||
;
|
||||
|
||||
common_scalar:
|
||||
T_LNUMBER { $$ = new Node_Scalar_LNumber(array('value' => (int) $1)); }
|
||||
| T_DNUMBER { $$ = new Node_Scalar_DNumber(array('value' => (double) $1)); }
|
||||
| T_CONSTANT_ENCAPSED_STRING { $$ = Node_Scalar_String::create($1); }
|
||||
| T_LINE { $$ = new Node_Scalar_LineConst(array()); }
|
||||
| T_FILE { $$ = new Node_Scalar_FileConst(array()); }
|
||||
| T_DIR { $$ = new Node_Scalar_DirConst(array()); }
|
||||
| T_CLASS_C { $$ = new Node_Scalar_ClassConst(array()); }
|
||||
| T_METHOD_C { $$ = new Node_Scalar_MethodConst(array()); }
|
||||
| T_FUNC_C { $$ = new Node_Scalar_FuncConst(array()); }
|
||||
| T_NS_C { $$ = new Node_Scalar_NSConst(array()); }
|
||||
T_LNUMBER { $$ = new PHPParser_Node_Scalar_LNumber(array('value' => (int) $1)); }
|
||||
| T_DNUMBER { $$ = new PHPParser_Node_Scalar_DNumber(array('value' => (double) $1)); }
|
||||
| T_CONSTANT_ENCAPSED_STRING { $$ = PHPParser_Node_Scalar_String::create($1); }
|
||||
| T_LINE { $$ = new PHPParser_Node_Scalar_LineConst(array()); }
|
||||
| T_FILE { $$ = new PHPParser_Node_Scalar_FileConst(array()); }
|
||||
| T_DIR { $$ = new PHPParser_Node_Scalar_DirConst(array()); }
|
||||
| T_CLASS_C { $$ = new PHPParser_Node_Scalar_ClassConst(array()); }
|
||||
| T_METHOD_C { $$ = new PHPParser_Node_Scalar_MethodConst(array()); }
|
||||
| T_FUNC_C { $$ = new PHPParser_Node_Scalar_FuncConst(array()); }
|
||||
| T_NS_C { $$ = new PHPParser_Node_Scalar_NSConst(array()); }
|
||||
| T_START_HEREDOC T_ENCAPSED_AND_WHITESPACE T_END_HEREDOC
|
||||
{ $$ = new Node_Scalar_String(array('value' => Node_Scalar_String::parseEscapeSequences($2), 'isBinary' => false, 'type' => '\'' === $1[3] ? Node_Scalar_String::SINGLE_QUOTED : Node_Scalar_String::DOUBLE_QUOTED)); }
|
||||
{ $$ = new PHPParser_Node_Scalar_String(array('value' => PHPParser_Node_Scalar_String::parseEscapeSequences($2), 'isBinary' => false, 'type' => '\'' === $1[3] ? PHPParser_Node_Scalar_String::SINGLE_QUOTED : PHPParser_Node_Scalar_String::DOUBLE_QUOTED)); }
|
||||
| T_START_HEREDOC T_END_HEREDOC
|
||||
{ $$ = new Node_Scalar_String(array('value' => '', 'isBinary' => false, 'type' => Node_Scalar_String::SINGLE_QUOTED)); }
|
||||
{ $$ = new PHPParser_Node_Scalar_String(array('value' => '', 'isBinary' => false, 'type' => PHPParser_Node_Scalar_String::SINGLE_QUOTED)); }
|
||||
;
|
||||
|
||||
static_scalar: /* compile-time evaluated scalars */
|
||||
common_scalar { $$ = $1; }
|
||||
| name { $$ = new Node_Expr_ConstFetch(array('name' => $1)); }
|
||||
| '+' static_scalar { $$ = new Node_Expr_UnaryPlus(array('expr' => $2)); }
|
||||
| '-' static_scalar { $$ = new Node_Expr_UnaryMinus(array('expr' => $2)); }
|
||||
| T_ARRAY '(' static_array_pair_list ')' { $$ = new Node_Expr_Array(array('items' => $3)); }
|
||||
| class_name T_PAAMAYIM_NEKUDOTAYIM T_STRING { $$ = new Node_Expr_ClassConstFetch(array('class' => $1, 'name' => $3)); }
|
||||
| name { $$ = new PHPParser_Node_Expr_ConstFetch(array('name' => $1)); }
|
||||
| '+' static_scalar { $$ = new PHPParser_Node_Expr_UnaryPlus(array('expr' => $2)); }
|
||||
| '-' static_scalar { $$ = new PHPParser_Node_Expr_UnaryMinus(array('expr' => $2)); }
|
||||
| T_ARRAY '(' static_array_pair_list ')' { $$ = new PHPParser_Node_Expr_Array(array('items' => $3)); }
|
||||
| class_name T_PAAMAYIM_NEKUDOTAYIM T_STRING { $$ = new PHPParser_Node_Expr_ClassConstFetch(array('class' => $1, 'name' => $3)); }
|
||||
;
|
||||
|
||||
scalar:
|
||||
T_STRING_VARNAME { $$ = new Node_Scalar_String(array('value' => $1, 'isBinary' => false, 'type' => Node_Scalar_String::SINGLE_QUOTED)); }
|
||||
T_STRING_VARNAME { $$ = new PHPParser_Node_Scalar_String(array('value' => $1, 'isBinary' => false, 'type' => PHPParser_Node_Scalar_String::SINGLE_QUOTED)); }
|
||||
| class_constant { $$ = $1; }
|
||||
| name { $$ = new Node_Expr_ConstFetch(array('name' => $1)); }
|
||||
| name { $$ = new PHPParser_Node_Expr_ConstFetch(array('name' => $1)); }
|
||||
| common_scalar { $$ = $1; }
|
||||
| '"' encaps_list '"' { $$ = new Node_Scalar_Encapsed(array('parts' => $2)); }
|
||||
| T_START_HEREDOC encaps_list T_END_HEREDOC { $$ = new Node_Scalar_Encapsed(array('parts' => $2)); }
|
||||
| '"' encaps_list '"' { $$ = new PHPParser_Node_Scalar_Encapsed(array('parts' => $2)); }
|
||||
| T_START_HEREDOC encaps_list T_END_HEREDOC { $$ = new PHPParser_Node_Scalar_Encapsed(array('parts' => $2)); }
|
||||
;
|
||||
|
||||
static_array_pair_list:
|
||||
@ -656,10 +656,10 @@ optional_comma:
|
||||
|
||||
non_empty_static_array_pair_list:
|
||||
non_empty_static_array_pair_list ',' static_scalar T_DOUBLE_ARROW static_scalar
|
||||
{ $1[] = new Node_Expr_ArrayItem(array('key' => $3, 'value' => $5, 'byRef' => false)); $$ = $1; }
|
||||
| non_empty_static_array_pair_list ',' static_scalar { $1[] = new Node_Expr_ArrayItem(array('key' => null, 'value' => $3, 'byRef' => false)); $$ = $1; }
|
||||
| static_scalar T_DOUBLE_ARROW static_scalar { $$ = array(new Node_Expr_ArrayItem(array('key' => $1, 'value' => $3, 'byRef' => false))); }
|
||||
| static_scalar { $$ = array(new Node_Expr_ArrayItem(array('key' => null, 'value' => $1, 'byRef' => false))); }
|
||||
{ $1[] = new PHPParser_Node_Expr_ArrayItem(array('key' => $3, 'value' => $5, 'byRef' => false)); $$ = $1; }
|
||||
| non_empty_static_array_pair_list ',' static_scalar { $1[] = new PHPParser_Node_Expr_ArrayItem(array('key' => null, 'value' => $3, 'byRef' => false)); $$ = $1; }
|
||||
| static_scalar T_DOUBLE_ARROW static_scalar { $$ = array(new PHPParser_Node_Expr_ArrayItem(array('key' => $1, 'value' => $3, 'byRef' => false))); }
|
||||
| static_scalar { $$ = array(new PHPParser_Node_Expr_ArrayItem(array('key' => null, 'value' => $1, 'byRef' => false))); }
|
||||
;
|
||||
|
||||
variable:
|
||||
@ -671,50 +671,50 @@ variable:
|
||||
object_access:
|
||||
object_access_arrayable { $$ = $1; }
|
||||
| object_access_arrayable '(' function_call_argument_list ')'
|
||||
{ $$ = new Node_Expr_FuncCall(array('func' => $1, 'args' => $3)); }
|
||||
{ $$ = new PHPParser_Node_Expr_FuncCall(array('func' => $1, 'args' => $3)); }
|
||||
| variable T_OBJECT_OPERATOR object_property '(' function_call_argument_list ')'
|
||||
{ $$ = new Node_Expr_MethodCall(array('var' => $1, 'name' => $3, 'args' => $5)); }
|
||||
{ $$ = new PHPParser_Node_Expr_MethodCall(array('var' => $1, 'name' => $3, 'args' => $5)); }
|
||||
;
|
||||
|
||||
object_access_arrayable:
|
||||
variable T_OBJECT_OPERATOR object_property
|
||||
{ $$ = new Node_Expr_PropertyFetch(array('var' => $1, 'name' => $3)); }
|
||||
| object_access_arrayable '[' dim_offset ']' { $$ = new Node_Expr_ArrayDimFetch(array('var' => $1, 'dim' => $3)); }
|
||||
| object_access_arrayable '{' expr '}' { $$ = new Node_Expr_ArrayDimFetch(array('var' => $1, 'dim' => $3)); }
|
||||
{ $$ = new PHPParser_Node_Expr_PropertyFetch(array('var' => $1, 'name' => $3)); }
|
||||
| object_access_arrayable '[' dim_offset ']' { $$ = new PHPParser_Node_Expr_ArrayDimFetch(array('var' => $1, 'dim' => $3)); }
|
||||
| object_access_arrayable '{' expr '}' { $$ = new PHPParser_Node_Expr_ArrayDimFetch(array('var' => $1, 'dim' => $3)); }
|
||||
;
|
||||
|
||||
variable_without_objects:
|
||||
reference_variable { $$ = $1; }
|
||||
| '$' reference_variable { $$ = new Node_Variable(array('name' => $2)); }
|
||||
| '$' reference_variable { $$ = new PHPParser_Node_Variable(array('name' => $2)); }
|
||||
;
|
||||
|
||||
base_variable:
|
||||
variable_without_objects { $$ = $1; }
|
||||
| class_name T_PAAMAYIM_NEKUDOTAYIM '$' reference_variable
|
||||
{ $$ = new Node_Expr_StaticPropertyFetch(array('class' => $1, 'name' => $4)); }
|
||||
{ $$ = new PHPParser_Node_Expr_StaticPropertyFetch(array('class' => $1, 'name' => $4)); }
|
||||
| reference_variable T_PAAMAYIM_NEKUDOTAYIM '$' reference_variable
|
||||
{ $$ = new Node_Expr_StaticPropertyFetch(array('class' => $1, 'name' => $4)); }
|
||||
{ $$ = new PHPParser_Node_Expr_StaticPropertyFetch(array('class' => $1, 'name' => $4)); }
|
||||
| static_property_with_arrays { $$ = $1; }
|
||||
;
|
||||
|
||||
static_property_with_arrays:
|
||||
class_name T_PAAMAYIM_NEKUDOTAYIM T_VARIABLE
|
||||
{ $$ = new Node_Expr_StaticPropertyFetch(array('class' => $1, 'name' => substr($3, 1))); }
|
||||
{ $$ = new PHPParser_Node_Expr_StaticPropertyFetch(array('class' => $1, 'name' => substr($3, 1))); }
|
||||
| reference_variable T_PAAMAYIM_NEKUDOTAYIM T_VARIABLE
|
||||
{ $$ = new Node_Expr_StaticPropertyFetch(array('class' => $1, 'name' => substr($3, 1))); }
|
||||
{ $$ = new PHPParser_Node_Expr_StaticPropertyFetch(array('class' => $1, 'name' => substr($3, 1))); }
|
||||
| class_name T_PAAMAYIM_NEKUDOTAYIM '$' '{' expr '}'
|
||||
{ $$ = new Node_Expr_StaticPropertyFetch(array('class' => $1, 'name' => $5)); }
|
||||
{ $$ = new PHPParser_Node_Expr_StaticPropertyFetch(array('class' => $1, 'name' => $5)); }
|
||||
| reference_variable T_PAAMAYIM_NEKUDOTAYIM '$' '{' expr '}'
|
||||
{ $$ = new Node_Expr_StaticPropertyFetch(array('class' => $1, 'name' => $5)); }
|
||||
| static_property_with_arrays '[' dim_offset ']' { $$ = new Node_Expr_ArrayDimFetch(array('var' => $1, 'dim' => $3)); }
|
||||
| static_property_with_arrays '{' expr '}' { $$ = new Node_Expr_ArrayDimFetch(array('var' => $1, 'dim' => $3)); }
|
||||
{ $$ = new PHPParser_Node_Expr_StaticPropertyFetch(array('class' => $1, 'name' => $5)); }
|
||||
| static_property_with_arrays '[' dim_offset ']' { $$ = new PHPParser_Node_Expr_ArrayDimFetch(array('var' => $1, 'dim' => $3)); }
|
||||
| static_property_with_arrays '{' expr '}' { $$ = new PHPParser_Node_Expr_ArrayDimFetch(array('var' => $1, 'dim' => $3)); }
|
||||
;
|
||||
|
||||
reference_variable:
|
||||
reference_variable '[' dim_offset ']' { $$ = new Node_Expr_ArrayDimFetch(array('var' => $1, 'dim' => $3)); }
|
||||
| reference_variable '{' expr '}' { $$ = new Node_Expr_ArrayDimFetch(array('var' => $1, 'dim' => $3)); }
|
||||
| T_VARIABLE { $$ = new Node_Variable(array('name' => substr($1, 1))); }
|
||||
| '$' '{' expr '}' { $$ = new Node_Variable(array('name' => $3)); }
|
||||
reference_variable '[' dim_offset ']' { $$ = new PHPParser_Node_Expr_ArrayDimFetch(array('var' => $1, 'dim' => $3)); }
|
||||
| reference_variable '{' expr '}' { $$ = new PHPParser_Node_Expr_ArrayDimFetch(array('var' => $1, 'dim' => $3)); }
|
||||
| T_VARIABLE { $$ = new PHPParser_Node_Variable(array('name' => substr($1, 1))); }
|
||||
| '$' '{' expr '}' { $$ = new PHPParser_Node_Variable(array('name' => $3)); }
|
||||
;
|
||||
|
||||
dim_offset:
|
||||
@ -746,43 +746,43 @@ array_pair_list:
|
||||
|
||||
non_empty_array_pair_list:
|
||||
non_empty_array_pair_list ',' expr T_DOUBLE_ARROW expr
|
||||
{ $1[] = new Node_Expr_ArrayItem(array('key' => $3, 'value' => $5, 'byRef' => false)); $$ = $1; }
|
||||
| non_empty_array_pair_list ',' expr { $1[] = new Node_Expr_ArrayItem(array('key' => null, 'value' => $3, 'byRef' => false)); $$ = $1; }
|
||||
| expr T_DOUBLE_ARROW expr { $$ = array(new Node_Expr_ArrayItem(array('key' => $1, 'value' => $3, 'byRef' => false))); }
|
||||
| expr { $$ = array(new Node_Expr_ArrayItem(array('key' => null, 'value' => $1, 'byRef' => false))); }
|
||||
{ $1[] = new PHPParser_Node_Expr_ArrayItem(array('key' => $3, 'value' => $5, 'byRef' => false)); $$ = $1; }
|
||||
| non_empty_array_pair_list ',' expr { $1[] = new PHPParser_Node_Expr_ArrayItem(array('key' => null, 'value' => $3, 'byRef' => false)); $$ = $1; }
|
||||
| expr T_DOUBLE_ARROW expr { $$ = array(new PHPParser_Node_Expr_ArrayItem(array('key' => $1, 'value' => $3, 'byRef' => false))); }
|
||||
| expr { $$ = array(new PHPParser_Node_Expr_ArrayItem(array('key' => null, 'value' => $1, 'byRef' => false))); }
|
||||
| non_empty_array_pair_list ',' expr T_DOUBLE_ARROW '&' variable
|
||||
{ $1[] = new Node_Expr_ArrayItem(array('key' => $3, 'value' => $6, 'byRef' => true)); $$ = $1; }
|
||||
| non_empty_array_pair_list ',' '&' variable { $1[] = new Node_Expr_ArrayItem(array('key' => null, 'value' => $4, 'byRef' => true)); $$ = $1; }
|
||||
| expr T_DOUBLE_ARROW '&' variable { $$ = array(new Node_Expr_ArrayItem(array('key' => $1, 'value' => $4, 'byRef' => true))); }
|
||||
| '&' variable { $$ = array(new Node_Expr_ArrayItem(array('key' => null, 'value' => $2, 'byRef' => true))); }
|
||||
{ $1[] = new PHPParser_Node_Expr_ArrayItem(array('key' => $3, 'value' => $6, 'byRef' => true)); $$ = $1; }
|
||||
| non_empty_array_pair_list ',' '&' variable { $1[] = new PHPParser_Node_Expr_ArrayItem(array('key' => null, 'value' => $4, 'byRef' => true)); $$ = $1; }
|
||||
| expr T_DOUBLE_ARROW '&' variable { $$ = array(new PHPParser_Node_Expr_ArrayItem(array('key' => $1, 'value' => $4, 'byRef' => true))); }
|
||||
| '&' variable { $$ = array(new PHPParser_Node_Expr_ArrayItem(array('key' => null, 'value' => $2, 'byRef' => true))); }
|
||||
;
|
||||
|
||||
encaps_list:
|
||||
encaps_list encaps_var { $1[] = $2; $$ = $1; }
|
||||
| encaps_list T_ENCAPSED_AND_WHITESPACE { $1[] = Node_Scalar_String::parseEscapeSequences($2); $$ = $1; }
|
||||
| encaps_list T_ENCAPSED_AND_WHITESPACE { $1[] = PHPParser_Node_Scalar_String::parseEscapeSequences($2); $$ = $1; }
|
||||
| encaps_var { $$ = array($1); }
|
||||
| T_ENCAPSED_AND_WHITESPACE encaps_var { $$ = array(Node_Scalar_String::parseEscapeSequences($1), $2); }
|
||||
| T_ENCAPSED_AND_WHITESPACE encaps_var { $$ = array(PHPParser_Node_Scalar_String::parseEscapeSequences($1), $2); }
|
||||
;
|
||||
|
||||
encaps_var:
|
||||
T_VARIABLE { $$ = new Node_Variable(array('name' => substr($1, 1))); }
|
||||
| T_VARIABLE '[' encaps_var_offset ']' { $$ = new Node_Expr_ArrayDimFetch(array('var' => new Node_Variable(array('name' => substr($1, 1))), 'dim' => $3)); }
|
||||
| T_VARIABLE T_OBJECT_OPERATOR T_STRING { $$ = new Node_Expr_PropertyFetch(array('var' => new Node_Variable(array('name' => substr($1, 1))), 'name' => $3)); }
|
||||
| T_DOLLAR_OPEN_CURLY_BRACES expr '}' { $$ = new Node_Variable(array('name' => $2)); }
|
||||
T_VARIABLE { $$ = new PHPParser_Node_Variable(array('name' => substr($1, 1))); }
|
||||
| T_VARIABLE '[' encaps_var_offset ']' { $$ = new PHPParser_Node_Expr_ArrayDimFetch(array('var' => new PHPParser_Node_Variable(array('name' => substr($1, 1))), 'dim' => $3)); }
|
||||
| T_VARIABLE T_OBJECT_OPERATOR T_STRING { $$ = new PHPParser_Node_Expr_PropertyFetch(array('var' => new PHPParser_Node_Variable(array('name' => substr($1, 1))), 'name' => $3)); }
|
||||
| T_DOLLAR_OPEN_CURLY_BRACES expr '}' { $$ = new PHPParser_Node_Variable(array('name' => $2)); }
|
||||
| T_DOLLAR_OPEN_CURLY_BRACES T_STRING_VARNAME '[' expr ']' '}'
|
||||
{ $$ = new Node_Expr_ArrayDimFetch(array('var' => new Node_Variable(array('name' => $2)), 'dim' => $4)); }
|
||||
{ $$ = new PHPParser_Node_Expr_ArrayDimFetch(array('var' => new PHPParser_Node_Variable(array('name' => $2)), 'dim' => $4)); }
|
||||
| T_CURLY_OPEN variable '}' { $$ = $2; }
|
||||
;
|
||||
|
||||
encaps_var_offset:
|
||||
T_STRING { $$ = new Node_Scalar_String(array('value' => $1, 'isBinary' => false, 'type' => Node_Scalar_String::SINGLE_QUOTED)); }
|
||||
| T_NUM_STRING { $$ = new Node_Scalar_LNumber(array('value' => (int) $1)); }
|
||||
| T_VARIABLE { $$ = new Node_Variable(array('name' => substr($1, 1))); }
|
||||
T_STRING { $$ = new PHPParser_Node_Scalar_String(array('value' => $1, 'isBinary' => false, 'type' => PHPParser_Node_Scalar_String::SINGLE_QUOTED)); }
|
||||
| T_NUM_STRING { $$ = new PHPParser_Node_Scalar_LNumber(array('value' => (int) $1)); }
|
||||
| T_VARIABLE { $$ = new PHPParser_Node_Variable(array('name' => substr($1, 1))); }
|
||||
;
|
||||
|
||||
class_constant:
|
||||
class_name T_PAAMAYIM_NEKUDOTAYIM T_STRING { $$ = new Node_Expr_ClassConstFetch(array('class' => $1, 'name' => $3)); }
|
||||
| reference_variable T_PAAMAYIM_NEKUDOTAYIM T_STRING { $$ = new Node_Expr_ClassConstFetch(array('class' => $1, 'name' => $3)); }
|
||||
class_name T_PAAMAYIM_NEKUDOTAYIM T_STRING { $$ = new PHPParser_Node_Expr_ClassConstFetch(array('class' => $1, 'name' => $3)); }
|
||||
| reference_variable T_PAAMAYIM_NEKUDOTAYIM T_STRING { $$ = new PHPParser_Node_Expr_ClassConstFetch(array('class' => $1, 'name' => $3)); }
|
||||
;
|
||||
|
||||
%%
|
||||
|
@ -544,11 +544,11 @@ function_call:
|
||||
| reference_variable T_PAAMAYIM_NEKUDOTAYIM T_STRING '(' function_call_argument_list ')'
|
||||
{ $$ = Expr_StaticCall[class: $1, func: $3, args: $5]; }
|
||||
| static_property_with_arrays '(' function_call_argument_list ')' {
|
||||
if ($1 instanceof Node_Expr_StaticPropertyFetch) {
|
||||
if ($1 instanceof PHPParser_Node_Expr_StaticPropertyFetch) {
|
||||
$$ = Expr_StaticCall[class: $1->class, func: $1->name, args: $3];
|
||||
} elseif ($1 instanceof Node_Expr_ArrayDimFetch) {
|
||||
} elseif ($1 instanceof PHPParser_Node_Expr_ArrayDimFetch) {
|
||||
$2 = $1; // $2 is just a temporary variable. Nothing to do with the '('
|
||||
while ($2->var instanceof Node_Expr_ArrayDimFetch) {
|
||||
while ($2->var instanceof PHPParser_Node_Expr_ArrayDimFetch) {
|
||||
$2 = $2->var;
|
||||
}
|
||||
|
||||
|
@ -1,5 +0,0 @@
|
||||
<?php
|
||||
|
||||
abstract class Node_Expr extends NodeAbstract
|
||||
{
|
||||
}
|
@ -1,8 +0,0 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @property array $items Items
|
||||
*/
|
||||
class Node_Expr_Array extends Node_Expr
|
||||
{
|
||||
}
|
@ -1,8 +0,0 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @property Node_Expr $expr Expression
|
||||
*/
|
||||
class Node_Expr_ArrayCast extends Node_Expr
|
||||
{
|
||||
}
|
@ -1,9 +0,0 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @property Node_Variable $var Variable
|
||||
* @property null|Node_Expr $dim Array index / dim
|
||||
*/
|
||||
class Node_Expr_ArrayDimFetch extends Node_Expr
|
||||
{
|
||||
}
|
@ -1,10 +0,0 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @property Node_Expr $key Key
|
||||
* @property Node_Expr $value Value
|
||||
* @property bool $byRef Whether to assign by reference
|
||||
*/
|
||||
class Node_Expr_ArrayItem extends Node_Expr
|
||||
{
|
||||
}
|
@ -1,9 +0,0 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @property Node_Variable $var Variable
|
||||
* @property Node_Expr $expr Expression
|
||||
*/
|
||||
class Node_Expr_Assign extends Node_Expr
|
||||
{
|
||||
}
|
@ -1,9 +0,0 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @property Node_Variable $var Variable
|
||||
* @property Node_Expr $expr Expression
|
||||
*/
|
||||
class Node_Expr_AssignBinAnd extends Node_Expr
|
||||
{
|
||||
}
|
@ -1,9 +0,0 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @property Node_Variable $var Variable
|
||||
* @property Node_Expr $expr Expression
|
||||
*/
|
||||
class Node_Expr_AssignBinOr extends Node_Expr
|
||||
{
|
||||
}
|
@ -1,9 +0,0 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @property Node_Variable $var Variable
|
||||
* @property Node_Expr $expr Expression
|
||||
*/
|
||||
class Node_Expr_AssignBinXor extends Node_Expr
|
||||
{
|
||||
}
|
@ -1,9 +0,0 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @property Node_Variable $var Variable
|
||||
* @property Node_Expr $expr Expression
|
||||
*/
|
||||
class Node_Expr_AssignConcat extends Node_Expr
|
||||
{
|
||||
}
|
@ -1,9 +0,0 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @property Node_Variable $var Variable
|
||||
* @property Node_Expr $expr Expression
|
||||
*/
|
||||
class Node_Expr_AssignDiv extends Node_Expr
|
||||
{
|
||||
}
|
@ -1,9 +0,0 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @property Node_Variable $var Variable
|
||||
* @property Node_Expr $expr Expression
|
||||
*/
|
||||
class Node_Expr_AssignMinus extends Node_Expr
|
||||
{
|
||||
}
|
@ -1,9 +0,0 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @property Node_Variable $var Variable
|
||||
* @property Node_Expr $expr Expression
|
||||
*/
|
||||
class Node_Expr_AssignMod extends Node_Expr
|
||||
{
|
||||
}
|
@ -1,9 +0,0 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @property Node_Variable $var Variable
|
||||
* @property Node_Expr $expr Expression
|
||||
*/
|
||||
class Node_Expr_AssignMul extends Node_Expr
|
||||
{
|
||||
}
|
@ -1,9 +0,0 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @property Node_Variable $var Variable
|
||||
* @property Node_Expr $expr Expression
|
||||
*/
|
||||
class Node_Expr_AssignPlus extends Node_Expr
|
||||
{
|
||||
}
|
@ -1,9 +0,0 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @property Node_Variable $var Variable reference is assigned to
|
||||
* @property Node_Variable $refVar Variable which is referenced
|
||||
*/
|
||||
class Node_Expr_AssignRef extends Node_Expr
|
||||
{
|
||||
}
|
@ -1,9 +0,0 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @property Node_Variable $var Variable
|
||||
* @property Node_Expr $expr Expression
|
||||
*/
|
||||
class Node_Expr_AssignShiftLeft extends Node_Expr
|
||||
{
|
||||
}
|
@ -1,9 +0,0 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @property Node_Variable $var Variable
|
||||
* @property Node_Expr $expr Expression
|
||||
*/
|
||||
class Node_Expr_AssignShiftRight extends Node_Expr
|
||||
{
|
||||
}
|
@ -1,9 +0,0 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @property Node_Expr $left The left hand side expression
|
||||
* @property Node_Expr $right The right hand side expression
|
||||
*/
|
||||
class Node_Expr_BinaryAnd extends Node_Expr
|
||||
{
|
||||
}
|
@ -1,8 +0,0 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @property Node_Expr $expr Expression
|
||||
*/
|
||||
class Node_Expr_BinaryNot extends Node_Expr
|
||||
{
|
||||
}
|
@ -1,9 +0,0 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @property Node_Expr $left The left hand side expression
|
||||
* @property Node_Expr $right The right hand side expression
|
||||
*/
|
||||
class Node_Expr_BinaryOr extends Node_Expr
|
||||
{
|
||||
}
|
@ -1,9 +0,0 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @property Node_Expr $left The left hand side expression
|
||||
* @property Node_Expr $right The right hand side expression
|
||||
*/
|
||||
class Node_Expr_BinaryXor extends Node_Expr
|
||||
{
|
||||
}
|
@ -1,8 +0,0 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @property Node_Expr $expr Expression
|
||||
*/
|
||||
class Node_Expr_BoolCast extends Node_Expr
|
||||
{
|
||||
}
|
@ -1,9 +0,0 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @property Node_Expr $left The left hand side expression
|
||||
* @property Node_Expr $right The right hand side expression
|
||||
*/
|
||||
class Node_Expr_BooleanAnd extends Node_Expr
|
||||
{
|
||||
}
|
@ -1,8 +0,0 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @property Node_Expr $expr Expression
|
||||
*/
|
||||
class Node_Expr_BooleanNot extends Node_Expr
|
||||
{
|
||||
}
|
@ -1,9 +0,0 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @property Node_Expr $left The left hand side expression
|
||||
* @property Node_Expr $right The right hand side expression
|
||||
*/
|
||||
class Node_Expr_BooleanOr extends Node_Expr
|
||||
{
|
||||
}
|
@ -1,8 +0,0 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @property Node_Expr $expr Expression
|
||||
*/
|
||||
class Node_Expr_Clone extends Node_Expr
|
||||
{
|
||||
}
|
@ -1,9 +0,0 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @property Node_Expr $left The left hand side expression
|
||||
* @property Node_Expr $right The right hand side expression
|
||||
*/
|
||||
class Node_Expr_Concat extends Node_Expr
|
||||
{
|
||||
}
|
@ -1,8 +0,0 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @property Node_Name $name Name of constant
|
||||
*/
|
||||
class Node_Expr_ConstFetch extends Node_Expr
|
||||
{
|
||||
}
|
@ -1,9 +0,0 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @property Node_Expr $left The left hand side expression
|
||||
* @property Node_Expr $right The right hand side expression
|
||||
*/
|
||||
class Node_Expr_Div extends Node_Expr
|
||||
{
|
||||
}
|
@ -1,8 +0,0 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @property Node_Expr $expr Expression
|
||||
*/
|
||||
class Node_Expr_DoubleCast extends Node_Expr
|
||||
{
|
||||
}
|
@ -1,8 +0,0 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @property Node_Variable $var Variable
|
||||
*/
|
||||
class Node_Expr_Empty extends Node_Expr
|
||||
{
|
||||
}
|
@ -1,9 +0,0 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @property Node_Expr $left The left hand side expression
|
||||
* @property Node_Expr $right The right hand side expression
|
||||
*/
|
||||
class Node_Expr_Equal extends Node_Expr
|
||||
{
|
||||
}
|
@ -1,8 +0,0 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @property Node_Expr $expr Expression
|
||||
*/
|
||||
class Node_Expr_ErrorSuppress extends Node_Expr
|
||||
{
|
||||
}
|
@ -1,8 +0,0 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @property Node_Expr $expr Expression
|
||||
*/
|
||||
class Node_Expr_Eval extends Node_Expr
|
||||
{
|
||||
}
|
@ -1,8 +0,0 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @property null|Node_Expr $expr Expression
|
||||
*/
|
||||
class Node_Expr_Exit extends Node_Expr
|
||||
{
|
||||
}
|
@ -1,9 +0,0 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @property Node_Name $func Name of function
|
||||
* @property array $args Arguments
|
||||
*/
|
||||
class Node_Expr_FuncCall extends Node_Expr
|
||||
{
|
||||
}
|
@ -1,9 +0,0 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @property Node_Expr $value Value to pass
|
||||
* @property bool $byRef Whether to pass by ref
|
||||
*/
|
||||
class Node_Expr_FuncCallArg extends Node_Expr
|
||||
{
|
||||
}
|
@ -1,9 +0,0 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @property Node_Expr $left The left hand side expression
|
||||
* @property Node_Expr $right The right hand side expression
|
||||
*/
|
||||
class Node_Expr_Greater extends Node_Expr
|
||||
{
|
||||
}
|
@ -1,9 +0,0 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @property Node_Expr $left The left hand side expression
|
||||
* @property Node_Expr $right The right hand side expression
|
||||
*/
|
||||
class Node_Expr_GreaterOrEqual extends Node_Expr
|
||||
{
|
||||
}
|
@ -1,9 +0,0 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @property Node_Expr $left The left hand side expression
|
||||
* @property Node_Expr $right The right hand side expression
|
||||
*/
|
||||
class Node_Expr_Identical extends Node_Expr
|
||||
{
|
||||
}
|
@ -1,9 +0,0 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @property Node_Expr $expr Expression
|
||||
* @property Node_Expr $class Class name
|
||||
*/
|
||||
class Node_Expr_Instanceof extends Node_Expr
|
||||
{
|
||||
}
|
@ -1,8 +0,0 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @property Node_Expr $expr Expression
|
||||
*/
|
||||
class Node_Expr_IntCast extends Node_Expr
|
||||
{
|
||||
}
|
@ -1,8 +0,0 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @property array $vars Variables
|
||||
*/
|
||||
class Node_Expr_Isset extends Node_Expr
|
||||
{
|
||||
}
|
@ -1,9 +0,0 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @property array $assignList List of variables to assign to
|
||||
* @property Node_Expr $expr Expression
|
||||
*/
|
||||
class Node_Expr_List extends Node_Expr
|
||||
{
|
||||
}
|
@ -1,9 +0,0 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @property Node_Expr $left The left hand side expression
|
||||
* @property Node_Expr $right The right hand side expression
|
||||
*/
|
||||
class Node_Expr_LogicalAnd extends Node_Expr
|
||||
{
|
||||
}
|
@ -1,9 +0,0 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @property Node_Expr $left The left hand side expression
|
||||
* @property Node_Expr $right The right hand side expression
|
||||
*/
|
||||
class Node_Expr_LogicalOr extends Node_Expr
|
||||
{
|
||||
}
|
@ -1,9 +0,0 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @property Node_Expr $left The left hand side expression
|
||||
* @property Node_Expr $right The right hand side expression
|
||||
*/
|
||||
class Node_Expr_LogicalXor extends Node_Expr
|
||||
{
|
||||
}
|
@ -1,10 +0,0 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @property Node_Variable $var Variable holding object
|
||||
* @property string|Node_Expr $name Name
|
||||
* @property array $args Arguments
|
||||
*/
|
||||
class Node_Expr_MethodCall extends Node_Expr
|
||||
{
|
||||
}
|
@ -1,9 +0,0 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @property Node_Expr $left The left hand side expression
|
||||
* @property Node_Expr $right The right hand side expression
|
||||
*/
|
||||
class Node_Expr_Minus extends Node_Expr
|
||||
{
|
||||
}
|
@ -1,9 +0,0 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @property Node_Expr $left The left hand side expression
|
||||
* @property Node_Expr $right The right hand side expression
|
||||
*/
|
||||
class Node_Expr_Mod extends Node_Expr
|
||||
{
|
||||
}
|
@ -1,9 +0,0 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @property Node_Expr $left The left hand side expression
|
||||
* @property Node_Expr $right The right hand side expression
|
||||
*/
|
||||
class Node_Expr_Mul extends Node_Expr
|
||||
{
|
||||
}
|
@ -1,9 +0,0 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @property Node_Name $class Class
|
||||
* @property array $args Arguments
|
||||
*/
|
||||
class Node_Expr_New extends Node_Expr
|
||||
{
|
||||
}
|
@ -1,9 +0,0 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @property Node_Expr $left The left hand side expression
|
||||
* @property Node_Expr $right The right hand side expression
|
||||
*/
|
||||
class Node_Expr_NotEqual extends Node_Expr
|
||||
{
|
||||
}
|
@ -1,9 +0,0 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @property Node_Expr $left The left hand side expression
|
||||
* @property Node_Expr $right The right hand side expression
|
||||
*/
|
||||
class Node_Expr_NotIdentical extends Node_Expr
|
||||
{
|
||||
}
|
@ -1,8 +0,0 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @property Node_Expr $expr Expression
|
||||
*/
|
||||
class Node_Expr_ObjectCast extends Node_Expr
|
||||
{
|
||||
}
|
@ -1,9 +0,0 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @property Node_Expr $left The left hand side expression
|
||||
* @property Node_Expr $right The right hand side expression
|
||||
*/
|
||||
class Node_Expr_Plus extends Node_Expr
|
||||
{
|
||||
}
|
@ -1,8 +0,0 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @property Node_Variable $var Variable
|
||||
*/
|
||||
class Node_Expr_PostDec extends Node_Expr
|
||||
{
|
||||
}
|
@ -1,8 +0,0 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @property Node_Variable $var Variable
|
||||
*/
|
||||
class Node_Expr_PostInc extends Node_Expr
|
||||
{
|
||||
}
|
@ -1,8 +0,0 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @property Node_Variable $var Variable
|
||||
*/
|
||||
class Node_Expr_PreDec extends Node_Expr
|
||||
{
|
||||
}
|
@ -1,8 +0,0 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @property Node_Variable $var Variable
|
||||
*/
|
||||
class Node_Expr_PreInc extends Node_Expr
|
||||
{
|
||||
}
|
@ -1,8 +0,0 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @property Node_Expr $expr Expression
|
||||
*/
|
||||
class Node_Expr_Print extends Node_Expr
|
||||
{
|
||||
}
|
@ -1,9 +0,0 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @property Node_Variable $var Variable holding object
|
||||
* @property string|Node_Expr|Node_Variable $name Name
|
||||
*/
|
||||
class Node_Expr_PropertyFetch extends Node_Expr
|
||||
{
|
||||
}
|
@ -1,9 +0,0 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @property Node_Expr $left The left hand side expression
|
||||
* @property Node_Expr $right The right hand side expression
|
||||
*/
|
||||
class Node_Expr_ShiftLeft extends Node_Expr
|
||||
{
|
||||
}
|
@ -1,9 +0,0 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @property Node_Expr $left The left hand side expression
|
||||
* @property Node_Expr $right The right hand side expression
|
||||
*/
|
||||
class Node_Expr_ShiftRight extends Node_Expr
|
||||
{
|
||||
}
|
@ -1,9 +0,0 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @property Node_Expr $left The left hand side expression
|
||||
* @property Node_Expr $right The right hand side expression
|
||||
*/
|
||||
class Node_Expr_Smaller extends Node_Expr
|
||||
{
|
||||
}
|
@ -1,9 +0,0 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @property Node_Expr $left The left hand side expression
|
||||
* @property Node_Expr $right The right hand side expression
|
||||
*/
|
||||
class Node_Expr_SmallerOrEqual extends Node_Expr
|
||||
{
|
||||
}
|
@ -1,10 +0,0 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @property Node_Name|Node_Variable $class Class name
|
||||
* @property string|Node_Variable $func Method name
|
||||
* @property array $args Arguments
|
||||
*/
|
||||
class Node_Expr_StaticCall extends Node_Expr
|
||||
{
|
||||
}
|
@ -1,9 +0,0 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @property Node_Expr $class Class name
|
||||
* @property string|Node_Expr $name Name
|
||||
*/
|
||||
class Node_Expr_StaticPropertyFetch extends Node_Expr
|
||||
{
|
||||
}
|
@ -1,8 +0,0 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @property Node_Expr $expr Expression
|
||||
*/
|
||||
class Node_Expr_StringCast extends Node_Expr
|
||||
{
|
||||
}
|
@ -1,10 +0,0 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @property Node_Expr $cond Condition
|
||||
* @property null|Node_Expr $if Expression for true
|
||||
* @property Node_Expr $else Expression for false
|
||||
*/
|
||||
class Node_Expr_Ternary extends Node_Expr
|
||||
{
|
||||
}
|
@ -1,8 +0,0 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @property Node_Expr $expr Expression
|
||||
*/
|
||||
class Node_Expr_UnaryMinus extends Node_Expr
|
||||
{
|
||||
}
|
@ -1,8 +0,0 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @property Node_Expr $expr Expression
|
||||
*/
|
||||
class Node_Expr_UnaryPlus extends Node_Expr
|
||||
{
|
||||
}
|
@ -1,8 +0,0 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @property Node_Expr $expr Expression
|
||||
*/
|
||||
class Node_Expr_UnsetCast extends Node_Expr
|
||||
{
|
||||
}
|
@ -1,5 +0,0 @@
|
||||
<?php
|
||||
|
||||
abstract class Node_Scalar extends Node_Expr
|
||||
{
|
||||
}
|
@ -1,5 +0,0 @@
|
||||
<?php
|
||||
|
||||
class Node_Scalar_ClassConst extends Node_Scalar
|
||||
{
|
||||
}
|
@ -1,5 +0,0 @@
|
||||
<?php
|
||||
|
||||
class Node_Scalar_Const extends Node_Scalar
|
||||
{
|
||||
}
|
@ -1,8 +0,0 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @property double $value Number value
|
||||
*/
|
||||
class Node_Scalar_DNumber extends Node_Scalar
|
||||
{
|
||||
}
|
@ -1,5 +0,0 @@
|
||||
<?php
|
||||
|
||||
class Node_Scalar_DirConst extends Node_Scalar
|
||||
{
|
||||
}
|
@ -1,8 +0,0 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @property array $parts Encaps list
|
||||
*/
|
||||
class Node_Scalar_Encapsed extends Node_Scalar
|
||||
{
|
||||
}
|
@ -1,5 +0,0 @@
|
||||
<?php
|
||||
|
||||
class Node_Scalar_FileConst extends Node_Scalar
|
||||
{
|
||||
}
|
@ -1,5 +0,0 @@
|
||||
<?php
|
||||
|
||||
class Node_Scalar_FuncConst extends Node_Scalar
|
||||
{
|
||||
}
|
@ -1,8 +0,0 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @property int $value Number value
|
||||
*/
|
||||
class Node_Scalar_LNumber extends Node_Scalar
|
||||
{
|
||||
}
|
@ -1,5 +0,0 @@
|
||||
<?php
|
||||
|
||||
class Node_Scalar_LineConst extends Node_Scalar
|
||||
{
|
||||
}
|
@ -1,5 +0,0 @@
|
||||
<?php
|
||||
|
||||
class Node_Scalar_MethodConst extends Node_Scalar
|
||||
{
|
||||
}
|
@ -1,5 +0,0 @@
|
||||
<?php
|
||||
|
||||
class Node_Scalar_NSConst extends Node_Scalar
|
||||
{
|
||||
}
|
@ -1,5 +0,0 @@
|
||||
<?php
|
||||
|
||||
class Node_Scalar_Number extends Node_Scalar
|
||||
{
|
||||
}
|
@ -1,5 +0,0 @@
|
||||
<?php
|
||||
|
||||
abstract class Node_Stmt extends NodeAbstract
|
||||
{
|
||||
}
|
@ -1,8 +0,0 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @property null|Node_Expr $num Number of loops to break
|
||||
*/
|
||||
class Node_Stmt_Break extends Node_Stmt
|
||||
{
|
||||
}
|
@ -1,9 +0,0 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @property null|Node_Expr $cond Condition (null for default)
|
||||
* @property array $stmts Statements
|
||||
*/
|
||||
class Node_Stmt_Case extends Node_Stmt
|
||||
{
|
||||
}
|
@ -1,10 +0,0 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @property Node_Name $type Class of exception
|
||||
* @property string $var Variable for exception
|
||||
* @property array $stmts Statements
|
||||
*/
|
||||
class Node_Stmt_Catch extends Node_Stmt
|
||||
{
|
||||
}
|
@ -1,9 +0,0 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @property string $name Name
|
||||
* @property Node_Expr $value Value
|
||||
*/
|
||||
class Node_Stmt_ClassConstConst extends Node_Stmt
|
||||
{
|
||||
}
|
@ -1,9 +0,0 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @property string $name Name
|
||||
* @property Node_Expr $value Value
|
||||
*/
|
||||
class Node_Stmt_ConstConst extends Node_Stmt
|
||||
{
|
||||
}
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
x
Reference in New Issue
Block a user