From 879940dee9ce56a05ea60a2c2777315be32841bb Mon Sep 17 00:00:00 2001 From: Filleo Date: Mon, 3 Jun 2024 19:42:58 +0200 Subject: [PATCH] midway of creating Bit Operation in expression --- src/set/set.c | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/src/set/set.c b/src/set/set.c index 3fda6a3..5c73209 100644 --- a/src/set/set.c +++ b/src/set/set.c @@ -489,7 +489,21 @@ int createBoolNotOperation(Expression *ParentExpression, AST_NODE_PTR currentNod return 0; } +int createBitOperation(Expression* ParentExpression, AST_NODE_PTR currentNode){ + //fill kind and Nodeptr + ParentExpression->impl.operation.kind = Boolean; + ParentExpression->impl.operation.nodePtr = currentNode; + //fill Operands + for (size_t i = 0; i < currentNode->child_count; i++){ + Expression* expression = createExpression(currentNode->children[i]); + if(NULL == expression){ + return 1; + } + g_array_append_val(ParentExpression->impl.operation.operands , expression); + } + +} Expression *createExpression(AST_NODE_PTR currentNode){ @@ -563,6 +577,10 @@ Expression *createExpression(AST_NODE_PTR currentNode){ case AST_BitAnd: case AST_BitOr: case AST_BitXor: + expression->kind= ExpressionKindOperation; + if(createBitOperation(expression, currentNode)){ + return NULL; + } case AST_BitNot: