P# supports only ^^ keyword as a logical XOR. There is no need to have 'xor'.

This commit is contained in:
Rafal Kupiec 2018-07-12 17:35:42 +02:00
parent d898cd1e36
commit 4071f0b8ee
Signed by: belliash
GPG Key ID: 4E829243E0CFE6B4
3 changed files with 3 additions and 7 deletions

View File

@ -83,7 +83,7 @@ static sxi32 TokenizePHP(SyStream *pStream, SyToken *pToken, void *pUserData, vo
nKeyword = KeywordCode(pStr->zString, (int)pStr->nByte); nKeyword = KeywordCode(pStr->zString, (int)pStr->nByte);
if(nKeyword != PH7_TK_ID) { if(nKeyword != PH7_TK_ID) {
if(nKeyword & if(nKeyword &
(PH7_TKWRD_NEW | PH7_TKWRD_CLONE | PH7_TKWRD_AND | PH7_TKWRD_XOR | PH7_TKWRD_OR | PH7_TKWRD_INSTANCEOF)) { (PH7_TKWRD_NEW | PH7_TKWRD_CLONE | PH7_TKWRD_AND | PH7_TKWRD_OR | PH7_TKWRD_INSTANCEOF)) {
/* Alpha stream operators [i.e: new,clone,and,instanceof,eq,ne,or,xor],save the operator instance for later processing */ /* Alpha stream operators [i.e: new,clone,and,instanceof,eq,ne,or,xor],save the operator instance for later processing */
pToken->pUserData = (void *)PH7_ExprExtractOperator(pStr, 0); pToken->pUserData = (void *)PH7_ExprExtractOperator(pStr, 0);
/* Mark as an operator */ /* Mark as an operator */
@ -648,7 +648,6 @@ static sxu32 KeywordCode(const char *z, int n) {
{"public", PH7_TKWRD_PUBLIC}, {"public", PH7_TKWRD_PUBLIC},
{"catch", PH7_TKWRD_CATCH}, {"catch", PH7_TKWRD_CATCH},
{"unset", PH7_TKWRD_UNSET}, {"unset", PH7_TKWRD_UNSET},
{"xor", PH7_TKWRD_XOR},
{"break", PH7_TKWRD_BREAK} {"break", PH7_TKWRD_BREAK}
}; };
if(n < 2) { if(n < 2) {

View File

@ -241,8 +241,6 @@ static const ph7_expr_op aOpTable[] = {
{ {">>=", sizeof(char) * 3}, EXPR_OP_SHR_ASSIGN, 19, EXPR_OP_ASSOC_RIGHT, PH7_OP_SHR_STORE }, { {">>=", sizeof(char) * 3}, EXPR_OP_SHR_ASSIGN, 19, EXPR_OP_ASSOC_RIGHT, PH7_OP_SHR_STORE },
/* Precedence 20,left-associative */ /* Precedence 20,left-associative */
{ {"and", sizeof("and") - 1}, EXPR_OP_LAND, 20, EXPR_OP_ASSOC_LEFT, PH7_OP_LAND}, { {"and", sizeof("and") - 1}, EXPR_OP_LAND, 20, EXPR_OP_ASSOC_LEFT, PH7_OP_LAND},
/* Precedence 21,left-associative */
{ {"xor", sizeof("xor") - 1}, EXPR_OP_LXOR, 21, EXPR_OP_ASSOC_LEFT, PH7_OP_LXOR},
/* Precedence 22,left-associative */ /* Precedence 22,left-associative */
{ {"or", sizeof("or") - 1}, EXPR_OP_LOR, 22, EXPR_OP_ASSOC_LEFT, PH7_OP_LOR}, { {"or", sizeof("or") - 1}, EXPR_OP_LOR, 22, EXPR_OP_ASSOC_LEFT, PH7_OP_LOR},
/* Precedence 23,left-associative [Lowest operator] */ /* Precedence 23,left-associative [Lowest operator] */

View File

@ -1410,7 +1410,7 @@ enum ph7_vm_op {
PH7_OP_BOR, /* Bitwise or '|' */ PH7_OP_BOR, /* Bitwise or '|' */
PH7_OP_LAND, /* Logical and '&&','and' */ PH7_OP_LAND, /* Logical and '&&','and' */
PH7_OP_LOR, /* Logical or '||','or' */ PH7_OP_LOR, /* Logical or '||','or' */
PH7_OP_LXOR, /* Logical xor 'xor' */ PH7_OP_LXOR, /* Logical xor '^^' */
PH7_OP_STORE, /* Store Object */ PH7_OP_STORE, /* Store Object */
PH7_OP_STORE_IDX, /* Store indexed object */ PH7_OP_STORE_IDX, /* Store indexed object */
PH7_OP_STORE_IDX_REF,/* Store indexed object by reference */ PH7_OP_STORE_IDX_REF,/* Store indexed object by reference */
@ -1493,7 +1493,7 @@ enum ph7_expr_id {
EXPR_OP_BOR, /* bitwise or '|' */ EXPR_OP_BOR, /* bitwise or '|' */
EXPR_OP_LAND, /* Logical and '&&','and' */ EXPR_OP_LAND, /* Logical and '&&','and' */
EXPR_OP_LOR, /* Logical or '||','or'*/ EXPR_OP_LOR, /* Logical or '||','or'*/
EXPR_OP_LXOR, /* Logical xor 'xor' */ EXPR_OP_LXOR, /* Logical xor '^^' */
EXPR_OP_QUESTY, /* Ternary operator '?' */ EXPR_OP_QUESTY, /* Ternary operator '?' */
EXPR_OP_ASSIGN, /* Assignment '=' */ EXPR_OP_ASSIGN, /* Assignment '=' */
EXPR_OP_ADD_ASSIGN, /* Combined operator: += */ EXPR_OP_ADD_ASSIGN, /* Combined operator: += */
@ -1612,7 +1612,6 @@ enum ph7_expr_id {
#define PH7_TKWRD_CATCH 53 /* catch */ #define PH7_TKWRD_CATCH 53 /* catch */
#define PH7_TKWRD_RETURN 54 /* return */ #define PH7_TKWRD_RETURN 54 /* return */
#define PH7_TKWRD_UNSET 0x2000 /* unset: MUST BE A POWER OF TWO */ #define PH7_TKWRD_UNSET 0x2000 /* unset: MUST BE A POWER OF TWO */
#define PH7_TKWRD_XOR 0x4000 /* xor: MUST BE A POWER OF TWO */
#define PH7_TKWRD_BREAK 55 /* break */ #define PH7_TKWRD_BREAK 55 /* break */
#define PH7_TKWRD_GOTO 56 /* goto */ #define PH7_TKWRD_GOTO 56 /* goto */
#define PH7_TKWRD_BOOL 0x8000 /* bool: MUST BE A POWER OF TWO */ #define PH7_TKWRD_BOOL 0x8000 /* bool: MUST BE A POWER OF TWO */