include/libtu/parser.h

Sat, 01 Jul 2000 14:18:56 +0200

author
tuomov
date
Sat, 01 Jul 2000 14:18:56 +0200
changeset 16
f597c8f0bcc9
parent 9
55e7f2ff6021
child 20
3f11f764772a
permissions
-rw-r--r--

trunk: changeset 19
Use POSIX_SOURCE

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

mercurial