@@ -943,35 +943,39 @@ common_scalar:
943
943
944
944
945
945
static_scalar : /* compile-time evaluated scalars */
946
- common_scalar { $$ = $1 ; }
946
+ static_scalar_value { $$ = $1 ; }
947
947
| static_class_name_scalar { $$ = $1 ; }
948
948
| namespace_name { zend_do_fetch_constant(&$$ , NULL , &$1 , ZEND_CT, 1 TSRMLS_CC); }
949
949
| T_NAMESPACE T_NS_SEPARATOR namespace_name { $$ .op_type = IS_CONST; ZVAL_EMPTY_STRING(&$$ .u.constant); zend_do_build_namespace_name(&$$ , &$$ , &$3 TSRMLS_CC); $3 = $$ ; zend_do_fetch_constant(&$$ , NULL , &$3 , ZEND_CT, 0 TSRMLS_CC); }
950
950
| T_NS_SEPARATOR namespace_name { char *tmp = estrndup(Z_STRVAL($2 .u.constant), Z_STRLEN($2 .u.constant)+1 ); memcpy(&(tmp[1 ]), Z_STRVAL($2 .u.constant), Z_STRLEN($2 .u.constant)+1 ); tmp[0 ] = ' \\ ' ; efree(Z_STRVAL($2 .u.constant)); Z_STRVAL($2 .u.constant) = tmp; ++Z_STRLEN($2 .u.constant); zend_do_fetch_constant(&$$ , NULL , &$2 , ZEND_CT, 0 TSRMLS_CC); }
951
- | ' +' static_scalar { ZVAL_LONG(&$1 .u.constant, 0 ); add_function(&$2 .u.constant, &$1 .u.constant, &$2 .u.constant TSRMLS_CC); $$ = $2 ; }
952
- | ' -' static_scalar { ZVAL_LONG(&$1 .u.constant, 0 ); sub_function(&$2 .u.constant, &$1 .u.constant, &$2 .u.constant TSRMLS_CC); $$ = $2 ; }
953
951
| T_ARRAY ' (' static_array_pair_list ' )' { $$ = $3 ; Z_TYPE($$ .u.constant) = IS_CONSTANT_ARRAY; }
954
952
| ' [' static_array_pair_list ' ]' { $$ = $2 ; Z_TYPE($$ .u.constant) = IS_CONSTANT_ARRAY; }
955
953
| static_class_constant { $$ = $1 ; }
956
954
| T_CLASS_C { $$ = $1 ; }
957
- | ' (' static_scalar ' )' { $$ = $2 ; }
955
+ ;
956
+
957
+ static_scalar_value :
958
+ common_scalar { $$ = $1 ; }
959
+ | ' +' static_scalar_value { ZVAL_LONG(&$1 .u.constant, 0 ); add_function(&$2 .u.constant, &$1 .u.constant, &$2 .u.constant TSRMLS_CC); $$ = $2 ; }
960
+ | ' -' static_scalar_value { ZVAL_LONG(&$1 .u.constant, 0 ); sub_function(&$2 .u.constant, &$1 .u.constant, &$2 .u.constant TSRMLS_CC); $$ = $2 ; }
961
+ | ' (' static_scalar_value ' )' { $$ = $2 ; }
958
962
| static_operation { $$ = $1 ; }
959
963
;
960
964
961
965
static_operation :
962
- static_scalar ' +' static_scalar { add_function(&$1 .u.constant, &$1 .u.constant, &$3 .u.constant TSRMLS_CC); zval_dtor(&$3 .u.constant); $$ = $1 ; }
963
- | static_scalar ' -' static_scalar { sub_function(&$1 .u.constant, &$1 .u.constant, &$3 .u.constant TSRMLS_CC); zval_dtor(&$3 .u.constant); $$ = $1 ; }
964
- | static_scalar ' *' static_scalar { mul_function(&$1 .u.constant, &$1 .u.constant, &$3 .u.constant TSRMLS_CC); zval_dtor(&$3 .u.constant); $$ = $1 ; }
965
- | static_scalar ' /' static_scalar { div_function(&$1 .u.constant, &$1 .u.constant, &$3 .u.constant TSRMLS_CC); zval_dtor(&$3 .u.constant); $$ = $1 ; }
966
- | static_scalar ' %' static_scalar { mod_function(&$1 .u.constant, &$1 .u.constant, &$3 .u.constant TSRMLS_CC); zval_dtor(&$3 .u.constant); $$ = $1 ; }
967
- | ' !' static_scalar { boolean_not_function(&$2 .u.constant, &$2 .u.constant TSRMLS_CC); $$ = $2 ; }
968
- | ' ~' static_scalar { bitwise_not_function(&$2 .u.constant, &$2 .u.constant TSRMLS_CC); $$ = $2 ; }
969
- | static_scalar ' |' static_scalar { bitwise_or_function(&$1 .u.constant, &$1 .u.constant, &$3 .u.constant TSRMLS_CC); zval_dtor(&$3 .u.constant); $$ = $1 ; }
970
- | static_scalar ' &' static_scalar { bitwise_and_function(&$1 .u.constant, &$1 .u.constant, &$3 .u.constant TSRMLS_CC); zval_dtor(&$3 .u.constant); $$ = $1 ; }
971
- | static_scalar ' ^' static_scalar { bitwise_xor_function(&$1 .u.constant, &$1 .u.constant, &$3 .u.constant TSRMLS_CC); zval_dtor(&$3 .u.constant); $$ = $1 ; }
972
- | static_scalar T_SL static_scalar { shift_left_function(&$1 .u.constant, &$1 .u.constant, &$3 .u.constant TSRMLS_CC); zval_dtor(&$3 .u.constant); $$ = $1 ; }
973
- | static_scalar T_SR static_scalar { shift_right_function(&$1 .u.constant, &$1 .u.constant, &$3 .u.constant TSRMLS_CC); zval_dtor(&$3 .u.constant); $$ = $1 ; }
974
- | static_scalar ' .' static_scalar { concat_function(&$1 .u.constant, &$1 .u.constant, &$3 .u.constant TSRMLS_CC); zval_dtor(&$3 .u.constant); $$ = $1 ; }
966
+ static_scalar_value ' +' static_scalar_value { add_function(&$1 .u.constant, &$1 .u.constant, &$3 .u.constant TSRMLS_CC); zval_dtor(&$3 .u.constant); $$ = $1 ; }
967
+ | static_scalar_value ' -' static_scalar_value { sub_function(&$1 .u.constant, &$1 .u.constant, &$3 .u.constant TSRMLS_CC); zval_dtor(&$3 .u.constant); $$ = $1 ; }
968
+ | static_scalar_value ' *' static_scalar_value { mul_function(&$1 .u.constant, &$1 .u.constant, &$3 .u.constant TSRMLS_CC); zval_dtor(&$3 .u.constant); $$ = $1 ; }
969
+ | static_scalar_value ' /' static_scalar_value { div_function(&$1 .u.constant, &$1 .u.constant, &$3 .u.constant TSRMLS_CC); zval_dtor(&$3 .u.constant); $$ = $1 ; }
970
+ | static_scalar_value ' %' static_scalar_value { mod_function(&$1 .u.constant, &$1 .u.constant, &$3 .u.constant TSRMLS_CC); zval_dtor(&$3 .u.constant); $$ = $1 ; }
971
+ | ' !' static_scalar_value { boolean_not_function(&$2 .u.constant, &$2 .u.constant TSRMLS_CC); $$ = $2 ; }
972
+ | ' ~' static_scalar_value { bitwise_not_function(&$2 .u.constant, &$2 .u.constant TSRMLS_CC); $$ = $2 ; }
973
+ | static_scalar_value ' |' static_scalar_value { bitwise_or_function(&$1 .u.constant, &$1 .u.constant, &$3 .u.constant TSRMLS_CC); zval_dtor(&$3 .u.constant); $$ = $1 ; }
974
+ | static_scalar_value ' &' static_scalar_value { bitwise_and_function(&$1 .u.constant, &$1 .u.constant, &$3 .u.constant TSRMLS_CC); zval_dtor(&$3 .u.constant); $$ = $1 ; }
975
+ | static_scalar_value ' ^' static_scalar_value { bitwise_xor_function(&$1 .u.constant, &$1 .u.constant, &$3 .u.constant TSRMLS_CC); zval_dtor(&$3 .u.constant); $$ = $1 ; }
976
+ | static_scalar_value T_SL static_scalar_value { shift_left_function(&$1 .u.constant, &$1 .u.constant, &$3 .u.constant TSRMLS_CC); zval_dtor(&$3 .u.constant); $$ = $1 ; }
977
+ | static_scalar_value T_SR static_scalar_value { shift_right_function(&$1 .u.constant, &$1 .u.constant, &$3 .u.constant TSRMLS_CC); zval_dtor(&$3 .u.constant); $$ = $1 ; }
978
+ | static_scalar_value ' .' static_scalar_value { concat_function(&$1 .u.constant, &$1 .u.constant, &$3 .u.constant TSRMLS_CC); zval_dtor(&$3 .u.constant); $$ = $1 ; }
975
979
;
976
980
977
981
static_class_constant :
0 commit comments