include/libtu/parser.h

Wed, 19 Apr 2000 22:17:57 +0200

author
tuomov
date
Wed, 19 Apr 2000 22:17:57 +0200
changeset 6
f73065173121
parent 5
f878a9ffa3e0
child 8
c1994196683f
permissions
-rw-r--r--

trunk: changeset 9
Added rules.mk system.mk

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

mercurial