EC_PARSE_CHILD(3)

NAME
ec_parse_child - Parse a string vector using a grammar tree, from a parent node.

SYNOPSIS
#include <ecoli/parse.h>

int ec_parse_child(
    const struct ec_node     *node,    /* The grammar node. */
    struct ec_pnode          *pstate,  /* The node of the parsing tree. */
    const struct ec_strvec   *strvec   /* The input string vector. */
);

DESCRIPTION

This function is usually called from an intermediate node (like ec_node_seq(), ec_node_or(), ...) to backfill the parsing tree, which is built piece by piece while browsing the grammar tree.

ec_parse_child() creates a new child in this parsing tree, and calls the parse() method for the child node, with pstate pointing to this new child. If it does not match, the child is removed in the state, else it is kept, with its possible descendants.

RETURN VALUE

On success: the number of matched elements in the input string vector (which can be 0), or EC_PARSE_NOMATCH (which is a positive value) if the input does not match the grammar. On error, -1 is returned, and errno is set.

SEE ALSO

ec_pnode_len(3), ec_pnode_get_strvec(3), ec_parse(3), ec_parse_strvec(3), ec_pnode(3), ec_pnode_free_children(3), ec_pnode_get_root(3), ec_pnode_get_parent(3), ec_pnode_find_next(3), ec_pnode_get_first_child(3), ec_pnode_free(3), ec_pnode_dup(3), ec_pnode_matches(3), ec_pnode_dump(3), ec_pnode_unlink_child(3), ec_pnode_next(3), ec_pnode_del_last_child(3), ec_pnode_link_child(3), ec_pnode_count(3), ec_pnode_get_attrs(3), ec_pnode_get_last_child(3), ec_pnode_get_node(3), ec_pnode_find(3),

COPYRIGHT

Copyright (C) 2010-2026 Olivier Matz, Robin Jarry.