forked from waxeye-org/waxeye
/
trans.h
55 lines (44 loc) · 942 Bytes
/
trans.h
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
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
/*
* Waxeye Parser Generator
* www.waxeye.org
* Copyright (C) 2008-2010 Orlando Hill
* Licensed under the MIT license. See 'LICENSE' for details.
*/
#ifndef TRANS_H_
#define TRANS_H_
#ifdef __cplusplus
extern "C" {
#endif
#include <waxeye/set.h>
/*
Transition is either
wild card
a single character
a character set
an index for an automaton
*/
enum trans_type {
TRANS_WILD,
TRANS_CHAR,
TRANS_SET,
TRANS_FA
};
union trans_data {
char c;
struct set_t *set;
size_t fa;
};
struct trans_t {
enum trans_type type;
union trans_data data;
};
#ifndef TRANS_C_
extern void trans_init(struct trans_t *s, enum trans_type type, union trans_data data);
extern struct trans_t* trans_new(enum trans_type type, union trans_data data);
extern void trans_clear(struct trans_t *s);
extern void trans_delete(struct trans_t *s);
#endif /* TRANS_C_ */
#ifdef __cplusplus
}
#endif
#endif /* TRANS_H_ */