summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndi Gutmans <andi@php.net>1999-10-19 13:33:17 +0000
committerAndi Gutmans <andi@php.net>1999-10-19 13:33:17 +0000
commit7a205f6087892996b2a2e3deabcf8a714e4b9d96 (patch)
tree251d8390481c10c8bd97dd8e1a6ee02a18c2b5f8
parent578c6035c8d54a8223b8ff2364f34902b144dc47 (diff)
downloadphp-git-7a205f6087892996b2a2e3deabcf8a714e4b9d96.tar.gz
- Preliminary submit of Thie's patch. Will fix the rest on Windows
as this was added on UNIX with patch. Changed IS_SAME -> IS_IDENTICAL
-rw-r--r--Zend/zend-parser.y3
-rw-r--r--Zend/zend-scanner.l4
-rw-r--r--Zend/zend_compile.h1
-rw-r--r--Zend/zend_execute.c3
-rw-r--r--Zend/zend_opcode.c3
-rw-r--r--Zend/zend_operators.c19
-rw-r--r--Zend/zend_operators.h1
7 files changed, 33 insertions, 1 deletions
diff --git a/Zend/zend-parser.y b/Zend/zend-parser.y
index 7081b4c3d4..e2461a3962 100644
--- a/Zend/zend-parser.y
+++ b/Zend/zend-parser.y
@@ -56,7 +56,7 @@
%left '|'
%left '^'
%left '&'
-%nonassoc T_IS_EQUAL T_IS_NOT_EQUAL
+%nonassoc T_IS_EQUAL T_IS_NOT_EQUAL T_IS_IDENTICAL
%nonassoc '<' T_IS_SMALLER_OR_EQUAL '>' T_IS_GREATER_OR_EQUAL
%left T_SL T_SR
%left '+' '-' '.'
@@ -406,6 +406,7 @@ expr_without_variable:
| '-' expr { $1.u.constant.value.lval=0; $1.u.constant.type=IS_LONG; $1.op_type = IS_CONST; INIT_PZVAL(&$1.u.constant); do_binary_op(ZEND_SUB, &$$, &$1, &$2 CLS_CC); }
| '!' expr { do_unary_op(ZEND_BOOL_NOT, &$$, &$2 CLS_CC); }
| '~' expr { do_unary_op(ZEND_BW_NOT, &$$, &$2 CLS_CC); }
+ | expr T_IS_IDENTICAL expr { do_binary_op(ZEND_IS_IDENTICAL, &$$, &$1, &$3 CLS_CC); }
| expr T_IS_EQUAL expr { do_binary_op(ZEND_IS_EQUAL, &$$, &$1, &$3 CLS_CC); }
| expr T_IS_NOT_EQUAL expr { do_binary_op(ZEND_IS_NOT_EQUAL, &$$, &$1, &$3 CLS_CC); }
| expr '<' expr { do_binary_op(ZEND_IS_SMALLER, &$$, &$1, &$3 CLS_CC); }
diff --git a/Zend/zend-scanner.l b/Zend/zend-scanner.l
index 7ff8486343..15d0f1abf4 100644
--- a/Zend/zend-scanner.l
+++ b/Zend/zend-scanner.l
@@ -823,6 +823,10 @@ ESCAPED_AND_WHITESPACE [\n\t\r #'.:;,()|^&+-/*=%!~<>?@]+
return T_DEC;
}
+<ST_IN_SCRIPTING>"===" {
+ return T_IS_IDENTICAL;
+}
+
<ST_IN_SCRIPTING>"==" {
return T_IS_EQUAL;
}
diff --git a/Zend/zend_compile.h b/Zend/zend_compile.h
index c63405b2fa..7f7efdc02a 100644
--- a/Zend/zend_compile.h
+++ b/Zend/zend_compile.h
@@ -504,6 +504,7 @@ int zendlex(znode *zendlval CLS_DC);
#define ZEND_EXT_FCALL_END 98
#define ZEND_EXT_NOP 99
+#define ZEND_IS_IDENTICAL 100
/* end of block */
diff --git a/Zend/zend_execute.c b/Zend/zend_execute.c
index 0acb5f157e..129083f1c9 100644
--- a/Zend/zend_execute.c
+++ b/Zend/zend_execute.c
@@ -970,6 +970,9 @@ void execute(zend_op_array *op_array ELS_DC)
case ZEND_CONCAT:
EG(binary_op) = concat_function;
goto binary_op_addr;
+ case ZEND_IS_IDENTICAL:
+ EG(binary_op) = is_identical_function;
+ goto binary_op_addr;
case ZEND_IS_EQUAL:
EG(binary_op) = is_equal_function;
goto binary_op_addr;
diff --git a/Zend/zend_opcode.c b/Zend/zend_opcode.c
index 8c2444659f..5aa107305b 100644
--- a/Zend/zend_opcode.c
+++ b/Zend/zend_opcode.c
@@ -380,6 +380,9 @@ ZEND_API void *get_binary_op(int opcode)
case ZEND_ASSIGN_CONCAT:
return (void *) concat_function;
break;
+ case ZEND_IS_IDENTICAL:
+ return (void *) is_identical_function;
+ break;
case ZEND_IS_EQUAL:
return (void *) is_equal_function;
break;
diff --git a/Zend/zend_operators.c b/Zend/zend_operators.c
index 69570054e1..2ef03fc2a5 100644
--- a/Zend/zend_operators.c
+++ b/Zend/zend_operators.c
@@ -914,6 +914,25 @@ ZEND_API int compare_function(zval *result, zval *op1, zval *op2)
}
+ZEND_API int is_identical_function(zval *result, zval *op1, zval *op2)
+{
+ if (op1->type != op2->type) {
+ convert_to_boolean(result);
+ result->value.lval = 0;
+ return SUCCESS;
+ }
+ if (compare_function(result, op1, op2) == FAILURE) {
+ return FAILURE;
+ }
+ convert_to_boolean(result);
+ if (result->value.lval == 0) {
+ result->value.lval = 1;
+ } else {
+ result->value.lval = 0;
+ }
+ return SUCCESS;
+}
+
ZEND_API int is_equal_function(zval *result, zval *op1, zval *op2)
{
if (compare_function(result, op1, op2) == FAILURE) {
diff --git a/Zend/zend_operators.h b/Zend/zend_operators.h
index 2458b14fed..727d1c9d21 100644
--- a/Zend/zend_operators.h
+++ b/Zend/zend_operators.h
@@ -42,6 +42,7 @@ ZEND_API int shift_right_function(zval *result, zval *op1, zval *op2);
ZEND_API int concat_function(zval *result, zval *op1, zval *op2);
ZEND_API int is_equal_function(zval *result, zval *op1, zval *op2);
+ZEND_API int is_identical_function(zval *result, zval *op1, zval *op2);
ZEND_API int is_not_equal_function(zval *result, zval *op1, zval *op2);
ZEND_API int is_smaller_function(zval *result, zval *op1, zval *op2);
ZEND_API int is_smaller_or_equal_function(zval *result, zval *op1, zval *op2);