diff --git a/parser/base.c b/parser/base.c index 19b87db9..ff3514da 100644 --- a/parser/base.c +++ b/parser/base.c @@ -444,6 +444,9 @@ void xx_parse_program(zval *return_value, char *program, size_t program_length, case XX_T_TYPE_RESOURCE: xx_(xx_parser, XX_TYPE_RESOURCE, NULL, parser_status); break; + case XX_T_TYPE_MIXED: + xx_(xx_parser, XX_TYPE_MIXED, NULL, parser_status); + break; case XX_T_TYPE_CALLABLE: xx_(xx_parser, XX_TYPE_CALLABLE, NULL, parser_status); break; diff --git a/parser/parser.h b/parser/parser.h index 1240979d..eb0a8094 100644 --- a/parser/parser.h +++ b/parser/parser.h @@ -534,7 +534,6 @@ static void xx_ret_return_type_item(zval *ret, zval *type, zval *cast, int manda static void xx_ret_type(zval *ret, int type) { switch (type) { - case XX_TYPE_INTEGER: parser_get_string(ret, "int"); return; @@ -587,6 +586,10 @@ static void xx_ret_type(zval *ret, int type) parser_get_string(ret, "object"); return; + case XX_TYPE_MIXED: + parser_get_string(ret, "mixed"); + return; + case XX_T_TYPE_NULL: parser_get_string(ret, "null"); return; @@ -1040,6 +1043,10 @@ static void xx_ret_declare_statement(zval *ret, int type, zval *variables, xx_sc parser_add_str(ret, "data-type", "resource"); break; + case XX_T_TYPE_MIXED: + parser_add_str(ret, "data-type", "mixed"); + break; + case XX_T_TYPE_OBJECT: parser_add_str(ret, "data-type", "object"); break; diff --git a/parser/scanner.h b/parser/scanner.h index 104e8400..16cf9599 100644 --- a/parser/scanner.h +++ b/parser/scanner.h @@ -46,6 +46,7 @@ #define XX_T_TYPE_RESOURCE 333 #define XX_T_TYPE_NULL 334 #define XX_T_TYPE_THIS 335 +#define XX_T_TYPE_MIXED 336 #define XX_T_NAMESPACE 350 #define XX_T_CLASS 351 diff --git a/parser/scanner.re b/parser/scanner.re index 88b11a05..f489061d 100644 --- a/parser/scanner.re +++ b/parser/scanner.re @@ -297,6 +297,12 @@ int xx_get_token(xx_scanner_state *s, xx_scanner_token *token) { return 0; } + 'mixed' { + s->active_char += sizeof("mixed")-1; + token->opcode = XX_T_TYPE_MIXED; + return 0; + } + 'if' { s->active_char += sizeof("if")-1; token->opcode = XX_T_IF; diff --git a/parser/zephir.lemon b/parser/zephir.lemon index 5abbddc1..239093bd 100644 --- a/parser/zephir.lemon +++ b/parser/zephir.lemon @@ -946,6 +946,10 @@ xx_parameter_type(R) ::= TYPE_RESOURCE . { xx_ret_type(&R, XX_TYPE_RESOURCE); } +xx_parameter_type(R) ::= TYPE_MIXED . { + xx_ret_type(&R, XX_TYPE_MIXED); +} + xx_parameter_type(R) ::= TYPE_OBJECT . { xx_ret_type(&R, XX_TYPE_OBJECT); } @@ -1596,6 +1600,10 @@ xx_declare_statement(R) ::= TYPE_ARRAY xx_declare_variable_list(L) DOTCOMMA . { xx_ret_declare_statement(&R, XX_T_TYPE_ARRAY, &L, status->scanner_state); } +xx_declare_statement(R) ::= TYPE_MIXED xx_declare_variable_list(L) DOTCOMMA . { + xx_ret_declare_statement(&R, XX_T_TYPE_MIXED, &L, status->scanner_state); +} + xx_declare_variable_list(R) ::= xx_declare_variable_list(L) COMMA xx_declare_variable(V) . { xx_ret_list(&R, &L, &V, status->scanner_state); }