mirror of
https://github.com/nikic/PHP-Parser.git
synced 2025-01-17 07:08:14 +01:00
Remove inline Name[] creations
This ensures that the attributes on the Name nodes are correct.
This commit is contained in:
parent
74efea91d1
commit
8c59f41d02
@ -118,9 +118,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:
|
||||
@ -129,8 +133,8 @@ top_statement:
|
||||
| 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 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]; }
|
||||
| T_CONST constant_declaration_list ';' { $$ = Stmt\Const_[$2]; }
|
||||
@ -142,10 +146,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:
|
||||
@ -667,9 +671,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:
|
||||
|
File diff suppressed because it is too large
Load Diff
Loading…
x
Reference in New Issue
Block a user