Libecoli 0.11.1
Extensible COmmand LIne library
Loading...
Searching...
No Matches
Many node

A node that matches its child multiple times. More...

Functions

struct ec_nodeec_node_many (const char *id, struct ec_node *child, unsigned int min, unsigned int max)
int ec_node_many_set_params (struct ec_node *gen_node, struct ec_node *child, unsigned int min, unsigned int max)

Detailed Description

A node that matches its child multiple times.

Configuration Schema

schema many {
node child {
description "The child node.";
}
uint64 min {
description "The minimum number of matches (default = 0).";
}
uint64 max {
description "The maximum number of matches. If 0, there is no maximum (default = 0).";
}
}

Function Documentation

◆ ec_node_many()

struct ec_node * ec_node_many ( const char * id,
struct ec_node * child,
unsigned int min,
unsigned int max )

Create a many node that matches its child multiple times.

Parameters
idThe node identifier.
childThe child node. It is consumed and will be freed when the parent is freed, or immediately on error.
minMinimum number of repetitions. Use 0 for no minimum.
maxMaximum number of repetitions. Use 0 for no maximum.
Returns
The node, or NULL on error (errno is set).
Examples
readline/main.c.

◆ ec_node_many_set_params()

int ec_node_many_set_params ( struct ec_node * gen_node,
struct ec_node * child,
unsigned int min,
unsigned int max )

Set the parameters of a many node.

Parameters
gen_nodeThe many node.
childThe child node. It is consumed and will be freed when the parent is freed, or immediately on error.
minMinimum number of repetitions. Use 0 for no minimum.
maxMaximum number of repetitions. Use 0 for no maximum.
Returns
0 on success, -1 on error (errno is set).