blob: 77e7b843d5e94e779fcb38e6acc7abf64b616226 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
|
#ifndef INPUT_H
#define INPUT_H
#include "grammar.h"
/* The class of a general reader, which can read a grammar, either
from a file, or elsewhere, such as from an Emacs buffer, the
standard input, or even from some other places.
The only expectation, or requirement, of such a reader is to
provide a function with a variable number and type of arguments
which returns a grammar. Then the package provides a function to
properly read a grammar, according to the specifications of the
reader. */
typedef Grammar *(*reader_func_t)(List *args);
typedef struct Reader_s Reader;
/* contructor */
/* Build a reader and assign to *reader. It is expected to be
allocated before this function. */
void build_reader(Reader *reader, reader_func_t func, List *args);
/* destructor */
/* Does not free READER.
FLAG is passed to destroy_list, which see. */
void destroy_reader(Reader *reader, int flag);
#endif
|