EC_NODE_ONCE(3)

NAME
ec_node_once - This node behaves like its child, but prevents it from being parsed more than once.

SYNOPSIS
#include <ecoli/node_once.h>

struct ec_node * ec_node_once(
    const char       *id,
    struct ec_node   *child
);

DESCRIPTION

Example:

many(
  or(
    once(str("foo")),
    str("bar")))

Matches: [], ["foo", "bar"], ["bar", "bar"], ["foo", "bar", "bar"], ... But not: ["foo", "foo"], ["foo", "bar", "foo"], ...

On error, the child is not freed.

SEE ALSO

ec_node_once_set_child(3)

COPYRIGHT

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