blob: dac6e8a5752149d010f1b41636b7749f576fa047 (
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
35
36
37
38
39
40
41
42
43
44
45
46
|
#ifndef AST_H
#define AST_H
struct repeat {
long min, max;
};
enum {
ATOM_ALTERNATION,
ATOM_SEQUENCE,
ATOM_REPETITION,
ATOM_ALPHABETIC,
ATOM_NUMERIC,
ATOM_UPPERCASE,
ATOM_LOWERCASE,
ATOM_CONTROL,
ATOM_PUNCTUATION,
ATOM_EVERYTHING,
ATOM_LITERAL,
ATOM_MAX
};
struct atom {
int type;
union {
struct {
struct repeat counts;
struct atom *child;
} repeat;
struct atom *children[2];
const char *literal;
} u;
};
struct atom *mkatom(const struct atom *src);
void dump_atom(const struct atom *a);
void print_regex(const struct atom *a);
void simplify(struct atom *a);
extern struct atom *ast;
#endif
|