4 X evaluate expression tree in ec_tk_expr
12 X ec_completed_item_update()
13 X ec_completed_item_set_display_value()
17 X properly manage quotes in shlex
18 X remove the _new() functions
19 X iterate children nodes without chaining them
20 - add a node vector type: will be used in several nodes (ex: or, seq, ...)
21 - check allocation model everywhere
23 - use linux style (update .emacs)
25 - check return values (-1 or NULL) + use errno
26 - check missing static / const
28 - check all completion nodes
30 - size_t or unsigned int?
33 X ec_parsed_tk -> ec_parsed
34 X ec_completed_tk -> ec_completed
35 X tk, gen_tk, token, ... -> node
36 X tokens -> input_str / input_strvec ?
37 X save node path in completion to fix help string
39 - try to hide structures
40 - anything better than weakref?
41 - add ec_node_defaults.[ch] providing usual implementations of node methods
43 - ELOOP in case of loop
45 - sh_lex to provide offsets in attributes
50 X pass the current parsed state when parsing/completing
52 - new node "condition"
62 X register nodes by name
63 - interface to add attributes: all nodes must be configurable through a
71 - yaml interface to create nodes
77 - example which parses arguments (argc/argv)
78 - example that acts as bash completion (ip link ?)
79 - calculator example (var assignation, expression evaluation)
80 - example with libedit
81 - mini script language
83 - mini shell: cd, ls, cat, stat
84 - mini network console based on ip
91 - generate automatic api doc
93 - coding rules, process
96 - say that it stops at first match (no ambigous support)
97 - say that completion must be exhaustive
103 - split libs, tests and examples
111 - complete automatic tests with "make test"
117 - node which always matches
118 - file + partial completion
120 - fusion node: need to match several children, same for completion
127 - support utf-8 and other encodings
134 - demonstration example that parses yang file and generate cli
138 -----------------------
142 [tab] list possible completions (matches/partial only)
143 [?] list what is expected, example:
145 "command [foo] toto|titi|<int>"
161 - ec_node: a node that can be parsed/completed
162 - ec_parse: a tree describing the result of parse(node, input)
163 - ec_comp: a list describing the result of complete(node, input)
183 parse() returns a tree
186 - each node of the tree refers to a ec_node
187 - each node points to the strvec that matches
188 - parse returns the first matching solution
189 - usually try to match as many str in the vecs (seq node)
197 The parse cb of the node is:
199 parse_cb(node, current_parse_state, strvec, *nmatch)
202 - 0: success, child->strvec is set by node (NULL = no_match)
203 - -1: error (errno is set)
204 maybe complex to use:
205 - the node must set the match (ex: "return ec_parsed_node_match()")
206 - the caller must use accessor to check if it matches or not
208 alternative idea for return values:
209 - >= 0: match, ret == nb_tk
210 - -1: error (errno is set)
211 - -2 or MAX_INT: success, but no match
212 This is strange to have a specific value for no match
213 With MAX_INT, this is the best (less bad) alternative
215 alternative idea for return values:
216 - ec_parse_result_match(n_tokens >= 0)
217 - ec_parse_result_nomatch()
218 - ec_parse_result_error(errno)
220 A node always try to consume the maximum number of tokens.
228 [foo, foo, bar] matches
229 [foo, bar] does *not* match
231 complete() returns a list of possible completions
235 - partial completion: in a path dir/file, completion stops once
237 - displayed value is not the completion token: when completing a
238 file in several subdirectories, the full path is not displayed
239 - any parent node can modify the completions, ex: add missing quotes
240 in ec_node_sh_lex(), filter completions in case of a ec_node_filter()
241 - a command line may want to display the help from the most specific
243 - some specific nodes can complete several tokens
247 type: full, partial, unknown
250 full: the completion item matches token
251 partial: beginning of a completion, does not match the token
252 (good example is a directory in a path)
253 unknown: could complete, but the node does not know how
255 struct completion_item {
260 struct completed_elt {
261 ec_parsed *parse_tree; // current tree state
262 ec_node *last; // last node of the tree
263 list of items; // list of items for this parse tree
272 complete_cb(node, current_complete_state, current_parse_state, strvec)
274 - 0 = success, the current complete state is updated
275 - -1 = error (set errno?)
278 a node can filter the completions
315 - a completion item should contain a strvec for the value
316 (the display string remains a string)
317 - there is maybe no good reason to split in:
318 - ec_completed_item()
319 - ec_completed_item_set()
320 - ec_completed_item_set_display()
321 - ec_completed_item_add()
331 complete(sh_lex, ["'fo"])
332 complete(sh_lex, ["fo"]) -> ["foo", "foo2"]
345 static inline bool is_success(struct res r)
353 static inline struct res res(int a)
368 printf("success: %d\n", r.a);
374 printf("success: %d\n", r.a);
397 prod = term ( "*" term )*
398 sum = prod ( "+" prod )*
407 # or: b debug_realloc
408 condition <breakoint num> malloc_seq >= <value>
413 condition <watchpoint num> malloc_seq == <value + 1>