4 * Copyright (c) Tuomo Valkonen 1999-2002.
6 * You may distribute and modify this library under the terms of either
7 * the Clarified Artistic License or the GNU LGPL, version 2.1 or later.
10 #ifndef LIBTU_PARSER_H
11 #define LIBTU_PARSER_H
13 #include "tokenizer.h"
22 * . = 1 times any ("l.d")
23 * * = 0 or more times any (must be the last, "sd*")
25 * : = conditional (":c:s")
26 * + = 1 or more times last (most be the last, "l+")
29 * "#end" call this handler at the end of section.
30 * "#cancel" call this handler when recovering from error
33 #define END_CONFOPTS {NULL, NULL, NULL, NULL}
35 typedef struct _ConfOpt
{
38 bool (*fn
)(Tokenizer
*tokz
, int n
, Token
*toks
);
39 struct _ConfOpt
*opts
;
42 #define CONFOPTS_NOT_SET libtu_dummy_confopts
43 extern ConfOpt libtu_dummy_confopts
[];
45 extern bool parse_config_tokz(Tokenizer
*tokz
, const ConfOpt
*options
);
46 extern bool parse_config_tokz_skip_section(Tokenizer
*tokz
);
47 extern bool parse_config(const char *fname
, const ConfOpt
*options
, int flags
);
48 extern bool parse_config_file(FILE *file
, const ConfOpt
*options
, int flags
);
49 extern bool check_args(const Tokenizer
*tokz
, Token
*tokens
, int ntokens
,
51 extern bool check_args_loose(const Tokenizer
*tokz
, Token
*tokens
, int ntokens
,
54 #endif /* LIBTU_PARSER_H */