34#define EC_INTERACT_HELP_ATTR "_help"
39#define EC_INTERACT_CB_ATTR "_cb"
44#define EC_INTERACT_DESC_ATTR "_desc"
struct ec_comp * ec_comp(void)
Create an empty completion object (list of completion items).
ec_comp_type
Completion item type.
ssize_t ec_interact_get_error_helps(const struct ec_node *node, const char *line, struct ec_interact_help **helps_out, size_t *char_idx)
Get suggestions after a parsing error for the current line.
int(* ec_interact_command_cb_t)(const struct ec_pnode *)
Type of callback attached with EC_INTERACT_CB_ATTR attribute.
int ec_interact_print_error_helps(FILE *out, unsigned int width, const char *line, const struct ec_interact_help *helps, size_t n, size_t char_idx)
Print suggestions generated with ec_interact_get_error_helps().
int ec_interact_set_help(struct ec_node *node, const char *help)
Set help on a grammar node.
int ec_interact_print_helps(FILE *out, unsigned int width, const struct ec_interact_help *helps, size_t n)
Print helps generated with ec_interact_get_helps().
int ec_interact_set_desc(struct ec_node *node, const char *desc)
Set short description of a grammar node.
ssize_t ec_interact_get_completions(const struct ec_comp *cmpl, char ***matches_out, enum ec_comp_type type_mask)
Get completion matches as an array of strings.
ssize_t ec_interact_get_helps(const struct ec_node *node, const char *line, struct ec_interact_help **helps_out)
Get contextual helps from the current line.
int ec_interact_set_callback(struct ec_node *node, ec_interact_command_cb_t cb)
Set callback function on a grammar node.
ec_interact_command_cb_t ec_interact_get_callback(struct ec_pnode *parse)
Get callback attached to a parse tree.
int ec_interact_print_cols(FILE *out, unsigned int width, char const *const *matches, size_t n)
Print completion matches as columns.
char * ec_interact_append_chars(const struct ec_comp *cmpl)
Get characters to append to the line for a completion.
void ec_interact_free_helps(struct ec_interact_help *helps, size_t n)
Free contextual helps.
void ec_interact_free_completions(char **matches, size_t n)
Free the array of completion matches.
struct ec_node * ec_node(const char *typename, const char *id)
Create a new node from its type name.
struct ec_pnode * ec_pnode(const struct ec_node *node)
Create an empty parsing tree.
A structure describing a contextual help.