EC_PARSE_STRVEC(3)

NAME
ec_parse_strvec - Parse a string vector using a grammar tree.

SYNOPSIS
#include <ecoli/parse.h>

struct ec_pnode * ec_parse_strvec(
    const struct ec_node     *node,    /* The grammar node. */
    const struct ec_strvec   *strvec   /* The input string vector. */
);

DESCRIPTION

Generate a parsing tree by parsing the input string vector using the given grammar tree.

The parsing tree is composed of ec_pnode, and each of them is associated with a ec_node (the grammar node), to the string vector that matched the subtree, and to optional attributes.

When the input matches the grammar tree, the string vector associated to the root node of the returned parsing tree is the same than the strvec argument. Calling ec_pnode_matches() on this tree returns true.

If the input does not match the grammar tree, the returned parsing tree only contains one root node, with no associated string vector. Calling ec_pnode_matches() on this tree returns false.

RETURN VALUE

A parsing tree, or NULL on error (errno is set).

SEE ALSO

ec_pnode_len(3), ec_pnode_get_strvec(3), ec_parse(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), ec_parse_child(3)

COPYRIGHT

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