This commit is contained in:
parent
6f0d1ab3ff
commit
a4e6962a67
@ -505,12 +505,6 @@ static sxi32 TokenizePHP(SyStream *pStream, SyToken *pToken, void *pUserData, vo
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case '.':
|
|
||||||
if(pStream->zText < pStream->zEnd && pStream->zText[0] == '=') {
|
|
||||||
/* Current operator: .= */
|
|
||||||
pStream->zText++;
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
case '<':
|
case '<':
|
||||||
if(pStream->zText < pStream->zEnd) {
|
if(pStream->zText < pStream->zEnd) {
|
||||||
if(pStream->zText[0] == '<') {
|
if(pStream->zText[0] == '<') {
|
||||||
|
@ -192,7 +192,6 @@ static const ph7_expr_op aOpTable[] = {
|
|||||||
/* Precedence 8,left-associative */
|
/* Precedence 8,left-associative */
|
||||||
{ {"+", sizeof(char)}, EXPR_OP_ADD, 8, EXPR_OP_ASSOC_LEFT, PH7_OP_ADD},
|
{ {"+", sizeof(char)}, EXPR_OP_ADD, 8, EXPR_OP_ASSOC_LEFT, PH7_OP_ADD},
|
||||||
{ {"-", sizeof(char)}, EXPR_OP_SUB, 8, EXPR_OP_ASSOC_LEFT, PH7_OP_SUB},
|
{ {"-", sizeof(char)}, EXPR_OP_SUB, 8, EXPR_OP_ASSOC_LEFT, PH7_OP_SUB},
|
||||||
{ {".", sizeof(char)}, EXPR_OP_DOT, 8, EXPR_OP_ASSOC_LEFT, PH7_OP_CAT},
|
|
||||||
/* Precedence 9,left-associative */
|
/* Precedence 9,left-associative */
|
||||||
{ {"<<", sizeof(char) * 2}, EXPR_OP_SHL, 9, EXPR_OP_ASSOC_LEFT, PH7_OP_SHL},
|
{ {"<<", sizeof(char) * 2}, EXPR_OP_SHL, 9, EXPR_OP_ASSOC_LEFT, PH7_OP_SHL},
|
||||||
{ {">>", sizeof(char) * 2}, EXPR_OP_SHR, 9, EXPR_OP_ASSOC_LEFT, PH7_OP_SHR},
|
{ {">>", sizeof(char) * 2}, EXPR_OP_SHR, 9, EXPR_OP_ASSOC_LEFT, PH7_OP_SHR},
|
||||||
@ -230,7 +229,6 @@ static const ph7_expr_op aOpTable[] = {
|
|||||||
{ {"=", sizeof(char)}, EXPR_OP_ASSIGN, 19, EXPR_OP_ASSOC_RIGHT, PH7_OP_STORE},
|
{ {"=", sizeof(char)}, EXPR_OP_ASSIGN, 19, EXPR_OP_ASSOC_RIGHT, PH7_OP_STORE},
|
||||||
{ {"+=", sizeof(char) * 2}, EXPR_OP_ADD_ASSIGN, 19, EXPR_OP_ASSOC_RIGHT, PH7_OP_ADD_STORE },
|
{ {"+=", sizeof(char) * 2}, EXPR_OP_ADD_ASSIGN, 19, EXPR_OP_ASSOC_RIGHT, PH7_OP_ADD_STORE },
|
||||||
{ {"-=", sizeof(char) * 2}, EXPR_OP_SUB_ASSIGN, 19, EXPR_OP_ASSOC_RIGHT, PH7_OP_SUB_STORE },
|
{ {"-=", sizeof(char) * 2}, EXPR_OP_SUB_ASSIGN, 19, EXPR_OP_ASSOC_RIGHT, PH7_OP_SUB_STORE },
|
||||||
{ {".=", sizeof(char) * 2}, EXPR_OP_DOT_ASSIGN, 19, EXPR_OP_ASSOC_RIGHT, PH7_OP_CAT_STORE },
|
|
||||||
{ {"*=", sizeof(char) * 2}, EXPR_OP_MUL_ASSIGN, 19, EXPR_OP_ASSOC_RIGHT, PH7_OP_MUL_STORE },
|
{ {"*=", sizeof(char) * 2}, EXPR_OP_MUL_ASSIGN, 19, EXPR_OP_ASSOC_RIGHT, PH7_OP_MUL_STORE },
|
||||||
{ {"/=", sizeof(char) * 2}, EXPR_OP_DIV_ASSIGN, 19, EXPR_OP_ASSOC_RIGHT, PH7_OP_DIV_STORE },
|
{ {"/=", sizeof(char) * 2}, EXPR_OP_DIV_ASSIGN, 19, EXPR_OP_ASSOC_RIGHT, PH7_OP_DIV_STORE },
|
||||||
{ {"%=", sizeof(char) * 2}, EXPR_OP_MOD_ASSIGN, 19, EXPR_OP_ASSOC_RIGHT, PH7_OP_MOD_STORE },
|
{ {"%=", sizeof(char) * 2}, EXPR_OP_MOD_ASSIGN, 19, EXPR_OP_ASSOC_RIGHT, PH7_OP_MOD_STORE },
|
||||||
|
77
engine/vm.c
77
engine/vm.c
@ -3963,77 +3963,6 @@ static sxi32 VmByteCodeExec(
|
|||||||
VmPopOperand(&pTos, 1);
|
VmPopOperand(&pTos, 1);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
/* CAT: P1 * *
|
|
||||||
*
|
|
||||||
* Pop P1 elements from the stack. Concatenate them together and push the result
|
|
||||||
* back.
|
|
||||||
*/
|
|
||||||
case PH7_OP_CAT: {
|
|
||||||
ph7_value *pNos, *pCur;
|
|
||||||
if(pInstr->iP1 < 1) {
|
|
||||||
pNos = &pTos[-1];
|
|
||||||
} else {
|
|
||||||
pNos = &pTos[-pInstr->iP1 + 1];
|
|
||||||
}
|
|
||||||
#ifdef UNTRUST
|
|
||||||
if(pNos < pStack) {
|
|
||||||
goto Abort;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
/* Force a string cast */
|
|
||||||
if((pNos->iFlags & MEMOBJ_STRING) == 0) {
|
|
||||||
PH7_MemObjToString(pNos);
|
|
||||||
}
|
|
||||||
pCur = &pNos[1];
|
|
||||||
while(pCur <= pTos) {
|
|
||||||
if((pCur->iFlags & MEMOBJ_STRING) == 0) {
|
|
||||||
PH7_MemObjToString(pCur);
|
|
||||||
}
|
|
||||||
/* Perform the concatenation */
|
|
||||||
if(SyBlobLength(&pCur->sBlob) > 0) {
|
|
||||||
PH7_MemObjStringAppend(pNos, (const char *)SyBlobData(&pCur->sBlob), SyBlobLength(&pCur->sBlob));
|
|
||||||
}
|
|
||||||
SyBlobRelease(&pCur->sBlob);
|
|
||||||
pCur++;
|
|
||||||
}
|
|
||||||
pTos = pNos;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
/* CAT_STORE: * * *
|
|
||||||
*
|
|
||||||
* Pop two elements from the stack. Concatenate them together and push the result
|
|
||||||
* back.
|
|
||||||
*/
|
|
||||||
case PH7_OP_CAT_STORE: {
|
|
||||||
ph7_value *pNos = &pTos[-1];
|
|
||||||
ph7_value *pObj;
|
|
||||||
#ifdef UNTRUST
|
|
||||||
if(pNos < pStack) {
|
|
||||||
goto Abort;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
if((pTos->iFlags & MEMOBJ_STRING) == 0) {
|
|
||||||
/* Force a string cast */
|
|
||||||
PH7_MemObjToString(pTos);
|
|
||||||
}
|
|
||||||
if((pNos->iFlags & MEMOBJ_STRING) == 0) {
|
|
||||||
/* Force a string cast */
|
|
||||||
PH7_MemObjToString(pNos);
|
|
||||||
}
|
|
||||||
/* Perform the concatenation (Reverse order) */
|
|
||||||
if(SyBlobLength(&pNos->sBlob) > 0) {
|
|
||||||
PH7_MemObjStringAppend(pTos, (const char *)SyBlobData(&pNos->sBlob), SyBlobLength(&pNos->sBlob));
|
|
||||||
}
|
|
||||||
/* Perform the store operation */
|
|
||||||
if(pTos->nIdx == SXU32_HIGH) {
|
|
||||||
PH7_VmThrowError(&(*pVm), 0, PH7_CTX_ERR, "Cannot perform assignment on a constant class attribute");
|
|
||||||
} else if((pObj = (ph7_value *)SySetAt(&pVm->aMemObj, pTos->nIdx)) != 0) {
|
|
||||||
PH7_MemObjStore(pTos, pObj);
|
|
||||||
}
|
|
||||||
PH7_MemObjStore(pTos, pNos);
|
|
||||||
VmPopOperand(&pTos, 1);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
/* OP_AND: * * *
|
/* OP_AND: * * *
|
||||||
*
|
*
|
||||||
* Pop two values off the stack. Take the logical AND of the
|
* Pop two values off the stack. Take the logical AND of the
|
||||||
@ -5940,9 +5869,6 @@ static const char *VmInstrToString(sxi32 nOp) {
|
|||||||
case PH7_OP_POP:
|
case PH7_OP_POP:
|
||||||
zOp = "POP ";
|
zOp = "POP ";
|
||||||
break;
|
break;
|
||||||
case PH7_OP_CAT:
|
|
||||||
zOp = "CAT ";
|
|
||||||
break;
|
|
||||||
case PH7_OP_CVT_INT:
|
case PH7_OP_CVT_INT:
|
||||||
zOp = "CVT_INT ";
|
zOp = "CVT_INT ";
|
||||||
break;
|
break;
|
||||||
@ -6090,9 +6016,6 @@ static const char *VmInstrToString(sxi32 nOp) {
|
|||||||
case PH7_OP_MOD_STORE:
|
case PH7_OP_MOD_STORE:
|
||||||
zOp = "MOD_STORE ";
|
zOp = "MOD_STORE ";
|
||||||
break;
|
break;
|
||||||
case PH7_OP_CAT_STORE:
|
|
||||||
zOp = "CAT_STORE ";
|
|
||||||
break;
|
|
||||||
case PH7_OP_SHL_STORE:
|
case PH7_OP_SHL_STORE:
|
||||||
zOp = "SHL_STORE ";
|
zOp = "SHL_STORE ";
|
||||||
break;
|
break;
|
||||||
|
@ -1310,7 +1310,6 @@ enum ph7_vm_op {
|
|||||||
PH7_OP_JZ, /* Jump on zero (FALSE jump) */
|
PH7_OP_JZ, /* Jump on zero (FALSE jump) */
|
||||||
PH7_OP_JNZ, /* Jump on non-zero (TRUE jump) */
|
PH7_OP_JNZ, /* Jump on non-zero (TRUE jump) */
|
||||||
PH7_OP_POP, /* Stack POP */
|
PH7_OP_POP, /* Stack POP */
|
||||||
PH7_OP_CAT, /* Concatenation */
|
|
||||||
PH7_OP_CVT_INT, /* Integer cast */
|
PH7_OP_CVT_INT, /* Integer cast */
|
||||||
PH7_OP_CVT_STR, /* String cast */
|
PH7_OP_CVT_STR, /* String cast */
|
||||||
PH7_OP_CVT_REAL, /* Float cast */
|
PH7_OP_CVT_REAL, /* Float cast */
|
||||||
@ -1357,7 +1356,6 @@ enum ph7_vm_op {
|
|||||||
PH7_OP_MUL_STORE, /* Mul and store '*=' */
|
PH7_OP_MUL_STORE, /* Mul and store '*=' */
|
||||||
PH7_OP_DIV_STORE, /* Div and store '/=' */
|
PH7_OP_DIV_STORE, /* Div and store '/=' */
|
||||||
PH7_OP_MOD_STORE, /* Mod and store '%=' */
|
PH7_OP_MOD_STORE, /* Mod and store '%=' */
|
||||||
PH7_OP_CAT_STORE, /* Cat and store '.=' */
|
|
||||||
PH7_OP_SHL_STORE, /* Shift left and store '>>=' */
|
PH7_OP_SHL_STORE, /* Shift left and store '>>=' */
|
||||||
PH7_OP_SHR_STORE, /* Shift right and store '<<=' */
|
PH7_OP_SHR_STORE, /* Shift right and store '<<=' */
|
||||||
PH7_OP_BAND_STORE, /* Bitand and store '&=' */
|
PH7_OP_BAND_STORE, /* Bitand and store '&=' */
|
||||||
@ -1407,7 +1405,6 @@ enum ph7_expr_id {
|
|||||||
EXPR_OP_MOD, /* Modulus */
|
EXPR_OP_MOD, /* Modulus */
|
||||||
EXPR_OP_ADD, /* Addition */
|
EXPR_OP_ADD, /* Addition */
|
||||||
EXPR_OP_SUB, /* Substraction */
|
EXPR_OP_SUB, /* Substraction */
|
||||||
EXPR_OP_DOT, /* Concatenation */
|
|
||||||
EXPR_OP_SHL, /* Left shift */
|
EXPR_OP_SHL, /* Left shift */
|
||||||
EXPR_OP_SHR, /* Right shift */
|
EXPR_OP_SHR, /* Right shift */
|
||||||
EXPR_OP_LT, /* Less than */
|
EXPR_OP_LT, /* Less than */
|
||||||
@ -1432,7 +1429,6 @@ enum ph7_expr_id {
|
|||||||
EXPR_OP_MUL_ASSIGN, /* Combined operator: *= */
|
EXPR_OP_MUL_ASSIGN, /* Combined operator: *= */
|
||||||
EXPR_OP_DIV_ASSIGN, /* Combined operator: /= */
|
EXPR_OP_DIV_ASSIGN, /* Combined operator: /= */
|
||||||
EXPR_OP_MOD_ASSIGN, /* Combined operator: %= */
|
EXPR_OP_MOD_ASSIGN, /* Combined operator: %= */
|
||||||
EXPR_OP_DOT_ASSIGN, /* Combined operator: .= */
|
|
||||||
EXPR_OP_AND_ASSIGN, /* Combined operator: &= */
|
EXPR_OP_AND_ASSIGN, /* Combined operator: &= */
|
||||||
EXPR_OP_OR_ASSIGN, /* Combined operator: |= */
|
EXPR_OP_OR_ASSIGN, /* Combined operator: |= */
|
||||||
EXPR_OP_XOR_ASSIGN, /* Combined operator: ^= */
|
EXPR_OP_XOR_ASSIGN, /* Combined operator: ^= */
|
||||||
|
Loading…
Reference in New Issue
Block a user