};
static unsigned int
-count_node(struct ec_parse *parse, const struct ec_node *node)
+count_node(struct ec_pnode *parse, const struct ec_node *node)
{
- struct ec_parse *child;
+ struct ec_pnode *child;
unsigned int count = 0;
if (parse == NULL)
return 0;
- if (ec_parse_get_node(parse) == node)
+ if (ec_pnode_get_node(parse) == node)
count++;
- EC_PARSE_FOREACH_CHILD(child, parse)
+ EC_PNODE_FOREACH_CHILD(child, parse)
count += count_node(child, node);
return count;
static int
ec_node_once_parse(const struct ec_node *node,
- struct ec_parse *state,
+ struct ec_pnode *state,
const struct ec_strvec *strvec)
{
struct ec_node_once *priv = ec_node_priv(node);
/* count the number of occurences of the node: if already parsed,
* do not match
*/
- count = count_node(ec_parse_get_root(state), priv->child);
+ count = count_node(ec_pnode_get_root(state), priv->child);
if (count > 0)
return EC_PARSE_NOMATCH;
- return ec_node_parse_child(priv->child, state, strvec);
+ return ec_parse_child(priv->child, state, strvec);
}
static int
const struct ec_strvec *strvec)
{
struct ec_node_once *priv = ec_node_priv(node);
- struct ec_parse *parse = ec_comp_get_state(comp);
+ struct ec_pnode *parse = ec_comp_get_state(comp);
unsigned int count;
int ret;
/* count the number of occurences of the node: if already parsed,
* do not match
*/
- count = count_node(ec_parse_get_root(parse), priv->child);
+ count = count_node(ec_pnode_get_root(parse), priv->child);
if (count > 0)
return 0;
- ret = ec_node_complete_child(priv->child, comp, strvec);
+ ret = ec_complete_child(priv->child, comp, strvec);
if (ret < 0)
return ret;
testres |= EC_TEST_CHECK_PARSE(node, 0, "foox");
testres |= EC_TEST_CHECK_COMPLETE(node,
- "", EC_NODE_ENDLIST,
- "foo", "bar", EC_NODE_ENDLIST);
+ "", EC_VA_END,
+ "foo", "bar", EC_VA_END);
testres |= EC_TEST_CHECK_COMPLETE(node,
- "f", EC_NODE_ENDLIST,
- "foo", EC_NODE_ENDLIST);
+ "f", EC_VA_END,
+ "foo", EC_VA_END);
testres |= EC_TEST_CHECK_COMPLETE(node,
- "b", EC_NODE_ENDLIST,
- "bar", EC_NODE_ENDLIST);
+ "b", EC_VA_END,
+ "bar", EC_VA_END);
testres |= EC_TEST_CHECK_COMPLETE(node,
- "foo", "", EC_NODE_ENDLIST,
- "bar", EC_NODE_ENDLIST);
+ "foo", "", EC_VA_END,
+ "bar", EC_VA_END);
testres |= EC_TEST_CHECK_COMPLETE(node,
- "bar", "", EC_NODE_ENDLIST,
- "foo", "bar", EC_NODE_ENDLIST);
+ "bar", "", EC_VA_END,
+ "foo", "bar", EC_VA_END);
ec_node_free(node);
return testres;