ecoli_node_expr(3)

πŸ“¦
version 0.11.3 Β· 2 versions
, in epel 9

πŸ’– 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.


Version 0.11.3 Β· Thu Apr 9 2026 Β· Libecoli Β· ecoli_node_expr(3) β€” that's the footer, bestie, bye πŸ’‹
πŸ“¦ where this page comes from