blob: 695dda2827d39e913ea266bc1b7473051e1884db (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
|
#ifndef COMMAND_MATCH_H
#define COMMAND_MATCH_H
#include "command_graph.h"
#include "linklist.h"
/**
* Filter types. These tell the parser whether to allow
* partial matching on tokens.
*/
enum filter_type
{
FILTER_RELAXED,
FILTER_STRICT
};
/**
* Command matcher result value.
*/
enum matcher_rv
{
MATCHER_OK,
MATCHER_COMPLETE,
MATCHER_INCOMPLETE,
MATCHER_NO_MATCH,
MATCHER_AMBIGUOUS,
MATCHER_EXCEED_ARGC_MAX
};
/* Completion match types. */
enum match_type
{
no_match,
partly_match,
exact_match
};
/**
* Defines which matcher_rv values constitute
* an error. Should be used against matcher_rv
* return values to do basic error checking.
*/
#define MATCHER_ERROR(matcher_rv) \
( (matcher_rv) == MATCHER_INCOMPLETE \
|| (matcher_rv) == MATCHER_NO_MATCH \
|| (matcher_rv) == MATCHER_AMBIGUOUS \
|| (matcher_rv) == MATCHER_EXCEED_ARGC_MAX \
)
struct list *
match_command (struct graph_node *, enum filter_type, const char *);
#endif
|