This commit is contained in:
parent
0b04e0f7c5
commit
929d7b83fe
@ -752,37 +752,6 @@ static sxi32 PH7_GenStateCompileArrayEntry(
|
|||||||
RE_SWAP_DELIMITER(pGen);
|
RE_SWAP_DELIMITER(pGen);
|
||||||
return rc;
|
return rc;
|
||||||
}
|
}
|
||||||
/*
|
|
||||||
* Expression tree validator callback for the 'array' language construct.
|
|
||||||
* Return SXRET_OK if the tree is valid. Any other return value indicates
|
|
||||||
* an invalid expression tree and this function will generate the appropriate
|
|
||||||
* error message.
|
|
||||||
* See the routine responsible of compiling the array language construct
|
|
||||||
* for more inforation.
|
|
||||||
*/
|
|
||||||
static sxi32 PH7_GenStateArrayNodeValidator(ph7_gen_state *pGen, ph7_expr_node *pRoot) {
|
|
||||||
sxi32 rc = SXRET_OK;
|
|
||||||
if(pRoot->pOp) {
|
|
||||||
if(pRoot->pOp->iOp != EXPR_OP_SUBSCRIPT /* $a[] */ &&
|
|
||||||
pRoot->pOp->iOp != EXPR_OP_FUNC_CALL /* function() [Symisc extension: i.e: array(&foo())] */
|
|
||||||
&& pRoot->pOp->iOp != EXPR_OP_ARROW /* -> */ && pRoot->pOp->iOp != EXPR_OP_DC /* :: */) {
|
|
||||||
/* Unexpected expression */
|
|
||||||
rc = PH7_GenCompileError(&(*pGen), E_ERROR, pRoot->pStart ? pRoot->pStart->nLine : 0,
|
|
||||||
"array(): Expecting a variable/array member/function call after reference operator '&'");
|
|
||||||
if(rc != SXERR_ABORT) {
|
|
||||||
rc = SXERR_INVALID;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} else if(pRoot->xCode != PH7_CompileVariable) {
|
|
||||||
/* Unexpected expression */
|
|
||||||
rc = PH7_GenCompileError(&(*pGen), E_ERROR, pRoot->pStart ? pRoot->pStart->nLine : 0,
|
|
||||||
"array(): Expecting a variable after reference operator '&'");
|
|
||||||
if(rc != SXERR_ABORT) {
|
|
||||||
rc = SXERR_INVALID;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return rc;
|
|
||||||
}
|
|
||||||
/*
|
/*
|
||||||
* Compile the 'array' language construct.
|
* Compile the 'array' language construct.
|
||||||
* An array in Aer is actually an ordered map. A map is a type that associates
|
* An array in Aer is actually an ordered map. A map is a type that associates
|
||||||
@ -864,36 +833,6 @@ PH7_PRIVATE sxi32 PH7_CompileArray(ph7_gen_state *pGen, sxi32 iCompileFlag) {
|
|||||||
/* Node successfully compiled */
|
/* Node successfully compiled */
|
||||||
return SXRET_OK;
|
return SXRET_OK;
|
||||||
}
|
}
|
||||||
/*
|
|
||||||
* Expression tree validator callback for the 'list' language construct.
|
|
||||||
* Return SXRET_OK if the tree is valid. Any other return value indicates
|
|
||||||
* an invalid expression tree and this function will generate the appropriate
|
|
||||||
* error message.
|
|
||||||
* See the routine responsible of compiling the list language construct
|
|
||||||
* for more inforation.
|
|
||||||
*/
|
|
||||||
static sxi32 PH7_GenStateListNodeValidator(ph7_gen_state *pGen, ph7_expr_node *pRoot) {
|
|
||||||
sxi32 rc = SXRET_OK;
|
|
||||||
if(pRoot->pOp) {
|
|
||||||
if(pRoot->pOp->iOp != EXPR_OP_SUBSCRIPT /* $a[] */ && pRoot->pOp->iOp != EXPR_OP_ARROW /* -> */
|
|
||||||
&& pRoot->pOp->iOp != EXPR_OP_DC /* :: */) {
|
|
||||||
/* Unexpected expression */
|
|
||||||
rc = PH7_GenCompileError(&(*pGen), E_ERROR, pRoot->pStart ? pRoot->pStart->nLine : 0,
|
|
||||||
"list(): Expecting a variable not an expression");
|
|
||||||
if(rc != SXERR_ABORT) {
|
|
||||||
rc = SXERR_INVALID;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} else if(pRoot->xCode != PH7_CompileVariable) {
|
|
||||||
/* Unexpected expression */
|
|
||||||
rc = PH7_GenCompileError(&(*pGen), E_ERROR, pRoot->pStart ? pRoot->pStart->nLine : 0,
|
|
||||||
"list(): Expecting a variable not an expression");
|
|
||||||
if(rc != SXERR_ABORT) {
|
|
||||||
rc = SXERR_INVALID;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return rc;
|
|
||||||
}
|
|
||||||
/*
|
/*
|
||||||
* Compile a closure (anonymous function).
|
* Compile a closure (anonymous function).
|
||||||
* Closures (also known as anonymous functions), allow the creation of functions
|
* Closures (also known as anonymous functions), allow the creation of functions
|
||||||
|
Loading…
Reference in New Issue
Block a user