Mon, 24 Jul 2000 16:38:12 +0200
trunk: changeset 22
Fixed a bug with OPT_NO_DASH
5 | 1 | /* |
2 | * libtu/parser.h | |
3 | * | |
9 | 4 | * Copyright (c) Tuomo Valkonen 1999-2000. |
5 | 5 | * See the included file LICENSE for details. |
6 | */ | |
7 | ||
8 | 8 | #ifndef LIBTU_PARSER_H |
9 | #define LIBTU_PARSER_H | |
5 | 10 | |
11 | #include "tokenizer.h" | |
12 | ||
13 | /* | |
14 | * format: | |
15 | * l = long | |
16 | * d = double | |
17 | * i = identifier | |
18 | * s = string | |
19 | * c = char | |
20 | * . = 1 times any ("l.d") | |
21 | * * = 0 or more times any (must be the last, "sd*") | |
22 | * ? = optional ("?c") | |
23 | * : = conditional (":c:s") | |
24 | * + = 1 or more times last (most be the last, "l+") | |
25 | * special entries: | |
26 | * | |
27 | * "#end" call this handler at the end of section. | |
28 | * "#cancel" call this handler when recovering from error | |
29 | */ | |
30 | ||
31 | typedef struct _ConfOpt{ | |
32 | const char *optname; | |
33 | const char *argfmt; | |
34 | bool (*fn)(Tokenizer *tokz, int n, Token *toks); | |
35 | struct _ConfOpt *opts; | |
36 | } ConfOpt; | |
37 | ||
38 | ||
39 | extern bool parse_config_tokz(Tokenizer *tokz, const ConfOpt *options); | |
40 | extern bool parse_config(const char *fname, const ConfOpt *options, int flags); | |
41 | extern bool parse_config_file(FILE *file, const ConfOpt *options, int flags); | |
42 | ||
8 | 43 | #endif /* LIBTU_PARSER_H */ |