save
[protos/libecoli.git] / lib / ecoli_node_sh_lex.c
index 7b61c52..59b917f 100644 (file)
@@ -279,44 +279,37 @@ ec_node_sh_lex_parse(const struct ec_node *gen_node,
        return ret;
 }
 
-static struct ec_completed *ec_node_sh_lex_complete(const struct ec_node *gen_node,
-       const struct ec_strvec *strvec)
+static int
+ec_node_sh_lex_complete(const struct ec_node *gen_node,
+                       struct ec_completed *completed,
+                       struct ec_parsed *parsed,
+                       const struct ec_strvec *strvec)
 {
        struct ec_node_sh_lex *node = (struct ec_node_sh_lex *)gen_node;
-       struct ec_completed *completed, *child_completed = NULL;
        struct ec_strvec *new_vec = NULL;
        const char *str;
        char missing_quote;
-
-//     printf("==================\n");
-       completed = ec_completed();
-       if (completed == NULL)
-               return NULL;
+       int ret;
 
        if (ec_strvec_len(strvec) != 1)
-               return completed;
+               return 0;
 
        str = ec_strvec_val(strvec, 0);
        new_vec = tokenize(str, 1, 1, &missing_quote);
        if (new_vec == NULL)
                goto fail;
 
-//     ec_strvec_dump(new_vec, stdout);
-
-       child_completed = ec_node_complete_strvec(node->child, new_vec);
-       if (child_completed == NULL)
+       ret = ec_node_complete_child(node->child, completed, parsed, new_vec);
+       if (ret < 0)
                goto fail;
 
        ec_strvec_free(new_vec);
-       new_vec = NULL;
-       ec_completed_merge(completed, child_completed);
 
-       return completed;
+       return 0;
 
  fail:
        ec_strvec_free(new_vec);
-       ec_completed_free(completed);
-       return NULL;
+       return -1;
 }
 
 static void ec_node_sh_lex_free_priv(struct ec_node *gen_node)
@@ -354,6 +347,7 @@ struct ec_node *ec_node_sh_lex(const char *id, struct ec_node *child)
        return &node->gen;
 }
 
+/* LCOV_EXCL_START */
 static int ec_node_sh_lex_testcase(void)
 {
        struct ec_node *node;
@@ -445,6 +439,7 @@ static int ec_node_sh_lex_testcase(void)
        ec_node_free(node);
        return ret;
 }
+/* LCOV_EXCL_STOP */
 
 static struct ec_test ec_node_sh_lex_test = {
        .name = "node_sh_lex",