ecoli_node_expr(3)
π ecoli_node_expr(3) β Expression node π
okay so bestie, welcome to the Libecoli manual. This is the ecoli_node_expr(3) page, and it's literally the expression node: a node for parsing and evaluating expressions with operators. it's giving parser/evaluator main-character energy, no cap. π«Ά
πΈ NAME πΈ
ecoli_node_expr β Expression node
- A node for parsing and evaluating expressions with operators.
β¨ SYNOPSIS β¨
π Data Structures
struct ec_node_expr_eval_ops
π§ Typedefs
okay so here are the callback typedefs, verbatim, because we do not mess with signatures in this group chat:
typedef int(* ec_node_expr_eval_var_t) (void **result, void *userctx, const struct ec_pnode *var)
typedef int(* ec_node_expr_eval_pre_op_t) (void **result, void *userctx, void *operand, const struct ec_pnode *operator)
typedef int(* ec_node_expr_eval_post_op_t) (void **result, void *userctx, void *operand, const struct ec_pnode *operator)
typedef int(* ec_node_expr_eval_bin_op_t) (void **result, void *userctx, void *operand1, const struct ec_pnode *operator, void *operand2)
typedef int(* ec_node_expr_eval_parenthesis_t) (void **result, void *userctx, const struct ec_pnode *open_paren, const struct ec_pnode *close_paren, void *value)
typedef void(* ec_node_expr_eval_free_t) (void *result, void *userctx)
π¦ Functions
struct ec_node * ec_node_expr (const char *id)
int ec_node_expr_set_val_node (struct ec_node *gen_node, struct ec_node *val_node)
int ec_node_expr_add_bin_op (struct ec_node *gen_node, struct ec_node *op)
int ec_node_expr_add_pre_op (struct ec_node *gen_node, struct ec_node *op)
int ec_node_expr_add_post_op (struct ec_node *gen_node, struct ec_node *op)
int ec_node_expr_add_parenthesis (struct ec_node *gen_node, struct ec_node *open, struct ec_node *close)
int ec_node_expr_eval (void **result, const struct ec_node *node, struct ec_pnode *parse, const struct ec_node_expr_eval_ops *ops, void *userctx)
π¦ Detailed Description π¦
A node for parsing and evaluating expressions with operators.
π Configuration Schema
No configuration schema. periodt.
π Typedef Documentation π
π ec_node_expr_eval_var_t β evaluating a variable
typedef int(* ec_node_expr_eval_var_t) (void **result, void *userctx, const struct ec_pnode *var)
Callback function type for evaluating a variable.
π Parameters
resultβ on success, you have to set this pointer to point at a user structure describing the evaluated result.userctxβ a user-defined context passed to all callback functions; it can be used to maintain a state or store global information.varβ the parse result referencing the variable.
β¨ Returns
0 on success (*result must be set), or -errno on error (*result is undefined).
Definition at line 32 of file node_expr.h.
π ec_node_expr_eval_pre_op_t β evaluating a prefix-operator
typedef int(* ec_node_expr_eval_pre_op_t) (void **result, void *userctx, void *operand, const struct ec_pnode *operator)
Callback function type for evaluating a prefix-operator.
π Parameters
resultβ on success, this pointer must be set by the user to point to a user structure describing the evaluated result.userctxβ a user-defined context passed to all callback functions, which can be used to maintain a state or store global information.operandβ the evaluated expression on which the operation should be applied.operatorβ the parse result referencing the operator.
β¨ Returns
0 on success (*result must be set, operand is freed), or -errno on error (*result is undefined, operand is not freed).
Definition at line 51 of file node_expr.h.
π ec_node_expr_eval_post_op_t β evaluating a postfix-operator
typedef int(* ec_node_expr_eval_post_op_t) (void **result, void *userctx, void *operand, const struct ec_pnode *operator)
Callback function type for evaluating a postfix-operator.
Same as ec_node_expr_eval_pre_op_t but for postfix operators.
Definition at line 63 of file node_expr.h.
π ec_node_expr_eval_bin_op_t β evaluating a binary operator
typedef int(* ec_node_expr_eval_bin_op_t) (void **result, void *userctx, void *operand1, const struct ec_pnode *operator,void *operand2)
Callback function type for evaluating a binary operator.
π Parameters
resultβ on success, this pointer must be set by the user to point to a user structure describing the evaluated result.userctxβ a user-defined context passed to all callback functions.operand1β the evaluated left operand.operatorβ the parse result referencing the operator.operand2β the evaluated right operand.
β¨ Returns
0 on success (*result must be set, operands are freed), or -errno on error (*result is undefined, operands are not freed).
Definition at line 88 of file node_expr.h.
π ec_node_expr_eval_parenthesis_t β evaluating a parenthesized expression
typedef int(* ec_node_expr_eval_parenthesis_t) (void **result, void *userctx, const struct ec_pnode *open_paren, const struct ec_pnode *close_paren, void *value)
Callback function type for evaluating a parenthesized expression.
π Parameters
resultβ on success, this pointer must be set by the user to point to a user structure describing the evaluated result.userctxβ a user-defined context passed to all callback functions.open_parenβ the parse result referencing the opening parenthesis.close_parenβ the parse result referencing the closing parenthesis.valueβ the evaluated expression inside the parentheses.
β¨ Returns
0 on success (*result must be set, value is freed), or -errno on error (*result is undefined, value is not freed).
Definition at line 114 of file node_expr.h.
π ec_node_expr_eval_free_t β freeing an evaluated result
typedef void(* ec_node_expr_eval_free_t) (void *result, void *userctx)
Callback function type for freeing an evaluated result.
π Parameters
resultβ the result to free.userctxβ a user-defined context passed to all callback functions.
Definition at line 130 of file node_expr.h.
π₯ Function Documentation π₯
π ec_node_expr β create an expression node
struct ec_node* ec_node_expr (const char * id)
Create an expression node.
π Parameters
idβ the node identifier.
β¨ Returns
The node, or NULL on error (errno is set).
π ec_node_expr_set_val_node β set the value (terminal) node
int ec_node_expr_set_val_node (struct ec_node * gen_node, struct ec_node * val_node)
Set the value (terminal) node for an expression.
π Parameters
gen_nodeβ the expression node.val_nodeβ the node matching values. It is consumed and will be freed when the parent is freed, or immediately on error.
β¨ Returns
0 on success, -1 on error (errno is set).
π ec_node_expr_add_bin_op β add a binary operator
int ec_node_expr_add_bin_op (struct ec_node * gen_node, struct ec_node * op)
Add a binary operator to an expression node.
π Parameters
gen_nodeβ the expression node.opβ the operator node. It is consumed and will be freed when the parent is freed, or immediately on error.
β¨ Returns
0 on success, -1 on error (errno is set).
π ec_node_expr_add_pre_op β add a prefix operator
int ec_node_expr_add_pre_op (struct ec_node * gen_node, struct ec_node * op)
Add a prefix operator to an expression node.
π Parameters
gen_nodeβ the expression node.opβ the operator node. It is consumed and will be freed when the parent is freed, or immediately on error.
β¨ Returns
0 on success, -1 on error (errno is set).
π ec_node_expr_add_post_op β add a postfix operator
int ec_node_expr_add_post_op (struct ec_node * gen_node, struct ec_node * op)
Add a postfix operator to an expression node.
π Parameters
gen_nodeβ the expression node.opβ the operator node. It is consumed and will be freed when the parent is freed, or immediately on error.
β¨ Returns
0 on success, -1 on error (errno is set).
π ec_node_expr_add_parenthesis β add parentheses
int ec_node_expr_add_parenthesis (struct ec_node * gen_node, struct ec_node * open, struct ec_node * close)
Add parentheses to an expression node.
π Parameters
gen_nodeβ the expression node.openβ the opening parenthesis node. It is consumed and will be freed when the parent is freed, or immediately on error.closeβ the closing parenthesis node. It is consumed and will be freed when the parent is freed, or immediately on error.
β¨ Returns
0 on success, -1 on error (errno is set).
π ec_node_expr_eval β evaluate a parsed expression
int ec_node_expr_eval (void ** result, const struct ec_node * node, struct ec_pnode * parse, const struct ec_node_expr_eval_ops * ops, void * userctx)
Evaluate a parsed expression.
π Parameters
resultβ on success, this pointer will be set to the evaluated result.nodeβ the expression node.parseβ the parse tree to evaluate.opsβ the evaluation callbacks.userctxβ a user-defined context passed to all callbacks.
β¨ Returns
0 on success, -1 on error (errno is set).
π Author π
Generated automatically by Doxygen for Libecoli from the source code.
Version0.11.3Β·Thu Apr 9 2026Β· Libecoli Β·ecoli_node_expr(3)β that's the footer, bestie, bye π
π¦ where this page comes from
- epel 9: libecoli-devel 0.11.3-1.el9 Β· BSD-3-Clause AND LicenseRef-Fedora-Public-Domain
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms