;;; phps.wy --- Semantic LALR grammar for PHP -*- lexical-binding: t -*- ;; Copyright (C) 2018-2020 Free Software Foundation, Inc. ;; This file is not part of GNU Emacs. ;; This program is free software; you can redistribute it and/or ;; modify it under the terms of the GNU General Public License as ;; published by the Free Software Foundation; either version 2, or (at ;; your option) any later version. ;; This program is distributed in the hope that it will be useful, but ;; WITHOUT ANY WARRANTY; without even the implied warranty of ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ;; General Public License for more details. ;; You should have received a copy of the GNU General Public License ;; along with GNU Emacs. If not, see . ;;; Commentary: ;; Run `(wisent-make-parsers)' or "C-c C-c" to generate grammar-file in Emacs Lisp. ;; ;; To debug (setq wisent-verbose-flag t) and check buffer *wisent-log* ;; ;; Based on the Zend PHP Parser YACC https://github.com/php/php-src/blob/master/Zend/zend_language_parser.y ;; Create macros for all macros uses in original YACC, base macro structure on semantic-php-wy-macro.el ;; Don't edit phps.wy because it's generated by phps-automation.el and phps-automation-header.wy ;; Check semantic/wisent/grammar.el for macro definitions ;;; Code: %package phps-mode %provide phps-mode-wy %languagemode phps-mode %{ (setq max-specpdl-size 160000) } %use-macros phps-mode-parser-grammar-macro { ZEND_AST_CREATE ZEND_AST_CREATE_ASSIGN_OP ZEND_AST_CREATE_BINARY_OP ZEND_AST_CREATE_CAST ZEND_AST_CREATE_CLASS_CONST_OR_NAME ZEND_AST_CREATE_EX ZEND_AST_CREATE_LIST ZEND_AST_CREATE_ZVAL ZEND_AST_CREATE_ZVAL_EX ZEND_AST_LIST_ADD ZEND_AST_LIST_RTRIM ZEND_LEX_TSTRING ZEND_NEGATE_NUM_STRING ZVAL_INTERNED_STR } %precedence T_THROW %precedence PREC_ARROW_FUNCTION %precedence T_INCLUDE T_INCLUDE_ONCE T_REQUIRE T_REQUIRE_ONCE %left T_LOGICAL_OR %left T_LOGICAL_XOR %left T_LOGICAL_AND %precedence T_PRINT %precedence T_YIELD %precedence T_DOUBLE_ARROW %precedence T_YIELD_FROM %precedence '=' T_PLUS_EQUAL T_MINUS_EQUAL T_MUL_EQUAL T_DIV_EQUAL T_CONCAT_EQUAL T_MOD_EQUAL T_AND_EQUAL T_OR_EQUAL T_XOR_EQUAL T_SL_EQUAL T_SR_EQUAL T_POW_EQUAL T_COALESCE_EQUAL %left '?' ':' %right T_COALESCE %left T_BOOLEAN_OR %left T_BOOLEAN_AND %left '|' %left '^' %left '&' %nonassoc T_IS_EQUAL T_IS_NOT_EQUAL T_IS_IDENTICAL T_IS_NOT_IDENTICAL T_SPACESHIP %nonassoc '<' T_IS_SMALLER_OR_EQUAL '>' T_IS_GREATER_OR_EQUAL %left '.' %left T_SL T_SR %left '+' '-' %left '*' '/' '%' %precedence '!' %precedence T_INSTANCEOF %precedence '~' T_INT_CAST T_DOUBLE_CAST T_STRING_CAST T_ARRAY_CAST T_OBJECT_CAST T_BOOL_CAST T_UNSET_CAST '@' %right T_POW %precedence T_CLONE ;; Resolve danging else conflict %precedence T_NOELSE %precedence T_ELSEIF %precedence T_ELSE %token T_LNUMBER "integer number (T_LNUMBER)" %token T_DNUMBER "floating-point number (T_DNUMBER)" %token T_STRING "identifier (T_STRING)" %token T_VARIABLE "variable (T_VARIABLE)" %token T_INLINE_HTML %token T_ENCAPSED_AND_WHITESPACE "quoted-string and whitespace (T_ENCAPSED_AND_WHITESPACE)" %token T_CONSTANT_ENCAPSED_STRING "quoted-string (T_CONSTANT_ENCAPSED_STRING)" %token T_STRING_VARNAME "variable name (T_STRING_VARNAME)" %token T_NUM_STRING "number (T_NUM_STRING)" %type %token ADDITION "+" %token ASSIGN "=" %token AT "@" %token BACKTICK "`" %token BITWISE_AND "&" %token BITWISE_OR "|" %token CLOSE_CURLY_BRACKET "]" %token CLOSE_PARENTHESIS ")" %token CLOSE_SQUARE_BRACKET "]" %token COLON ":" %token COMMA "," %token DOLLAR_SIGN "$" %token DOUBLE_QUOTE "\"" %token DIVISION "/" %token DOT "." %token GREATER_THAN ">" %token LESSER_THAN "<" %token MODULO "%" %token MULTIPLICATION "*" %token NEGATION "!" %token OPEN_CURLY_BRACKET "{" %token OPEN_PARENTHESIS "(" %token OPEN_SQUARE_BRACKET "[" %token POW "^" %token QUESTION_MARK "?" %token SINGLE_QUOTE "'" %token SUBTRACTION "-" %token UNARY "~" %token END 0 "end of file" %token T_INCLUDE "include (T_INCLUDE)" %token T_INCLUDE_ONCE "include_once (T_INCLUDE_ONCE)" %token T_EVAL "eval (T_EVAL)" %token T_REQUIRE "require (T_REQUIRE)" %token T_REQUIRE_ONCE "require_once (T_REQUIRE_ONCE)" %token T_LOGICAL_OR "or (T_LOGICAL_OR)" %token T_LOGICAL_XOR "xor (T_LOGICAL_XOR)" %token T_LOGICAL_AND "and (T_LOGICAL_AND)" %token T_PRINT "print (T_PRINT)" %token T_YIELD "yield (T_YIELD)" %token T_YIELD_FROM "yield from (T_YIELD_FROM)" %token T_PLUS_EQUAL "+= (T_PLUS_EQUAL)" %token T_MINUS_EQUAL "-= (T_MINUS_EQUAL)" %token T_MUL_EQUAL "*= (T_MUL_EQUAL)" %token T_DIV_EQUAL "/= (T_DIV_EQUAL)" %token T_CONCAT_EQUAL ".= (T_CONCAT_EQUAL)" %token T_MOD_EQUAL "%= (T_MOD_EQUAL)" %token T_AND_EQUAL "&= (T_AND_EQUAL)" %token T_OR_EQUAL "|= (T_OR_EQUAL)" %token T_XOR_EQUAL "^= (T_XOR_EQUAL)" %token T_SL_EQUAL "<<= (T_SL_EQUAL)" %token T_SR_EQUAL ">>= (T_SR_EQUAL)" %token T_COALESCE_EQUAL "??= (T_COALESCE_EQUAL)" %token T_BOOLEAN_OR "|| (T_BOOLEAN_OR)" %token T_BOOLEAN_AND "&& (T_BOOLEAN_AND)" %token T_IS_EQUAL "== (T_IS_EQUAL)" %token T_IS_NOT_EQUAL "!= (T_IS_NOT_EQUAL)" %token T_IS_IDENTICAL "=== (T_IS_IDENTICAL)" %token T_IS_NOT_IDENTICAL "!== (T_IS_NOT_IDENTICAL)" %token T_IS_SMALLER_OR_EQUAL "<= (T_IS_SMALLER_OR_EQUAL)" %token T_IS_GREATER_OR_EQUAL ">= (T_IS_GREATER_OR_EQUAL)" %token T_SPACESHIP "<=> (T_SPACESHIP)" %token T_SL "<< (T_SL)" %token T_SR ">> (T_SR)" %token T_INSTANCEOF "instanceof (T_INSTANCEOF)" %token T_INC "++ (T_INC)" %token T_DEC "-- (T_DEC)" %token T_INT_CAST "(int) (T_INT_CAST)" %token T_DOUBLE_CAST "(double) (T_DOUBLE_CAST)" %token T_STRING_CAST "(string) (T_STRING_CAST)" %token T_ARRAY_CAST "(array) (T_ARRAY_CAST)" %token T_OBJECT_CAST "(object) (T_OBJECT_CAST)" %token T_BOOL_CAST "(bool) (T_BOOL_CAST)" %token T_UNSET_CAST "(unset) (T_UNSET_CAST)" %token T_NEW "new (T_NEW)" %token T_CLONE "clone (T_CLONE)" %token T_EXIT "exit (T_EXIT)" %token T_IF "if (T_IF)" %token T_ELSEIF "elseif (T_ELSEIF)" %token T_ELSE "else (T_ELSE)" %token T_ENDIF "endif (T_ENDIF)" %token T_ECHO "echo (T_ECHO)" %token T_DO "do (T_DO)" %token T_WHILE "while (T_WHILE)" %token T_ENDWHILE "endwhile (T_ENDWHILE)" %token T_FOR "for (T_FOR)" %token T_ENDFOR "endfor (T_ENDFOR)" %token T_FOREACH "foreach (T_FOREACH)" %token T_ENDFOREACH "endforeach (T_ENDFOREACH)" %token T_DECLARE "declare (T_DECLARE)" %token T_ENDDECLARE "enddeclare (T_ENDDECLARE)" %token T_AS "as (T_AS)" %token T_SWITCH "switch (T_SWITCH)" %token T_ENDSWITCH "endswitch (T_ENDSWITCH)" %token T_CASE "case (T_CASE)" %token T_DEFAULT "default (T_DEFAULT)" %token T_BREAK "break (T_BREAK)" %token T_CONTINUE "continue (T_CONTINUE)" %token T_GOTO "goto (T_GOTO)" %token T_FUNCTION "function (T_FUNCTION)" %token T_FN "fn (T_FN)" %token T_CONST "const (T_CONST)" %token T_RETURN "return (T_RETURN)" %token T_TRY "try (T_TRY)" %token T_CATCH "catch (T_CATCH)" %token T_FINALLY "finally (T_FINALLY)" %token T_THROW "throw (T_THROW)" %token T_USE "use (T_USE)" %token T_INSTEADOF "insteadof (T_INSTEADOF)" %token T_GLOBAL "global (T_GLOBAL)" %token T_STATIC "static (T_STATIC)" %token T_ABSTRACT "abstract (T_ABSTRACT)" %token T_FINAL "final (T_FINAL)" %token T_PRIVATE "private (T_PRIVATE)" %token T_PROTECTED "protected (T_PROTECTED)" %token T_PUBLIC "public (T_PUBLIC)" %token T_VAR "var (T_VAR)" %token T_UNSET "unset (T_UNSET)" %token T_ISSET "isset (T_ISSET)" %token T_EMPTY "empty (T_EMPTY)" %token T_HALT_COMPILER "__halt_compiler (T_HALT_COMPILER)" %token T_CLASS "class (T_CLASS)" %token T_TRAIT "trait (T_TRAIT)" %token T_INTERFACE "interface (T_INTERFACE)" %token T_EXTENDS "extends (T_EXTENDS)" %token T_IMPLEMENTS "implements (T_IMPLEMENTS)" %token T_OBJECT_OPERATOR "-> (T_OBJECT_OPERATOR)" %token T_DOUBLE_ARROW "=> (T_DOUBLE_ARROW)" %token T_LIST "list (T_LIST)" %token T_ARRAY "array (T_ARRAY)" %token T_CALLABLE "callable (T_CALLABLE)" %token T_LINE "__LINE__ (T_LINE)" %token T_FILE "__FILE__ (T_FILE)" %token T_DIR "__DIR__ (T_DIR)" %token T_CLASS_C "__CLASS__ (T_CLASS_C)" %token T_TRAIT_C "__TRAIT__ (T_TRAIT_C)" %token T_METHOD_C "__METHOD__ (T_METHOD_C)" %token T_FUNC_C "__FUNCTION__ (T_FUNC_C)" %token T_COMMENT "comment (T_COMMENT)" %token T_DOC_COMMENT "doc comment (T_DOC_COMMENT)" %token T_OPEN_TAG "open tag (T_OPEN_TAG)" %token T_OPEN_TAG_WITH_ECHO "open tag with echo (T_OPEN_TAG_WITH_ECHO)" %token T_CLOSE_TAG "close tag (T_CLOSE_TAG)" %token T_WHITESPACE "whitespace (T_WHITESPACE)" %token T_START_HEREDOC "heredoc start (T_START_HEREDOC)" %token T_END_HEREDOC "heredoc end (T_END_HEREDOC)" %token T_DOLLAR_OPEN_CURLY_BRACES "${ (T_DOLLAR_OPEN_CURLY_BRACES)" %token T_CURLY_OPEN "{$ (T_CURLY_OPEN)" %token T_PAAMAYIM_NEKUDOTAYIM ":: (T_PAAMAYIM_NEKUDOTAYIM)" %token T_NAMESPACE "namespace (T_NAMESPACE)" %token T_NS_C "__NAMESPACE__ (T_NS_C)" %token T_NS_SEPARATOR "\\ (T_NS_SEPARATOR)" %token T_ELLIPSIS "... (T_ELLIPSIS)" %token T_COALESCE "?? (T_COALESCE)" %token T_POW "** (T_POW)" %token T_POW_EQUAL "**= (T_POW_EQUAL)" %token T_BAD_CHARACTER "invalid character (T_BAD_CHARACTER)" ;; Token used to force a parse error from the lexer %token T_ERROR %type top_statement namespace_name name statement function_declaration_statement %type class_declaration_statement trait_declaration_statement %type interface_declaration_statement interface_extends_list %type group_use_declaration inline_use_declarations inline_use_declaration %type mixed_group_use_declaration use_declaration unprefixed_use_declaration %type unprefixed_use_declarations const_decl inner_statement %type expr optional_expr while_statement for_statement foreach_variable %type foreach_statement declare_statement finally_statement unset_variable variable %type extends_from parameter optional_type_without_static argument global_var %type static_var class_statement trait_adaptation trait_precedence trait_alias %type absolute_trait_method_reference trait_method_reference property echo_expr %type new_expr anonymous_class class_name class_name_reference simple_variable %type internal_functions_in_yacc %type exit_expr scalar backticks_expr lexical_var function_call member_name property_name %type variable_class_name dereferencable_scalar constant class_constant %type fully_dereferencable array_object_dereferencable %type callable_expr callable_variable static_member new_variable %type encaps_var encaps_var_offset isset_variables %type top_statement_list use_declarations const_list inner_statement_list if_stmt %type alt_if_stmt for_exprs switch_case_list global_var_list static_var_list %type echo_expr_list unset_variables catch_name_list catch_list optional_variable parameter_list class_statement_list %type implements_list case_list if_stmt_without_else %type non_empty_parameter_list argument_list non_empty_argument_list property_list %type class_const_list class_const_decl class_name_list trait_adaptations method_body non_empty_for_exprs %type ctor_arguments alt_if_stmt_without_else trait_adaptation_list lexical_vars %type lexical_var_list encaps_list %type array_pair non_empty_array_pair_list array_pair_list possible_array_pair %type isset_variable type return_type type_expr type_without_static %type identifier type_expr_without_static union_type_without_static %type inline_function union_type %type returns_ref function fn is_reference is_variadic variable_modifiers %type method_modifiers non_empty_member_modifiers member_modifier %type class_modifiers class_modifier use_type backup_fn_flags %type backup_lex_pos %type backup_doc_comment %start isset_variable %% reserved_non_modifiers: T_INCLUDE | T_INCLUDE_ONCE | T_EVAL | T_REQUIRE | T_REQUIRE_ONCE | T_LOGICAL_OR | T_LOGICAL_XOR | T_LOGICAL_AND | T_INSTANCEOF | T_NEW | T_CLONE | T_EXIT | T_IF | T_ELSEIF | T_ELSE | T_ENDIF | T_ECHO | T_DO | T_WHILE | T_ENDWHILE | T_FOR | T_ENDFOR | T_FOREACH | T_ENDFOREACH | T_DECLARE | T_ENDDECLARE | T_AS | T_TRY | T_CATCH | T_FINALLY | T_THROW | T_USE | T_INSTEADOF | T_GLOBAL | T_VAR | T_UNSET | T_ISSET | T_EMPTY | T_CONTINUE | T_GOTO | T_FUNCTION | T_CONST | T_RETURN | T_PRINT | T_YIELD | T_LIST | T_SWITCH | T_ENDSWITCH | T_CASE | T_DEFAULT | T_BREAK | T_ARRAY | T_CALLABLE | T_EXTENDS | T_IMPLEMENTS | T_NAMESPACE | T_TRAIT | T_INTERFACE | T_CLASS | T_CLASS_C | T_TRAIT_C | T_FUNC_C | T_METHOD_C | T_LINE | T_FILE | T_DIR | T_NS_C | T_FN ; semi_reserved: reserved_non_modifiers | T_STATIC | T_ABSTRACT | T_FINAL | T_PRIVATE | T_PROTECTED | T_PUBLIC ; identifier: T_STRING ($1) | semi_reserved (let ((zv nil))(ZEND_LEX_TSTRING (lambda(ret) (setq zv ret)))(ZEND_AST_CREATE_ZVAL zv)) ; namespace_name: T_STRING ($1) | namespace_name T_NS_SEPARATOR T_STRING (ZEND_AST_APPEND_STR $1 $3) ; name: namespace_name (progn (semantic-tag-put-attribute $1 'attr 'phps-mode-parser--zend_name_not_fq) $1) | T_NAMESPACE T_NS_SEPARATOR namespace_name (progn (semantic-tag-put-attribute $3 'attr 'phps-mode-parser--zend_name_relative) $3) | T_NS_SEPARATOR namespace_name (progn (semantic-tag-put-attribute $2 'attr 'phps-mode-parser--zend_name_fq) $2) ; class_name: T_STATIC (let ((zv nil))(ZVAL_INTERNED_STR (lambda(return) (setq zv return)) (ZSTR_KNOWN 'phps-mode-parser--zend_str_static))(ZEND_AST_CREATE_ZVAL_EX zv 'phps-mode-parser--zend_name_not_fq)) | name ($1) ; constant: name (ZEND_AST_CREATE 'phps-mode-parser--zend_ast_const $1) | T_LINE (ZEND_AST_CREATE_EX 'phps-mode-parser--zend_ast_magic_const 'phps-mode-parser--t_line) | T_FILE (ZEND_AST_CREATE_EX 'phps-mode-parser--zend_ast_magic_const 'phps-mode-parser--t_file) | T_DIR (ZEND_AST_CREATE_EX 'phps-mode-parser--zend_ast_magic_const 'phps-mode-parser--t_dir) | T_TRAIT_C (ZEND_AST_CREATE_EX 'phps-mode-parser--zend_ast_magic_const 'phps-mode-parser--t_trait_c) | T_METHOD_C (ZEND_AST_CREATE_EX 'phps-mode-parser--zend_ast_magic_const 'phps-mode-parser--t_method_c) | T_FUNC_C (ZEND_AST_CREATE_EX 'phps-mode-parser--zend_ast_magic_const 'phps-mode-parser--t_func_c) | T_NS_C (ZEND_AST_CREATE_EX 'phps-mode-parser--zend_ast_magic_const 'phps-mode-parser--t_ns_c) | T_CLASS_C (ZEND_AST_CREATE_EX 'phps-mode-parser--zend_ast_magic_const 'phps-mode-parser--t_class_c) ; class_constant: class_name T_PAAMAYIM_NEKUDOTAYIM identifier (ZEND_AST_CREATE_CLASS_CONST_OR_NAME $1 $3) | variable_class_name T_PAAMAYIM_NEKUDOTAYIM identifier (ZEND_AST_CREATE_CLASS_CONST_OR_NAME $1 $3) ; property_name: T_STRING ($1) | OPEN_CURLY_BRACKET expr CLOSE_CURLY_BRACKET ($2) | simple_variable (ZEND_AST_CREATE 'phps-mode-parser--zend_ast_var $1) ; argument_list: OPEN_PARENTHESIS CLOSE_PARENTHESIS (ZEND_AST_CREATE_LIST 0 'phps-mode-parser--zend_ast_arg_list) | OPEN_PARENTHESIS non_empty_argument_list possible_comma CLOSE_PARENTHESIS ($2) ; possible_comma: ;; empty | COMMA ; non_empty_argument_list: argument (ZEND_AST_CREATE_LIST 1 'phps-mode-parser--zend_ast_arg_list $1) | non_empty_argument_list COMMA argument (ZEND_AST_LIST_ADD $1 $3) ; argument: expr ($1) | T_ELLIPSIS expr (ZEND_AST_CREATE 'phps-mode-parser--zend_ast_unpack $2) ; function_call: name argument_list (ZEND_AST_CREATE 'phps-mode-parser--zend_ast_call $1 $2) | class_name T_PAAMAYIM_NEKUDOTAYIM member_name argument_list (ZEND_AST_CREATE 'phps-mode-parser--zend_ast_static_call $1 $3 $4) | variable_class_name T_PAAMAYIM_NEKUDOTAYIM member_name argument_list (ZEND_AST_CREATE 'phps-mode-parser--zend_ast_static_call $1 $3 $4) | callable_expr argument_list (ZEND_AST_CREATE 'phps-mode-parser--zend_ast_call $1 $2) ; member_name: identifier ($1) | OPEN_CURLY_BRACKET expr CLOSE_CURLY_BRACKET ($2) | simple_variable (ZEND_AST_CREATE 'phps-mode-parser--zend_ast_var $1) ; array_pair_list: non_empty_array_pair_list (ZEND_AST_LIST_RTRIM $1) ; possible_array_pair: (nil) | array_pair ($1) ; non_empty_array_pair_list: non_empty_array_pair_list COMMA possible_array_pair (ZEND_AST_LIST_ADD $1 $3) | possible_array_pair (ZEND_AST_CREATE_LIST 1 'phps-mode-parser--zend_ast_array $1) ; array_pair: expr T_DOUBLE_ARROW expr (ZEND_AST_CREATE 'phps-mode-parser--zend_ast_array_elem $3 $1) | expr (ZEND_AST_CREATE 'phps-mode-parser--zend_ast_array_elem $1 nil) | expr T_DOUBLE_ARROW BITWISE_AND variable (ZEND_AST_CREATE_EX 'phps-mode-parser--zend_ast_array_elem 1 $4 $1) | BITWISE_AND variable (ZEND_AST_CREATE_EX 'phps-mode-parser--zend_ast_array_elem 1 $2 nil) | T_ELLIPSIS expr (ZEND_AST_CREATE 'phps-mode-parser--zend_ast_unpack $2) | expr T_DOUBLE_ARROW T_LIST OPEN_PARENTHESIS array_pair_list CLOSE_PARENTHESIS (progn (semantic-tag-put-attribute $4 'attr 'phps-mode-parser--zend_array_syntax_list)(ZEND_AST_CREATE 'phps-mode-parser--zend_ast_array_elem $5 $1)) | T_LIST OPEN_PARENTHESIS array_pair_list CLOSE_PARENTHESIS (progn (semantic-tag-put-attribute $3 'attr 'phps-mode-parser--zend_array_syntax_list)(ZEND_AST_CREATE 'phps-mode-parser--zend_ast_array_elem $3 nil)) ; encaps_list: encaps_list encaps_var (ZEND_AST_LIST_ADD $1 $2) | encaps_list T_ENCAPSED_AND_WHITESPACE (ZEND_AST_LIST_ADD $1 $2) | encaps_var (ZEND_AST_CREATE_LIST 1 'phps-mode-parser--zend_ast_encaps_list $1) | T_ENCAPSED_AND_WHITESPACE encaps_var (ZEND_AST_CREATE_LIST 2 'phps-mode-parser--zend_ast_encaps_list $1 $2) ; encaps_var: T_VARIABLE (ZEND_AST_CREATE 'phps-mode-parser--zend_ast_var $1) | T_VARIABLE OPEN_SQUARE_BRACKET encaps_var_offset CLOSE_SQUARE_BRACKET (ZEND_AST_CREATE 'phps-mode-parser--zend_ast_dim (ZEND_AST_CREATE 'phps-mode-parser--zend_ast_var $1) $3) | T_VARIABLE T_OBJECT_OPERATOR T_STRING (ZEND_AST_CREATE 'phps-mode-parser--zend_ast_prop (ZEND_AST_CREATE 'phps-mode-parser--zend_ast_var $1) $3) | T_DOLLAR_OPEN_CURLY_BRACES expr CLOSE_CURLY_BRACKET (ZEND_AST_CREATE 'phps-mode-parser--zend_ast_var $2) | T_DOLLAR_OPEN_CURLY_BRACES T_STRING_VARNAME CLOSE_CURLY_BRACKET (ZEND_AST_CREATE 'phps-mode-parser--zend_ast_var $2) | T_DOLLAR_OPEN_CURLY_BRACES T_STRING_VARNAME OPEN_SQUARE_BRACKET expr CLOSE_SQUARE_BRACKET CLOSE_CURLY_BRACKET (ZEND_AST_CREATE 'phps-mode-parser--zend_ast_dim (ZEND_AST_CREATE 'phps-mode-parser--zend_ast_var $2) $4) | T_CURLY_OPEN variable CLOSE_CURLY_BRACKET ($2) ; encaps_var_offset: T_STRING ($1) | T_NUM_STRING ($1) | '-' T_NUM_STRING (ZEND_NEGATE_NUM_STRING $2) | T_VARIABLE (ZEND_AST_CREATE 'phps-mode-parser--zend_ast_var $1) ; dereferencable_scalar: T_ARRAY OPEN_PARENTHESIS array_pair_list CLOSE_PARENTHESIS (progn (semantic-tag-put-attribute $3 'attr 'phps-mode-parser--zend_array_syntax_long) $3) | OPEN_SQUARE_BRACKET array_pair_list CLOSE_SQUARE_BRACKET (progn (semantic-tag-put-attribute $2 'attr 'phps-mode-parser--zend_array_syntax_short) $2) | T_CONSTANT_ENCAPSED_STRING ($1) | DOUBLE_QUOTE encaps_list DOUBLE_QUOTE ($2) ; optional_expr: (nil) | expr ($1) ; variable_class_name: fully_dereferencable ($1) ; fully_dereferencable: variable ($1) | OPEN_PARENTHESIS expr CLOSE_PARENTHESIS ($2) | dereferencable_scalar ($1) | class_constant ($1) ; array_object_dereferencable: fully_dereferencable ($1) | constant ($1) ; callable_expr: callable_variable ($1) | OPEN_PARENTHESIS expr CLOSE_PARENTHESIS ($2) | dereferencable_scalar ($1) ; callable_variable: simple_variable (ZEND_AST_CREATE 'phps-mode-parser--zend_ast_var $1) | array_object_dereferencable OPEN_SQUARE_BRACKET optional_expr CLOSE_SQUARE_BRACKET (ZEND_AST_CREATE 'phps-mode-parser--zend_ast_dim $1 $3) | array_object_dereferencable OPEN_CURLY_BRACKET expr CLOSE_CURLY_BRACKET (ZEND_AST_CREATE_EX 'phps-mode-parser--zend_ast_dim 'phps-mode-parser--zend_dim_alternative_syntax $1 $3) | array_object_dereferencable T_OBJECT_OPERATOR property_name argument_list (ZEND_AST_CREATE 'phps-mode-parser--zend_ast_method_call $1 $3 $4) | function_call ($1) ; variable: callable_variable ($1) | static_member ($1) | array_object_dereferencable T_OBJECT_OPERATOR property_name (ZEND_AST_CREATE 'phps-mode-parser--zend_ast_prop $1 $2) ; simple_variable: T_VARIABLE ($1) | DOLLAR_SIGN OPEN_CURLY_BRACKET expr CLOSE_CURLY_BRACKET ($3) | DOLLAR_SIGN simple_variable (ZEND_AST_CREATE 'phps-mode-parser--zend_ast_var $2) ; static_member: class_name T_PAAMAYIM_NEKUDOTAYIM simple_variable (ZEND_AST_CREATE 'phps-mode-parser--zend_ast_static_prop $1 $3) | variable_class_name T_PAAMAYIM_NEKUDOTAYIM simple_variable (ZEND_AST_CREATE 'phps-mode-parser--zend_ast_static_prop $1 $3) ; expr: variable ($1) | T_LIST OPEN_PARENTHESIS array_pair_list CLOSE_PARENTHESIS ASSIGN expr (progn (semantic-tag-put-attribute $3 'attr phps-mode-parser--zend_array_syntax_list)(ZEND_AST_CREATE 'phps-mode-parser--zend_ast_assign $3 $6) | OPEN_SQUARE_BRACKET array_pair_list CLOSE_SQUARE_BRACKET ASSIGN expr (progn (semantic-tag-put-attribute $2 'attr 'phps-mode-parser--zend_array_syntax_short)(ZEND_AST_CREATE 'phps-mode-parser--zend_ast_assign $2 $5)) | variable ASSIGN expr (ZEND_AST_CREATE 'phps-mode-parser--zend_ast_assign $1 $3) | variable ASSIGN BITWISE_AND variable (ZEND_AST_CREATE 'phps-mode-parser--zend_ast_assign_ref $1 $4) | T_CLONE expr (ZEND_AST_CREATE 'phps-mode-parser--zend_ast_clone $2) | variable T_PLUS_EQUAL expr (ZEND_AST_CREATE_ASSIGN_OP 'phps-mode-parser--zend_add $1 $3) | variable T_MINUS_EQUAL expr (ZEND_AST_CREATE_ASSIGN_OP 'phps-mode-parser--zend_sub $1 $3) | variable T_MUL_EQUAL expr (ZEND_AST_CREATE_ASSIGN_OP 'phps-mode-parser--zend_mul $1 $3) | variable T_POW_EQUAL expr (ZEND_AST_CREATE_ASSIGN_OP 'phps-mode-parser--zend_pow $1 $3) | variable T_DIV_EQUAL expr (ZEND_AST_CREATE_ASSIGN_OP 'phps-mode-parser--zend_div $1 $3) | variable T_CONCAT_EQUAL expr (ZEND_AST_CREATE_ASSIGN_OP 'phps-mode-parser--zend_concat $1 $3) | variable T_MOD_EQUAL expr (ZEND_AST_CREATE_ASSIGN_OP 'phps-mode-parser--zend_mod $1 $3) | variable T_AND_EQUAL expr (ZEND_AST_CREATE_ASSIGN_OP 'phps-mode-parser--zend_bw_and $1 $3) | variable T_OR_EQUAL expr (ZEND_AST_CREATE_ASSIGN_OP 'phps-mode-parser--zend_bw_or $1 $3) | variable T_XOR_EQUAL expr (ZEND_AST_CREATE_ASSIGN_OP 'phps-mode-parser--zend_bw_xor $1 $3) | variable T_SL_EQUAL expr (ZEND_AST_CREATE_ASSIGN_OP 'phps-mode-parser--zend_sl $1 $3) | variable T_SR_EQUAL expr (ZEND_AST_CREATE_ASSIGN_OP 'phps-mode-parser--zend_sr $1 $3) | variable T_COALESCE_EQUAL expr (ZEND_AST_CREATE 'phps-mode-parser--zend_coalesce $1 $3) | variable T_INC (ZEND_AST_CREATE 'phps-mode-parser--zend_post_inc $1) | T_INC variable (ZEND_AST_CREATE 'phps-mode-parser--zend_pre_inc $2) | variable T_DEC (ZEND_AST_CREATE 'phps-mode-parser--zend_post_dec $1) | T_DEC variable (ZEND_AST_CREATE 'phps-mode-parser--zend_pre_inc $2) | expr T_BOOLEAN_OR expr (ZEND_AST_CREATE 'phps-mode-parser--zend_ast_or $1 $3) | expr T_BOOLEAN_AND expr (ZEND_AST_CREATE 'phps-mode-parser--zend_ast_and $1 $3) | expr T_LOGICAL_OR expr (ZEND_AST_CREATE 'phps-mode-parser--zend_ast_or $1 $3) | expr T_LOGICAL_AND expr (ZEND_AST_CREATE 'phps-mode-parser--zend_ast_and $1 $3) | expr T_LOGICAL_XOR expr (ZEND_AST_CREATE_BINARY_OP 'phps-mode-parser--zend_bool_xor $1 $3) | expr BITWISE_OR expr (ZEND_AST_CREATE_BINARY_OP 'phps-mode-parser--zend_bw_or $1 $3) | expr BITWISE_AND expr (ZEND_AST_CREATE_BINARY_OP 'phps-mode-parser--zend_bw_and $1 $3) | expr POW expr (ZEND_AST_CREATE_BINARY_OP 'phps-mode-parser--zend_bw_xor $1 $3) | expr DOT expr (ZEND_AST_CREATE_BINARY_OP 'phps-mode-parser--zend_concat $1 $3) | expr ADDITION expr (ZEND_AST_CREATE_BINARY_OP 'phps-mode-parser--zend_add $1 $3) | expr SUBTRACTION expr (ZEND_AST_CREATE_BINARY_OP 'phps-mode-parser--zend_sub $1 $3) | expr MULTIPLICATION expr (ZEND_AST_CREATE_BINARY_OP 'phps-mode-parser--zend_mul $1 $3) | expr T_POW expr (ZEND_AST_CREATE_BINARY_OP 'phps-mode-parser--zend_pow $1 $3) | expr DIVISION expr (ZEND_AST_CREATE_BINARY_OP 'phps-mode-parser--zend_div $1 $3) | expr MODULO expr (ZEND_AST_CREATE_BINARY_OP 'phps-mode-parser--zend_mod $1 $3) | expr T_SL expr (ZEND_AST_CREATE_BINARY_OP 'phps-mode-parser--zend_sl $1 $3) | expr T_SR expr (ZEND_AST_CREATE_BINARY_OP 'phps-mode-parser--zend_sr $1 $3) | ADDITION expr prec UNARY (ZEND_AST_CREATE 'phps-mode-parser--zend_ast_unary_plus $1 $2) | SUBTRACTION expr prec UNARY (ZEND_AST_CREATE 'phps-mode-parser--zend_ast_unary_minus $1 $2) | NEGATION expr (ZEND_AST_CREATE_EX 'phps-mode-parser--zend_ast_unary_op 'phps-mode-parser--zend_bool_not $2) | UNARY expr (ZEND_AST_CREATE_EX 'phps-mode-parser--zend_ast_unary_op 'phps-mode-parser--zend_bw_not $2) | expr T_IS_IDENTICAL expr (ZEND_AST_CREATE_BINARY_OP 'phps-mode-parser--zend_is_identical $1 $3) | expr T_IS_NOT_IDENTICAL expr (ZEND_AST_CREATE_BINARY_OP 'phps-mode-parser--zend_is_not_identical $1 $3) | expr T_IS_EQUAL expr (ZEND_AST_CREATE_BINARY_OP 'phps-mode-parser--zend_is_equal $1 $3) | expr T_IS_NOT_EQUAL expr (ZEND_AST_CREATE_BINARY_OP 'phps-mode-parser--zend_is_not_equal $1 $3) | expr LESSER_THAN expr (ZEND_AST_CREATE_BINARY_OP 'phps-mode-parser--zend_is_smaller $1 $3) | expr T_IS_SMALLER_OR_EQUAL expr (ZEND_AST_CREATE_BINARY_OP 'phps-mode-parser--zend_is_smaller_or_equal $1 $3) | expr GREATER_THAN expr (ZEND_AST_CREATE_BINARY_OP 'phps-mode-parser--zend_is_greater $1 $3) | expr T_IS_GREATER_OR_EQUAL expr (ZEND_AST_CREATE_BINARY_OP 'phps-mode-parser--zend_is_greater_or_equal $1 $3) | expr T_SPACESHIP expr (ZEND_AST_CREATE_BINARY_OP 'phps-mode-parser--zend_spaceship $1 $3) | expr T_INSTANCEOF class_name_reference (ZEND_AST_CREATE 'phps-mode-parser--zend_instanceof $1 $3) | OPEN_PARENTHESIS expr CLOSE_PARENTHESIS (progn (when (equal (semantic-tag-get-attribute $2 'kind) 'phps-mode-parser--zend_ast_conditional) (semantic-tag-put-attribute $2 'attr 'phps-mode-parser--zend_parenthesized_conditional)) $2) | new_expr ($1) | expr QUESTION_MARK expr COLON expr (ZEND_AST_CREATE 'phps-mode-parser--zend_ast_conditional $1 $3 $5) | expr QUESTION_MARK COLON expr (ZEND_AST_CREATE 'phps-mode-parser--zend_ast_conditional $1 nil $4) | expr T_COALESCE expr (ZEND_AST_CREATE 'phps-mode-parser--zend_ast_coalesce $1 $3) | internal_functions_in_yacc ($1)) | T_INT_CAST expr (ZEND_AST_CREATE_CAST 'phps-mode-parser--is_long $2) | T_DOUBLE_CAST expr (ZEND_AST_CREATE_CAST 'phps-mode-parser--is_double $2) | T_STRING_CAST expr (ZEND_AST_CREATE_CAST 'phps-mode-parser--is_string $2) | T_ARRAY_CAST expr (ZEND_AST_CREATE_CAST 'phps-mode-parser--is_array $2) | T_OBJECT_CAST expr (ZEND_AST_CREATE_CAST 'phps-mode-parser--is_object $2) | T_BOOL_CAST expr (ZEND_AST_CREATE_CAST 'phps-mode-parser--is_bool $2) | T_UNSET_CAST expr (ZEND_AST_CREATE_CAST 'phps-mode-parser--is_unset $2) | T_EXIT exit_expr (ZEND_AST_CREATE 'phps-mode-parser--zend_ast_exit $2) | AT expr (ZEND_AST_CREATE 'phps-mode-parser--zend_ast_silence $2) | scalar ($1) | BACKTICK backticks_expr BACKTICK (ZEND_AST_CREATE 'phps-mode-parser--zend_ast_shell $2) | T_PRINT expr (ZEND_AST_CREATE 'phps-mode-parser--zend_ast_print $2) | T_YIELD (progn (phps-mode-parser-grammar-macro-CG 'phps-mode-parser--extra_fn_flags (logior (phps-mode-parser-grammar-macro-CG 'phps-mode-parser--extra_fn_flags) 'phps-mode-parser--zend_acc_generator))(ZEND_AST_CREATE 'phps-mode-parser--zend_ast_yield nil nil)) | T_YIELD expr (progn (phps-mode-parser-grammar-macro-CG 'phps-mode-parser--extra_fn_flags (logior (phps-mode-parser-grammar-macro-CG 'phps-mode-parser--extra_fn_flags) 'phps-mode-parser--zend_acc_generator))(ZEND_AST_CREATE 'phps-mode-parser--zend_ast_yield $2 nil)) | T_YIELD expr T_DOUBLE_ARROW expr (progn (phps-mode-parser-grammar-macro-CG 'phps-mode-parser--extra_fn_flags (logior (phps-mode-parser-grammar-macro-CG 'phps-mode-parser--extra_fn_flags) 'phps-mode-parser--zend_acc_generator))(ZEND_AST_CREATE 'phps-mode-parser--zend_ast_yield $4 $2)) | T_YIELD_FROM expr (progn (phps-mode-parser-grammar-macro-CG 'phps-mode-parser--extra_fn_flags (logior (phps-mode-parser-grammar-macro-CG 'phps-mode-parser--extra_fn_flags) 'phps-mode-parser--zend_acc_generator))(ZEND_AST_CREATE 'phps-mode-parser--zend_ast_yield_from $2)) | T_THROW expr (ZEND_AST_CREATE 'phps-mode-parser--zend_ast_throw $2) | inline_function ($1) | T_STATIC inline_function (progn (semantic-tag-put-attribute $2 'flags (logior (semantic-tag-get-attribute $2 'flags) 'phps-mode-parser--zend_acc_static)) $2) ; isset_variable: expr (ZEND_AST_CREATE 'phps-mode-parser--zend_ast_isset $1) ; %%