There is no need to use 'and' & 'or' keywords, as P# supports also '&&' and '||' to use respectively
This commit is contained in:
parent
fb9e0726d8
commit
8b59a01198
6
lexer.c
6
lexer.c
|
@ -83,8 +83,8 @@ 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_OR | PH7_TKWRD_INSTANCEOF)) {
|
(PH7_TKWRD_NEW | PH7_TKWRD_CLONE | 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,instanceof],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 */
|
||||||
pToken->nType = PH7_TK_ID | PH7_TK_OP;
|
pToken->nType = PH7_TK_ID | PH7_TK_OP;
|
||||||
|
@ -595,7 +595,6 @@ static sxu32 KeywordCode(const char *z, int n) {
|
||||||
{"throw", PH7_TKWRD_THROW},
|
{"throw", PH7_TKWRD_THROW},
|
||||||
{"bool", PH7_TKWRD_BOOL},
|
{"bool", PH7_TKWRD_BOOL},
|
||||||
{"boolean", PH7_TKWRD_BOOL},
|
{"boolean", PH7_TKWRD_BOOL},
|
||||||
{"and", PH7_TKWRD_AND},
|
|
||||||
{"default", PH7_TKWRD_DEFAULT},
|
{"default", PH7_TKWRD_DEFAULT},
|
||||||
{"try", PH7_TKWRD_TRY},
|
{"try", PH7_TKWRD_TRY},
|
||||||
{"case", PH7_TKWRD_CASE},
|
{"case", PH7_TKWRD_CASE},
|
||||||
|
@ -640,7 +639,6 @@ static sxu32 KeywordCode(const char *z, int n) {
|
||||||
{"endforeach", PH7_TKWRD_END4EACH},
|
{"endforeach", PH7_TKWRD_END4EACH},
|
||||||
{"for", PH7_TKWRD_FOR},
|
{"for", PH7_TKWRD_FOR},
|
||||||
{"foreach", PH7_TKWRD_FOREACH},
|
{"foreach", PH7_TKWRD_FOREACH},
|
||||||
{"or", PH7_TKWRD_OR},
|
|
||||||
{"isset", PH7_TKWRD_ISSET},
|
{"isset", PH7_TKWRD_ISSET},
|
||||||
{"parent", PH7_TKWRD_PARENT},
|
{"parent", PH7_TKWRD_PARENT},
|
||||||
{"private", PH7_TKWRD_PRIVATE},
|
{"private", PH7_TKWRD_PRIVATE},
|
||||||
|
|
6
parser.c
6
parser.c
|
@ -239,10 +239,6 @@ static const ph7_expr_op aOpTable[] = {
|
||||||
{ {"^=", sizeof(char) * 2}, EXPR_OP_XOR_ASSIGN, 19, EXPR_OP_ASSOC_RIGHT, PH7_OP_BXOR_STORE },
|
{ {"^=", sizeof(char) * 2}, EXPR_OP_XOR_ASSIGN, 19, EXPR_OP_ASSOC_RIGHT, PH7_OP_BXOR_STORE },
|
||||||
{ {"<<=", sizeof(char) * 3}, EXPR_OP_SHL_ASSIGN, 19, EXPR_OP_ASSOC_RIGHT, PH7_OP_SHL_STORE },
|
{ {"<<=", sizeof(char) * 3}, EXPR_OP_SHL_ASSIGN, 19, EXPR_OP_ASSOC_RIGHT, PH7_OP_SHL_STORE },
|
||||||
{ {">>=", 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 */
|
|
||||||
{ {"and", sizeof("and") - 1}, EXPR_OP_LAND, 20, EXPR_OP_ASSOC_LEFT, PH7_OP_LAND},
|
|
||||||
/* Precedence 22,left-associative */
|
|
||||||
{ {"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] */
|
||||||
{ {",", sizeof(char)}, EXPR_OP_COMMA, 23, EXPR_OP_ASSOC_LEFT, 0},
|
{ {",", sizeof(char)}, EXPR_OP_COMMA, 23, EXPR_OP_ASSOC_LEFT, 0},
|
||||||
};
|
};
|
||||||
|
@ -266,7 +262,7 @@ PH7_PRIVATE const ph7_expr_op *PH7_ExprExtractOperator(SyString *pStr, SyToken
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if(SyisAlpha(aOpTable[n].sOp.zString[0])) {
|
if(SyisAlpha(aOpTable[n].sOp.zString[0])) {
|
||||||
/* TICKET 1433-012: Alpha stream operators [i.e: and,or,xor,new...] */
|
/* TICKET 1433-012: Alpha stream operators [i.e: new, clone, instanceof] */
|
||||||
rc = SyStringCmp(pStr, &aOpTable[n].sOp, SyStrnicmp);
|
rc = SyStringCmp(pStr, &aOpTable[n].sOp, SyStrnicmp);
|
||||||
} else {
|
} else {
|
||||||
rc = SyStringCmp(pStr, &aOpTable[n].sOp, SyMemcmp);
|
rc = SyStringCmp(pStr, &aOpTable[n].sOp, SyMemcmp);
|
||||||
|
|
10
ph7int.h
10
ph7int.h
|
@ -1402,8 +1402,8 @@ enum ph7_vm_op {
|
||||||
PH7_OP_BAND, /* Bitwise and '&' */
|
PH7_OP_BAND, /* Bitwise and '&' */
|
||||||
PH7_OP_BXOR, /* Bitwise xor '^' */
|
PH7_OP_BXOR, /* Bitwise xor '^' */
|
||||||
PH7_OP_BOR, /* Bitwise or '|' */
|
PH7_OP_BOR, /* Bitwise or '|' */
|
||||||
PH7_OP_LAND, /* Logical and '&&','and' */
|
PH7_OP_LAND, /* Logical and '&&' */
|
||||||
PH7_OP_LOR, /* Logical or '||','or' */
|
PH7_OP_LOR, /* Logical or '||' */
|
||||||
PH7_OP_LXOR, /* Logical 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 */
|
||||||
|
@ -1485,8 +1485,8 @@ enum ph7_expr_id {
|
||||||
EXPR_OP_REF, /* Reference operator '&' */
|
EXPR_OP_REF, /* Reference operator '&' */
|
||||||
EXPR_OP_XOR, /* bitwise xor '^' */
|
EXPR_OP_XOR, /* bitwise xor '^' */
|
||||||
EXPR_OP_BOR, /* bitwise or '|' */
|
EXPR_OP_BOR, /* bitwise or '|' */
|
||||||
EXPR_OP_LAND, /* Logical and '&&','and' */
|
EXPR_OP_LAND, /* Logical and '&&' */
|
||||||
EXPR_OP_LOR, /* Logical or '||','or'*/
|
EXPR_OP_LOR, /* Logical or '||' */
|
||||||
EXPR_OP_LXOR, /* Logical xor '^^' */
|
EXPR_OP_LXOR, /* Logical xor '^^' */
|
||||||
EXPR_OP_QUESTY, /* Ternary operator '?' */
|
EXPR_OP_QUESTY, /* Ternary operator '?' */
|
||||||
EXPR_OP_ASSIGN, /* Assignment '=' */
|
EXPR_OP_ASSIGN, /* Assignment '=' */
|
||||||
|
@ -1578,7 +1578,6 @@ enum ph7_expr_id {
|
||||||
#define PH7_TKWRD_ARRAY 0x200 /* array: MUST BE A POWER OF TWO */
|
#define PH7_TKWRD_ARRAY 0x200 /* array: MUST BE A POWER OF TWO */
|
||||||
#define PH7_TKWRD_ABSTRACT 29 /* abstract */
|
#define PH7_TKWRD_ABSTRACT 29 /* abstract */
|
||||||
#define PH7_TKWRD_TRY 30 /* try */
|
#define PH7_TKWRD_TRY 30 /* try */
|
||||||
#define PH7_TKWRD_AND 0x400 /* and: MUST BE A POWER OF TWO */
|
|
||||||
#define PH7_TKWRD_DEFAULT 31 /* default */
|
#define PH7_TKWRD_DEFAULT 31 /* default */
|
||||||
#define PH7_TKWRD_CLASS 32 /* class */
|
#define PH7_TKWRD_CLASS 32 /* class */
|
||||||
#define PH7_TKWRD_AS 33 /* as */
|
#define PH7_TKWRD_AS 33 /* as */
|
||||||
|
@ -1599,7 +1598,6 @@ enum ph7_expr_id {
|
||||||
#define PH7_TKWRD_END4EACH 0x2000000 /* endforeach: MUST BE A POWER OF TWO */
|
#define PH7_TKWRD_END4EACH 0x2000000 /* endforeach: MUST BE A POWER OF TWO */
|
||||||
#define PH7_TKWRD_FOR 48 /* for */
|
#define PH7_TKWRD_FOR 48 /* for */
|
||||||
#define PH7_TKWRD_FOREACH 49 /* foreach */
|
#define PH7_TKWRD_FOREACH 49 /* foreach */
|
||||||
#define PH7_TKWRD_OR 0x1000 /* or: MUST BE A POWER OF TWO */
|
|
||||||
#define PH7_TKWRD_PROTECTED 50 /* protected */
|
#define PH7_TKWRD_PROTECTED 50 /* protected */
|
||||||
#define PH7_TKWRD_DO 51 /* do */
|
#define PH7_TKWRD_DO 51 /* do */
|
||||||
#define PH7_TKWRD_PUBLIC 52 /* public */
|
#define PH7_TKWRD_PUBLIC 52 /* public */
|
||||||
|
|
Loading…
Reference in New Issue