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