include/parser.h

Tue, 15 Feb 2005 18:57:52 +0100

author
tailor@f281.ttorni.ton.tut.fi
date
Tue, 15 Feb 2005 18:57:52 +0100
changeset 0
86b7f6f9c5c0
child 1
6e704fc09528
permissions
-rw-r--r--

Tailorization of trunk
Import of the upstream sources from the repository

http://tao.uab.es/ion/svn/libtu/trunk

as of revision 2

/*
 * libtu/parser.h
 *
 * Copyright (c) Tuomo Valkonen 1999-2000.
 * 
 * This file is distributed under the terms of the "Artistic License".
 * See the included file LICENSE for details.
 */

#ifndef __LIBTU_PARSER_H
#define __LIBTU_PARSER_H

#include "tokenizer.h"

/*
 * format:
 * 	l = long
 *	d = double
 * 	i = identifier
 * 	s = string
 * 	c = char
 *  . = 1 times any     ("l.d")
 *  * = 0 or more times any (must be the last, "sd*")
 * 	? = optional		("?c")
 * 	: = conditional		(":c:s")
 * 
 * special entries:
 * 
 * "#end" 		call this handler at the end of section.
 * "#cancel" 	call this handler when recovering from error
 */

typedef struct _ConfOpt{
	const char *optname;
	const char *argfmt;
	bool (*fn)(Tokenizer *tokz, int n, Token *toks);
	struct _ConfOpt *opts;
} ConfOpt;


extern bool parse_config_tokz(Tokenizer *tokz, const ConfOpt *options);
extern bool parse_config(const char *fname, const ConfOpt *options);
extern bool parse_config_file(FILE *file, const ConfOpt *options);

#endif /* __LIBTU_PARSER_H */

mercurial