Loading...
Searching...
No Matches
Sequence node
Grammar nodes

A node that matches a sequence of child nodes in order. More...

Collaboration diagram for Sequence node:

## Macros

#define | EC_NODE_SEQ(args...)
| Create a sequence node from a list of child nodes.

## Functions

struct ec_node * | ec_node_seq (const char *id)
| Create an empty sequence node.
int | ec_node_seq_add (struct ec_node *node, struct ec_node *child)
| Add a child to a sequence node.

## Detailed Description

A node that matches a sequence of child nodes in order.

Configuration Schema

schema seq {
list children {
description "The list of children nodes, to be parsed in sequence.";
node {
description "A child node which is part of the sequence.";
}
}
}

## Macro Definition Documentation

## EC_NODE_SEQ

#define EC_NODE_SEQ | ( |  | args... | ) |

Value:
__ec_node_seq(args, EC_VA_END)
EC_VA_END
#define EC_VA_END
Mark the end of the arguments list in some functions.
Definition utils.h:26

Create a sequence node from a list of child nodes.

All child nodes passed as arguments are consumed and will be freed when the sequence node is freed, or immediately on error.

Example:

EC_NODE_SEQ("myseq", child1, child2, child3)
EC_NODE_SEQ
#define EC_NODE_SEQ(args...)
Create a sequence node from a list of child nodes.
Definition node_seq.h:29

Examples
  extension-editline/main.c, pool-editline/main.c, readline/main.c, and simple-editline/main.c.

Definition at line 29 of file node_seq.h.

## Function Documentation

## ec_node_seq()

struct ec_node * ec_node_seq | ( | const char * | id | ) |

Create an empty sequence node.

Use ec_node_seq_add() to add children.

Parameters

  id | The node identifier.

Returns
  The node, or NULL on error (errno is set).

## ec_node_seq_add()

int ec_node_seq_add | ( | struct ec_node * | node,
|  | struct ec_node * | child )

Add a child to a sequence node.

Parameters

  node | The sequence node.
  child | The child node to add. 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).