EC_PARSE_CHILD(3)
π EC_PARSE_CHILD β bestie edition π
okay so we're in the Libecoli Programmer's Manual today, section 3, and the star of the show is ec_parse_child. grab a lil snack, this one's a bop π
β¨ NAME β¨
ec_parse_child β parse a string vector using a grammar tree, from a parent node.
it's giving "the middle-manager of parsing" and honestly? iconic behavior π
πΈ 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. */
);
three arguments, no drama, we love a clean signature π«Ά
π¦ DESCRIPTION π¦
so here's the vibe. this function is usually called from an intermediate node β think ec_node_seq(), ec_node_or(), you know the ones β and its whole job is to backfill the parsing tree. that tree gets built piece by piece while you're browsing the grammar tree, like a lil puzzle π§©
and like, here's what actually goes down: ec_parse_child() creates a new child in this parsing tree, and then it calls the parse() method for that child node, with pstate pointing to this new child.
then the moment of truth:
- if it does not match, the child gets removed from the state π
- if it matches, the child is kept, along with its possible descendants π
that's it. that's the whole function. no cap.
β RETURN VALUE β
okay bestie, pay attention, this part matters:
- On success: the number of matched elements in the input string vector β and yes, that can totally be
0, zero is a valid slay β orEC_PARSE_NOMATCH(which is a positive value) if the input does not match the grammar. - On error:
-1is returned, anderrnois set. π
lowkey important: EC_PARSE_NOMATCH is positive, so don't go treating it like an error code. it's just the grammar saying "nope, not today."
π₯ SEE ALSO π₯
the whole friend group, fr fr β go read these next:
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.
and that's the whole page, bestie π this has been EC_PARSE_CHILD(3) from libecoli, dated 2026-06-11 β thanks for coming to my ted talk, go forth and parse responsibly, mwah π
β¨ππ
π¦ where this page comes from
- fedora 44: libecoli-devel 0.11.7-1.fc44 Β· BSD-3-Clause AND LicenseRef-Fedora-Public-Domain
- fedora 44: libecoli-devel 0.11.7-1.fc44 Β· BSD-3-Clause AND LicenseRef-Fedora-Public-Domain
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms