summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTorben Wilson <torben@php.net>2000-03-29 22:05:19 +0000
committerTorben Wilson <torben@php.net>2000-03-29 22:05:19 +0000
commit521c8af6a4af285a0159b92640e37736d9e569de (patch)
tree596e0267f2ba576bd14fac24efcfb93341639d1e
parentf50de70308ddfa3d8477634318fa059e11f52a30 (diff)
downloadphp-git-521c8af6a4af285a0159b92640e37736d9e569de.tar.gz
Added !== (is not identical) operator.
-rw-r--r--Zend/zend-parser.y3
-rw-r--r--Zend/zend-scanner.l4
-rw-r--r--Zend/zend_compile.h203
-rw-r--r--Zend/zend_execute.c3
-rw-r--r--Zend/zend_opcode.c3
-rw-r--r--Zend/zend_operators.c12
-rw-r--r--Zend/zend_operators.h1
7 files changed, 127 insertions, 102 deletions
diff --git a/Zend/zend-parser.y b/Zend/zend-parser.y
index c6e7fc3c23..6c1a4095ce 100644
--- a/Zend/zend-parser.y
+++ b/Zend/zend-parser.y
@@ -60,7 +60,7 @@
%left '|'
%left '^'
%left '&'
-%nonassoc T_IS_EQUAL T_IS_NOT_EQUAL T_IS_IDENTICAL
+%nonassoc T_IS_EQUAL T_IS_NOT_EQUAL T_IS_IDENTICAL T_IS_NOT_IDENTICAL
%nonassoc '<' T_IS_SMALLER_OR_EQUAL '>' T_IS_GREATER_OR_EQUAL
%left T_SL T_SR
%left '+' '-' '.'
@@ -454,6 +454,7 @@ expr_without_variable:
| '!' 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_NOT_IDENTICAL expr { do_binary_op(ZEND_IS_NOT_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 5e214e13e6..86566de35b 100644
--- a/Zend/zend-scanner.l
+++ b/Zend/zend-scanner.l
@@ -989,6 +989,10 @@ ESCAPED_AND_WHITESPACE [\n\t\r #'.:;,()|^&+-/*=%!~<>?@]+
return T_IS_IDENTICAL;
}
+<ST_IN_SCRIPTING>"!==" {
+ return T_IS_NOT_IDENTICAL;
+}
+
<ST_IN_SCRIPTING>"==" {
return T_IS_EQUAL;
}
diff --git a/Zend/zend_compile.h b/Zend/zend_compile.h
index 5bcd93c723..0bc4199526 100644
--- a/Zend/zend_compile.h
+++ b/Zend/zend_compile.h
@@ -403,120 +403,121 @@ int zendlex(znode *zendlval CLS_DC);
#define ZEND_BOOL_NOT 13
#define ZEND_BOOL_XOR 14
#define ZEND_IS_IDENTICAL 15
-#define ZEND_IS_EQUAL 16
-#define ZEND_IS_NOT_EQUAL 17
-#define ZEND_IS_SMALLER 18
-#define ZEND_IS_SMALLER_OR_EQUAL 19
-#define ZEND_CAST 20
-#define ZEND_QM_ASSIGN 21
-
-#define ZEND_ASSIGN_ADD 22
-#define ZEND_ASSIGN_SUB 23
-#define ZEND_ASSIGN_MUL 24
-#define ZEND_ASSIGN_DIV 25
-#define ZEND_ASSIGN_MOD 26
-#define ZEND_ASSIGN_SL 27
-#define ZEND_ASSIGN_SR 28
-#define ZEND_ASSIGN_CONCAT 29
-#define ZEND_ASSIGN_BW_OR 30
-#define ZEND_ASSIGN_BW_AND 31
-#define ZEND_ASSIGN_BW_XOR 32
+#define ZEND_IS_NOT_IDENTICAL 16
+#define ZEND_IS_EQUAL 17
+#define ZEND_IS_NOT_EQUAL 18
+#define ZEND_IS_SMALLER 19
+#define ZEND_IS_SMALLER_OR_EQUAL 20
+#define ZEND_CAST 21
+#define ZEND_QM_ASSIGN 22
+
+#define ZEND_ASSIGN_ADD 23
+#define ZEND_ASSIGN_SUB 24
+#define ZEND_ASSIGN_MUL 25
+#define ZEND_ASSIGN_DIV 26
+#define ZEND_ASSIGN_MOD 27
+#define ZEND_ASSIGN_SL 28
+#define ZEND_ASSIGN_SR 29
+#define ZEND_ASSIGN_CONCAT 30
+#define ZEND_ASSIGN_BW_OR 31
+#define ZEND_ASSIGN_BW_AND 32
+#define ZEND_ASSIGN_BW_XOR 33
-#define ZEND_PRE_INC 33
-#define ZEND_PRE_DEC 34
-#define ZEND_POST_INC 35
-#define ZEND_POST_DEC 36
+#define ZEND_PRE_INC 34
+#define ZEND_PRE_DEC 35
+#define ZEND_POST_INC 36
+#define ZEND_POST_DEC 37
+
+#define ZEND_ASSIGN 38
+#define ZEND_ASSIGN_REF 39
+
+#define ZEND_ECHO 40
+#define ZEND_PRINT 41
+
+#define ZEND_JMP 42
+#define ZEND_JMPZ 43
+#define ZEND_JMPNZ 44
+#define ZEND_JMPZNZ 45
+#define ZEND_JMPZ_EX 46
+#define ZEND_JMPNZ_EX 47
+#define ZEND_CASE 48
+#define ZEND_SWITCH_FREE 49
+#define ZEND_BRK 50
+#define ZEND_CONT 51
+#define ZEND_BOOL 52
+
+#define ZEND_INIT_STRING 53
+#define ZEND_ADD_CHAR 54
+#define ZEND_ADD_STRING 55
+#define ZEND_ADD_VAR 56
+
+#define ZEND_BEGIN_SILENCE 57
+#define ZEND_END_SILENCE 58
+
+#define ZEND_INIT_FCALL_BY_NAME 59
+#define ZEND_DO_FCALL 60
+#define ZEND_DO_FCALL_BY_NAME 61
+#define ZEND_RETURN 62
+
+#define ZEND_RECV 63
+#define ZEND_RECV_INIT 64
-#define ZEND_ASSIGN 37
-#define ZEND_ASSIGN_REF 38
-
-#define ZEND_ECHO 39
-#define ZEND_PRINT 40
-
-#define ZEND_JMP 41
-#define ZEND_JMPZ 42
-#define ZEND_JMPNZ 43
-#define ZEND_JMPZNZ 44
-#define ZEND_JMPZ_EX 45
-#define ZEND_JMPNZ_EX 46
-#define ZEND_CASE 47
-#define ZEND_SWITCH_FREE 48
-#define ZEND_BRK 49
-#define ZEND_CONT 50
-#define ZEND_BOOL 51
-
-#define ZEND_INIT_STRING 52
-#define ZEND_ADD_CHAR 53
-#define ZEND_ADD_STRING 54
-#define ZEND_ADD_VAR 55
-
-#define ZEND_BEGIN_SILENCE 56
-#define ZEND_END_SILENCE 57
-
-#define ZEND_INIT_FCALL_BY_NAME 58
-#define ZEND_DO_FCALL 59
-#define ZEND_DO_FCALL_BY_NAME 60
-#define ZEND_RETURN 61
-
-#define ZEND_RECV 62
-#define ZEND_RECV_INIT 63
-
-#define ZEND_SEND_VAL 64
-#define ZEND_SEND_VAR 65
-#define ZEND_SEND_REF 66
+#define ZEND_SEND_VAL 65
+#define ZEND_SEND_VAR 66
+#define ZEND_SEND_REF 67
-#define ZEND_NEW 67
-#define ZEND_JMP_NO_CTOR 68
-#define ZEND_FREE 69
+#define ZEND_NEW 68
+#define ZEND_JMP_NO_CTOR 69
+#define ZEND_FREE 70
-#define ZEND_INIT_ARRAY 70
-#define ZEND_ADD_ARRAY_ELEMENT 71
+#define ZEND_INIT_ARRAY 71
+#define ZEND_ADD_ARRAY_ELEMENT 72
-#define ZEND_INCLUDE_OR_EVAL 72
+#define ZEND_INCLUDE_OR_EVAL 73
-#define ZEND_UNSET_VAR 73
-#define ZEND_UNSET_DIM_OBJ 74
-#define ZEND_ISSET_ISEMPTY 75
+#define ZEND_UNSET_VAR 74
+#define ZEND_UNSET_DIM_OBJ 75
+#define ZEND_ISSET_ISEMPTY 76
-#define ZEND_FE_RESET 76
-#define ZEND_FE_FETCH 77
+#define ZEND_FE_RESET 77
+#define ZEND_FE_FETCH 78
-#define ZEND_EXIT 78
+#define ZEND_EXIT 79
/* the following 18 opcodes are 6 groups of 3 opcodes each, and must
* remain in that order!
*/
-#define ZEND_FETCH_R 79
-#define ZEND_FETCH_DIM_R 80
-#define ZEND_FETCH_OBJ_R 81
-#define ZEND_FETCH_W 82
-#define ZEND_FETCH_DIM_W 83
-#define ZEND_FETCH_OBJ_W 84
-#define ZEND_FETCH_RW 85
-#define ZEND_FETCH_DIM_RW 86
-#define ZEND_FETCH_OBJ_RW 87
-#define ZEND_FETCH_IS 88
-#define ZEND_FETCH_DIM_IS 89
-#define ZEND_FETCH_OBJ_IS 90
-#define ZEND_FETCH_FUNC_ARG 91
-#define ZEND_FETCH_DIM_FUNC_ARG 92
-#define ZEND_FETCH_OBJ_FUNC_ARG 93
-#define ZEND_FETCH_UNSET 94
-#define ZEND_FETCH_DIM_UNSET 95
-#define ZEND_FETCH_OBJ_UNSET 96
-
-#define ZEND_FETCH_DIM_TMP_VAR 97
-#define ZEND_FETCH_CONSTANT 98
-
-#define ZEND_DECLARE_FUNCTION_OR_CLASS 99
-
-#define ZEND_EXT_STMT 100
-#define ZEND_EXT_FCALL_BEGIN 101
-#define ZEND_EXT_FCALL_END 102
-#define ZEND_EXT_NOP 103
-
-#define ZEND_TICKS 104
+#define ZEND_FETCH_R 80
+#define ZEND_FETCH_DIM_R 81
+#define ZEND_FETCH_OBJ_R 82
+#define ZEND_FETCH_W 83
+#define ZEND_FETCH_DIM_W 84
+#define ZEND_FETCH_OBJ_W 85
+#define ZEND_FETCH_RW 86
+#define ZEND_FETCH_DIM_RW 87
+#define ZEND_FETCH_OBJ_RW 88
+#define ZEND_FETCH_IS 89
+#define ZEND_FETCH_DIM_IS 90
+#define ZEND_FETCH_OBJ_IS 91
+#define ZEND_FETCH_FUNC_ARG 92
+#define ZEND_FETCH_DIM_FUNC_ARG 93
+#define ZEND_FETCH_OBJ_FUNC_ARG 94
+#define ZEND_FETCH_UNSET 95
+#define ZEND_FETCH_DIM_UNSET 96
+#define ZEND_FETCH_OBJ_UNSET 97
+
+#define ZEND_FETCH_DIM_TMP_VAR 98
+#define ZEND_FETCH_CONSTANT 99
+
+#define ZEND_DECLARE_FUNCTION_OR_CLASS 100
+
+#define ZEND_EXT_STMT 101
+#define ZEND_EXT_FCALL_BEGIN 102
+#define ZEND_EXT_FCALL_END 103
+#define ZEND_EXT_NOP 104
+
+#define ZEND_TICKS 105
/* end of block */
diff --git a/Zend/zend_execute.c b/Zend/zend_execute.c
index d8c44c0f1f..54a97671ad 100644
--- a/Zend/zend_execute.c
+++ b/Zend/zend_execute.c
@@ -1051,6 +1051,9 @@ void execute(zend_op_array *op_array ELS_DC)
case ZEND_IS_IDENTICAL:
EG(binary_op) = is_identical_function;
goto binary_op_addr;
+ case ZEND_IS_NOT_IDENTICAL:
+ EG(binary_op) = is_not_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 96ac7952ec..9d05b2cbc5 100644
--- a/Zend/zend_opcode.c
+++ b/Zend/zend_opcode.c
@@ -384,6 +384,9 @@ ZEND_API void *get_binary_op(int opcode)
case ZEND_IS_IDENTICAL:
return (void *) is_identical_function;
break;
+ case ZEND_IS_NOT_IDENTICAL:
+ return (void *) is_not_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 ece7d04dcd..0a2cc35148 100644
--- a/Zend/zend_operators.c
+++ b/Zend/zend_operators.c
@@ -999,6 +999,18 @@ ZEND_API int is_identical_function(zval *result, zval *op1, zval *op2)
return FAILURE;
}
+
+ZEND_API int is_not_identical_function(zval *result, zval *op1, zval *op2)
+{
+ result->type = IS_BOOL;
+ if ( is_identical_function( result, op1, op2 ) == FAILURE ) {
+ return FAILURE;
+ }
+ result->value.lval = !result->value.lval;
+ 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 ad3cab6ef1..ace040cb9a 100644
--- a/Zend/zend_operators.h
+++ b/Zend/zend_operators.h
@@ -43,6 +43,7 @@ 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_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);