From fa5c2e1f5e90cdce0a16c80878941e849f6b851f Mon Sep 17 00:00:00 2001 From: belliash Date: Fri, 7 Jun 2019 10:11:30 +0200 Subject: [PATCH] Parse the OP_IS instruction. --- engine/parser.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/engine/parser.c b/engine/parser.c index e5866a7..7df565e 100644 --- a/engine/parser.c +++ b/engine/parser.c @@ -1056,6 +1056,15 @@ static sxi32 ExprMakeTree(ph7_gen_state *pGen, ph7_expr_node **apNode, sxi32 nTo iTmp = iRight; iRight = iLeft; iLeft = iTmp; + } else if(pNode->pOp->iOp == EXPR_OP_IS) { + sxu32 nKwrd = 0; + if(apNode[iRight]->pStart->nType == PH7_TK_KEYWORD) { + nKwrd = SX_PTR_TO_INT(apNode[iRight]->pStart->pUserData); + if(nKwrd && (nKwrd & PH7_KEYWORD_TYPEDEF) == 0) { + PH7_GenCompileError(pGen, E_ERROR, pNode->pStart->nLine, + "'%z': Unexpected keyword '%z'", &pNode->pOp->sOp, &apNode[iRight]->pStart->sData); + } + } } /* Link the node to the tree */ pNode->pLeft = apNode[iLeft];