comparison vendor/nikic/php-parser/grammar/php5.y @ 17:129ea1e6d783

Update, including to Drupal core 8.6.10
author Chris Cannam
date Thu, 28 Feb 2019 13:21:36 +0000
parents 5fb285c0d0e3
children
comparison
equal deleted inserted replaced
16:c2387f117808 17:129ea1e6d783
452 static_var: 452 static_var:
453 plain_variable { $$ = Stmt\StaticVar[$1, null]; } 453 plain_variable { $$ = Stmt\StaticVar[$1, null]; }
454 | plain_variable '=' static_scalar { $$ = Stmt\StaticVar[$1, $3]; } 454 | plain_variable '=' static_scalar { $$ = Stmt\StaticVar[$1, $3]; }
455 ; 455 ;
456 456
457 class_statement_list_ex:
458 class_statement_list_ex class_statement { if ($2 !== null) { push($1, $2); } }
459 | /* empty */ { init(); }
460 ;
461
457 class_statement_list: 462 class_statement_list:
458 class_statement_list class_statement { push($1, $2); } 463 class_statement_list_ex
459 | /* empty */ { init(); } 464 { makeNop($nop, $this->lookaheadStartAttributes, $this->endAttributes);
465 if ($nop !== null) { $1[] = $nop; } $$ = $1; }
460 ; 466 ;
461 467
462 class_statement: 468 class_statement:
463 variable_modifiers property_declaration_list ';' 469 variable_modifiers property_declaration_list ';'
464 { $$ = Stmt\Property[$1, $2]; $this->checkProperty($$, #1); } 470 { $$ = Stmt\Property[$1, $2]; $this->checkProperty($$, #1); }
571 | variable T_OR_EQUAL expr { $$ = Expr\AssignOp\BitwiseOr [$1, $3]; } 577 | variable T_OR_EQUAL expr { $$ = Expr\AssignOp\BitwiseOr [$1, $3]; }
572 | variable T_XOR_EQUAL expr { $$ = Expr\AssignOp\BitwiseXor[$1, $3]; } 578 | variable T_XOR_EQUAL expr { $$ = Expr\AssignOp\BitwiseXor[$1, $3]; }
573 | variable T_SL_EQUAL expr { $$ = Expr\AssignOp\ShiftLeft [$1, $3]; } 579 | variable T_SL_EQUAL expr { $$ = Expr\AssignOp\ShiftLeft [$1, $3]; }
574 | variable T_SR_EQUAL expr { $$ = Expr\AssignOp\ShiftRight[$1, $3]; } 580 | variable T_SR_EQUAL expr { $$ = Expr\AssignOp\ShiftRight[$1, $3]; }
575 | variable T_POW_EQUAL expr { $$ = Expr\AssignOp\Pow [$1, $3]; } 581 | variable T_POW_EQUAL expr { $$ = Expr\AssignOp\Pow [$1, $3]; }
582 | variable T_COALESCE_EQUAL expr { $$ = Expr\AssignOp\Coalesce [$1, $3]; }
576 | variable T_INC { $$ = Expr\PostInc[$1]; } 583 | variable T_INC { $$ = Expr\PostInc[$1]; }
577 | T_INC variable { $$ = Expr\PreInc [$2]; } 584 | T_INC variable { $$ = Expr\PreInc [$2]; }
578 | variable T_DEC { $$ = Expr\PostDec[$1]; } 585 | variable T_DEC { $$ = Expr\PostDec[$1]; }
579 | T_DEC variable { $$ = Expr\PreDec [$2]; } 586 | T_DEC variable { $$ = Expr\PreDec [$2]; }
580 | expr T_BOOLEAN_OR expr { $$ = Expr\BinaryOp\BooleanOr [$1, $3]; } 587 | expr T_BOOLEAN_OR expr { $$ = Expr\BinaryOp\BooleanOr [$1, $3]; }
620 | T_INCLUDE_ONCE expr { $$ = Expr\Include_[$2, Expr\Include_::TYPE_INCLUDE_ONCE]; } 627 | T_INCLUDE_ONCE expr { $$ = Expr\Include_[$2, Expr\Include_::TYPE_INCLUDE_ONCE]; }
621 | T_EVAL parentheses_expr { $$ = Expr\Eval_[$2]; } 628 | T_EVAL parentheses_expr { $$ = Expr\Eval_[$2]; }
622 | T_REQUIRE expr { $$ = Expr\Include_[$2, Expr\Include_::TYPE_REQUIRE]; } 629 | T_REQUIRE expr { $$ = Expr\Include_[$2, Expr\Include_::TYPE_REQUIRE]; }
623 | T_REQUIRE_ONCE expr { $$ = Expr\Include_[$2, Expr\Include_::TYPE_REQUIRE_ONCE]; } 630 | T_REQUIRE_ONCE expr { $$ = Expr\Include_[$2, Expr\Include_::TYPE_REQUIRE_ONCE]; }
624 | T_INT_CAST expr { $$ = Expr\Cast\Int_ [$2]; } 631 | T_INT_CAST expr { $$ = Expr\Cast\Int_ [$2]; }
625 | T_DOUBLE_CAST expr { $$ = Expr\Cast\Double [$2]; } 632 | T_DOUBLE_CAST expr
633 { $attrs = attributes();
634 $attrs['kind'] = $this->getFloatCastKind($1);
635 $$ = new Expr\Cast\Double($2, $attrs); }
626 | T_STRING_CAST expr { $$ = Expr\Cast\String_ [$2]; } 636 | T_STRING_CAST expr { $$ = Expr\Cast\String_ [$2]; }
627 | T_ARRAY_CAST expr { $$ = Expr\Cast\Array_ [$2]; } 637 | T_ARRAY_CAST expr { $$ = Expr\Cast\Array_ [$2]; }
628 | T_OBJECT_CAST expr { $$ = Expr\Cast\Object_ [$2]; } 638 | T_OBJECT_CAST expr { $$ = Expr\Cast\Object_ [$2]; }
629 | T_BOOL_CAST expr { $$ = Expr\Cast\Bool_ [$2]; } 639 | T_BOOL_CAST expr { $$ = Expr\Cast\Bool_ [$2]; }
630 | T_UNSET_CAST expr { $$ = Expr\Cast\Unset_ [$2]; } 640 | T_UNSET_CAST expr { $$ = Expr\Cast\Unset_ [$2]; }
783 | T_TRAIT_C { $$ = Scalar\MagicConst\Trait_[]; } 793 | T_TRAIT_C { $$ = Scalar\MagicConst\Trait_[]; }
784 | T_METHOD_C { $$ = Scalar\MagicConst\Method[]; } 794 | T_METHOD_C { $$ = Scalar\MagicConst\Method[]; }
785 | T_FUNC_C { $$ = Scalar\MagicConst\Function_[]; } 795 | T_FUNC_C { $$ = Scalar\MagicConst\Function_[]; }
786 | T_NS_C { $$ = Scalar\MagicConst\Namespace_[]; } 796 | T_NS_C { $$ = Scalar\MagicConst\Namespace_[]; }
787 | T_START_HEREDOC T_ENCAPSED_AND_WHITESPACE T_END_HEREDOC 797 | T_START_HEREDOC T_ENCAPSED_AND_WHITESPACE T_END_HEREDOC
788 { $attrs = attributes(); setDocStringAttrs($attrs, $1); 798 { $$ = $this->parseDocString($1, $2, $3, attributes(), stackAttributes(#3), false); }
789 $$ = new Scalar\String_(Scalar\String_::parseDocString($1, $2, false), $attrs); }
790 | T_START_HEREDOC T_END_HEREDOC 799 | T_START_HEREDOC T_END_HEREDOC
791 { $attrs = attributes(); setDocStringAttrs($attrs, $1); 800 { $$ = $this->parseDocString($1, '', $2, attributes(), stackAttributes(#2), false); }
792 $$ = new Scalar\String_('', $attrs); }
793 ; 801 ;
794 802
795 static_scalar: 803 static_scalar:
796 common_scalar { $$ = $1; } 804 common_scalar { $$ = $1; }
797 | class_name T_PAAMAYIM_NEKUDOTAYIM identifier_ex { $$ = Expr\ClassConstFetch[$1, $3]; } 805 | class_name T_PAAMAYIM_NEKUDOTAYIM identifier_ex { $$ = Expr\ClassConstFetch[$1, $3]; }
848 | constant { $$ = $1; } 856 | constant { $$ = $1; }
849 | '"' encaps_list '"' 857 | '"' encaps_list '"'
850 { $attrs = attributes(); $attrs['kind'] = Scalar\String_::KIND_DOUBLE_QUOTED; 858 { $attrs = attributes(); $attrs['kind'] = Scalar\String_::KIND_DOUBLE_QUOTED;
851 parseEncapsed($2, '"', true); $$ = new Scalar\Encapsed($2, $attrs); } 859 parseEncapsed($2, '"', true); $$ = new Scalar\Encapsed($2, $attrs); }
852 | T_START_HEREDOC encaps_list T_END_HEREDOC 860 | T_START_HEREDOC encaps_list T_END_HEREDOC
853 { $attrs = attributes(); setDocStringAttrs($attrs, $1); 861 { $$ = $this->parseDocString($1, $2, $3, attributes(), stackAttributes(#3), true); }
854 parseEncapsedDoc($2, true); $$ = new Scalar\Encapsed($2, $attrs); }
855 ; 862 ;
856 863
857 static_array_pair_list: 864 static_array_pair_list:
858 /* empty */ { $$ = array(); } 865 /* empty */ { $$ = array(); }
859 | non_empty_static_array_pair_list optional_comma { $$ = $1; } 866 | non_empty_static_array_pair_list optional_comma { $$ = $1; }