Tue, 15 Feb 2005 18:57:52 +0100
Tailorization of trunk
Import of the upstream sources from the repository
http://tao.uab.es/ion/svn/libtu/trunk
as of revision 2
0 | 1 | /* |
2 | * libtu/parser.h | |
3 | * | |
4 | * Copyright (c) Tuomo Valkonen 1999-2000. | |
5 | * | |
6 | * This file is distributed under the terms of the "Artistic License". | |
7 | * See the included file LICENSE for details. | |
8 | */ | |
9 | ||
10 | #ifndef __LIBTU_PARSER_H | |
11 | #define __LIBTU_PARSER_H | |
12 | ||
13 | #include "tokenizer.h" | |
14 | ||
15 | /* | |
16 | * format: | |
17 | * l = long | |
18 | * d = double | |
19 | * i = identifier | |
20 | * s = string | |
21 | * c = char | |
22 | * . = 1 times any ("l.d") | |
23 | * * = 0 or more times any (must be the last, "sd*") | |
24 | * ? = optional ("?c") | |
25 | * : = conditional (":c:s") | |
26 | * | |
27 | * special entries: | |
28 | * | |
29 | * "#end" call this handler at the end of section. | |
30 | * "#cancel" call this handler when recovering from error | |
31 | */ | |
32 | ||
33 | typedef struct _ConfOpt{ | |
34 | const char *optname; | |
35 | const char *argfmt; | |
36 | bool (*fn)(Tokenizer *tokz, int n, Token *toks); | |
37 | struct _ConfOpt *opts; | |
38 | } ConfOpt; | |
39 | ||
40 | ||
41 | extern bool parse_config_tokz(Tokenizer *tokz, const ConfOpt *options); | |
42 | extern bool parse_config(const char *fname, const ConfOpt *options); | |
43 | extern bool parse_config_file(FILE *file, const ConfOpt *options); | |
44 | ||
45 | #endif /* __LIBTU_PARSER_H */ |